EBookContacts.VCard¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class EBookContacts.VCard(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod escape_string(s)¶
- Parameters:
s (
str
) – the string to escape- Returns:
A newly allocated, escaped string.
- Return type:
Escapes a string according to RFC2426, section 5.
- classmethod new()¶
- Returns:
A new, blank
EBookContacts.VCard
.- Return type:
Creates a new, blank
EBookContacts.VCard
.
- classmethod new_from_string(str)¶
- Parameters:
str (
str
) – a string representation of the vcard to create- Returns:
A new
EBookContacts.VCard
.- Return type:
Creates a new
EBookContacts.VCard
from the passed-in string representation.
- classmethod unescape_string(s)¶
- Parameters:
s (
str
) – the string to unescape- Returns:
A newly allocated, unescaped string.
- Return type:
Unescapes a string according to RFC2426, section 5.
- add_attribute(attr)¶
- Parameters:
attr (
EBookContacts.VCardAttribute
) – anEBookContacts.VCardAttribute
to add
Prepends attr to self. This takes ownership of attr.
- add_attribute_with_value(attr, value)¶
- Parameters:
attr (
EBookContacts.VCardAttribute
) – anEBookContacts.VCardAttribute
to addvalue (
str
) – a value to assign to the attribute
Prepends attr to self, setting it to value. This takes ownership of attr.
This is a convenience wrapper around
EBookContacts.VCardAttribute.add_value
() andEBookContacts.VCard.add_attribute
().
- append_attribute(attr)¶
- Parameters:
attr (
EBookContacts.VCardAttribute
) – anEBookContacts.VCardAttribute
to append
Appends attr to self to the end of a list of attributes. This takes ownership of attr.
New in version 2.32.
- append_attribute_with_value(attr, value)¶
- Parameters:
attr (
EBookContacts.VCardAttribute
) – anEBookContacts.VCardAttribute
to appendvalue (
str
) – a value to assign to the attribute
Appends attr to self, setting it to value. This takes ownership of attr.
This is a convenience wrapper around
EBookContacts.VCardAttribute.add_value
() andEBookContacts.VCard.append_attribute
().New in version 2.32.
- construct(str)¶
- Parameters:
str (
str
) – a vCard string
Constructs the existing
EBookContacts.VCard
, self, setting its vCard data to str.This modifies self.
- construct_full(str, len, uid)¶
- Parameters:
Similar to
EBookContacts.VCard.construct_with_uid
(), but can also be used with an str that is notNone
terminated.New in version 3.12.
- construct_with_uid(str, uid)¶
-
Constructs the existing
EBookContacts.VCard
, self, setting its vCard data to str, and adding a new UID attribute with the value given in uid (if uid is non-None
).This modifies self.
New in version 3.4.
- dump_structure()¶
Prints a dump of self's structure to stdout. Used for debugging.
- get_attribute(name)¶
- Parameters:
name (
str
) – the name of the attribute to get- Returns:
An
EBookContacts.VCardAttribute
if found, orNone
.- Return type:
Get the attribute name from self. The
EBookContacts.VCardAttribute
is owned by evcard and should not be freed. If the attribute does not exist,None
is returned.This will only return the first attribute with the given name. To get other attributes of that name (for example, other TEL attributes if a contact has multiple telephone numbers), use
EBookContacts.VCard.get_attributes
() and iterate over the list searching for matching attributes.This method iterates over all attributes in the
EBookContacts.VCard
, so should not be called often. If extracting a large number of attributes from a vCard, it is more efficient to iterate once over the list returned byEBookContacts.VCard.get_attributes
().
- get_attribute_if_parsed(name)¶
- Parameters:
name (
str
) – the name of the attribute to get- Returns:
An
EBookContacts.VCardAttribute
if found, orNone
.- Return type:
Similar to
EBookContacts.VCard.get_attribute
() but this method will not attempt to parse the vCard if it is not already parsed.New in version 3.4.
- get_attributes()¶
- Returns:
A list of attributes of type
EBookContacts.VCardAttribute
.- Return type:
Gets the list of all attributes from self. The list and its contents are owned by self, and must not be freed.
- is_parsed()¶
-
Check if the self has been parsed already, as
EBookContacts.VCard
implements lazy parsing of its vCard data. Used for debugging.New in version 3.2.
- remove_attribute(attr)¶
- Parameters:
attr (
EBookContacts.VCardAttribute
) – anEBookContacts.VCardAttribute
to remove
Removes attr from self and frees it. This takes ownership of attr.
- remove_attributes(attr_group, attr_name)¶
- Parameters:
Removes all the attributes with group name and attribute name equal to the passed in values. If attr_group is
None
or an empty string, it removes all the attributes with passed in name irrespective of their group names.
- to_string(format)¶
- Parameters:
format (
EBookContacts.VCardFormat
) – the format to export to- Returns:
A newly allocated string representing the vcard.
- Return type:
Exports self to a string representation, specified by the format argument.