EBookContacts.VCard

g EBookContacts.VCard EBookContacts.VCard GObject.Object GObject.Object GObject.Object->EBookContacts.VCard

Subclasses:

EBookContacts.Contact

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

escape_string (s)

class

new ()

class

new_from_string (str)

class

unescape_string (s)

add_attribute (attr)

add_attribute_with_value (attr, value)

append_attribute (attr)

append_attribute_with_value (attr, value)

construct (str)

construct_full (str, len, uid)

construct_with_uid (str, uid)

dump_structure ()

get_attribute (name)

get_attribute_if_parsed (name)

get_attributes ()

is_parsed ()

remove_attribute (attr)

remove_attributes (attr_group, attr_name)

to_string (format)

util_dup_x_attribute (x_name)

util_set_x_attribute (x_name, value)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class EBookContacts.VCard(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

EBookContacts.VCardClass

classmethod escape_string(s)
Parameters:

s (str) – the string to escape

Returns:

A newly allocated, escaped string.

Return type:

str

Escapes a string according to RFC2426, section 5.

classmethod new()
Returns:

A new, blank EBookContacts.VCard.

Return type:

EBookContacts.VCard

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:

EBookContacts.VCard

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:

str

Unescapes a string according to RFC2426, section 5.

add_attribute(attr)
Parameters:

attr (EBookContacts.VCardAttribute) – an EBookContacts.VCardAttribute to add

Prepends attr to self. This takes ownership of attr.

add_attribute_with_value(attr, value)
Parameters:

Prepends attr to self, setting it to value. This takes ownership of attr.

This is a convenience wrapper around EBookContacts.VCardAttribute.add_value() and EBookContacts.VCard.add_attribute().

append_attribute(attr)
Parameters:

attr (EBookContacts.VCardAttribute) – an EBookContacts.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:

Appends attr to self, setting it to value. This takes ownership of attr.

This is a convenience wrapper around EBookContacts.VCardAttribute.add_value() and EBookContacts.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:
  • str (str) – a vCard string

  • len (int) – length of str, or -1 if str is None terminated

  • uid (str or None) – a unique ID string

Similar to EBookContacts.VCard.construct_with_uid(), but can also be used with an str that is not None terminated.

New in version 3.12.

construct_with_uid(str, uid)
Parameters:
  • str (str) – a vCard string

  • uid (str or None) – a unique ID string

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, or None.

Return type:

EBookContacts.VCardAttribute or None

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 by EBookContacts.VCard.get_attributes().

get_attribute_if_parsed(name)
Parameters:

name (str) – the name of the attribute to get

Returns:

An EBookContacts.VCardAttribute if found, or None.

Return type:

EBookContacts.VCardAttribute or None

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:

[EBookContacts.VCardAttribute]

Gets the list of all attributes from self. The list and its contents are owned by self, and must not be freed.

is_parsed()
Returns:

True if self has been parsed, False otherwise.

Return type:

bool

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) – an EBookContacts.VCardAttribute to remove

Removes attr from self and frees it. This takes ownership of attr.

remove_attributes(attr_group, attr_name)
Parameters:
  • attr_group (str or None) – group name of attributes to be removed

  • attr_name (str) – name of the arributes to be removed

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:

str

Exports self to a string representation, specified by the format argument.

util_dup_x_attribute(x_name)
Parameters:

x_name (str) – the attribute name, which starts with “X-”

Returns:

Value of attribute x_name, or None, when there is no such attribute. Free the returned pointer with GLib.free(), when no longer needed.

Return type:

str or None

New in version 3.26.

util_set_x_attribute(x_name, value)
Parameters:
  • x_name (str) – the attribute name, which starts with “X-”

  • value (str or None) – the value to set, or None to unset

Sets an “X-” attribute x_name to value value in self, or removes it from self, when value is None.

New in version 3.26.