EBookContacts.VCardAttribute¶
Fields¶
None
Methods¶
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class EBookContacts.VCardAttribute¶
- classmethod new(attr_group, attr_name)¶
- Parameters:
- Returns:
A new
EBookContacts.VCardAttribute
.- Return type:
Creates a new
EBookContacts.VCardAttribute
with the specified group and attribute names. The attr_group may beNone
or the empty string if no group is needed.
- add_param(param)¶
- Parameters:
param (
EBookContacts.VCardAttributeParam
) – anEBookContacts.VCardAttributeParam
to add
Prepends param to self's list of parameters. This takes ownership of param (and all its values).
Duplicate parameters have their values merged, so that all parameter names in self are unique. Values are also merged so that uniqueness is preserved.
- add_param_with_value(param, value)¶
- Parameters:
param (
EBookContacts.VCardAttributeParam
) – anEBookContacts.VCardAttributeParam
value (
str
) – a string value
Appends value to param, then prepends param to self. This takes ownership of param, but not of value.
This is a convenience method for
EBookContacts.VCardAttributeParam.add_value
() andEBookContacts.VCardAttribute.add_param
().
- add_value_decoded(value, len)¶
-
Encodes value according to the encoding used for self, and appends it to self's list of values.
This should only be used if the
EBookContacts.VCardAttribute
has a non-raw encoding (i.e. if it’s encoded in base-64 or quoted-printable encoding).
- copy()¶
- Returns:
A new
EBookContacts.VCardAttribute
identical to self.- Return type:
Makes a copy of self.
- free()¶
Frees an attribute, its values and its parameters.
- get_group()¶
-
Gets the group name of self.
- get_param(name)¶
- Parameters:
name (
str
) – a parameter name- Returns:
A list of string elements representing the parameter’s values, or
None
.- Return type:
Gets the list of values for the paramater name from self. The list and its contents are owned by self, and must not be freed. If no parameter with the given name exists,
None
is returned.
- get_params()¶
- Returns:
A list of elements of type
EBookContacts.VCardAttributeParam
.- Return type:
Gets the list of parameters (of type
EBookContacts.VCardAttributeParam
) from self. The list and its contents are owned by self, and must not be freed.
- get_value()¶
- Returns:
A newly allocated string representing the value, or
None
if the attribute has no value.- Return type:
Gets the value of a single-valued
EBookContacts.VCardAttribute
, self.For example, for a FN (full name) attribute, this will return the contact’s full name as a single string.
This will print a warning if called on an
EBookContacts.VCardAttribute
which is not single-valued (i.e. for whichEBookContacts.VCardAttribute.is_single_valued
() returnsFalse
). UseEBookContacts.VCardAttribute.get_values
() in such cases instead.
- get_value_decoded()¶
- Returns:
A newly allocated
GLib.String
representing the value, orNone
if the attribute has no value.- Return type:
GLib.String
orNone
Gets the value of a single-valued
EBookContacts.VCardAttribute
, self, decoding it if necessary according to the encoding given in the vCard’sENCODING attribute. This will print a warning if called on an
EBookContacts.VCardAttribute
which is not single-valued (i.e. for whichEBookContacts.VCardAttribute.is_single_valued
() returnsFalse
). UseEBookContacts.VCardAttribute.get_values_decoded
() in such cases instead.
- get_values()¶
- Returns:
A list of string values. They will all be non-
None
, but may be empty strings. The list itself may be empty.- Return type:
[
str
]
Gets the ordered list of values from self. The list and its contents are owned by self, and must not be freed.
For example, for an ADR (postal address) attribute, this will return the components of the postal address.
This may be called on a single-valued attribute (i.e. one for which
EBookContacts.VCardAttribute.is_single_valued
() returnsTrue
) and will return a one-element list in that case. Alternatively, useEBookContacts.VCardAttribute.get_value
() in such cases.
- get_values_decoded()¶
- Returns:
A list of values of type
GLib.String
.- Return type:
Gets the ordered list of values from self, decoding them if necessary according to the encoding given in the vCard’s
ENCODING attribute. The list and its contents are owned by self, and must not be freed.
This may be called on a single-valued attribute (i.e. one for which
EBookContacts.VCardAttribute.is_single_valued
() returnsTrue
) and will return a one-element list in that case. Alternatively, useEBookContacts.VCardAttribute.get_value_decoded
() in such cases.
- has_type(typestr)¶
- Parameters:
typestr (
str
) – a string representing the type- Returns:
- Return type:
Checks if self has an
EBookContacts.VCardAttributeParam
with nameEBookContacts.EVC_TYPE
and typestr as one of its values.For example, for the vCard attribute:
TEL;TYPE=WORK,VOICE:(111) 555-1212
the following holds true:
g_assert_true (e_vcard_attribute_has_type (attr, "WORK") == TRUE); g_assert_true (e_vcard_attribute_has_type (attr, "voice") == TRUE); g_assert_true (e_vcard_attribute_has_type (attr, "HOME") == FALSE);
Comparisons against typestr are case-insensitive.
- is_single_valued()¶
-
Checks if self has a single value.
- remove_param(param_name)¶
- Parameters:
param_name (
str
) – a parameter name
Removes and frees parameter param_name from the attribute self. Parameter names are guaranteed to be unique, so self is guaranteed to have no parameters named param_name after this function returns.
New in version 1.12.
- remove_param_value(param_name, s)¶
-
Removes the value s from the parameter param_name on the attribute self. If s was the only value for parameter param_name, that parameter is removed entirely from self and freed.
- remove_params()¶
Removes and frees all parameters from self.
This also resets the
EBookContacts.VCardAttribute
's encoding back to raw.
- remove_value(s)¶
- Parameters:
s (
str
) – a value to remove
Removes value s from the value list in self. The value s is not freed.
- remove_values()¶
Removes and frees all values from self.