![]() | ![]() | ![]() | MIME Directory Library Reference Manual | ![]() |
---|
#include <mimedir/mimedir-attribute.h> #define MIMEDIR_ATTRIBUTE_ERROR enum MIMEDirAttributeError; #define MIMEDIR_ATTRIBUTE_ERROR_SYNTAX_STR #define MIMEDIR_ATTRIBUTE_ERROR_ILLEGAL_CHAR_STR #define MIMEDIR_ATTRIBUTE_ERROR_INVALID_FORMAT_STR #define MIMEDIR_ATTRIBUTE_ERROR_UNKNOWN_ENCODING_STR #define MIMEDIR_ATTRIBUTE_ERROR_INVALID_VALUE_STR #define MIMEDIR_ATTRIBUTE_ERROR_PARAMETER_NOT_UNIQUE_STR #define MIMEDIR_ATTRIBUTE_ERROR_INVALID_BASE64_STR #define MIMEDIR_ATTRIBUTE_ERROR_INVALID_QP_STR #define MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_SHORT_STR #define MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_LONG_STR enum MIMEDirAttributeType; enum MIMEDirAttributeEncoding; #define MIMEDIR_ATTRIBUTE_ENCODING_NONE MIMEDirAttribute; MIMEDirAttribute* mimedir_attribute_new (void); gboolean mimedir_attribute_write_to_channel (MIMEDirAttribute *attribute, GIOChannel *channel, GError **error); const gchar* mimedir_attribute_get_name (MIMEDirAttribute *attribute); void mimedir_attribute_set_group (MIMEDirAttribute *attribute, const gchar *group); const gchar* mimedir_attribute_get_group (MIMEDirAttribute *attribute); void mimedir_attribute_set_attribute_type (MIMEDirAttribute *attribute, MIMEDirAttributeType type); MIMEDirAttributeType mimedir_attribute_get_attribute_type (MIMEDirAttribute *attribute); void mimedir_attribute_append_parameter (MIMEDirAttribute *attribute, const gchar *name, GSList *values); void mimedir_attribute_append_parameter_simple (MIMEDirAttribute *attribute, const gchar *name, const gchar *value); gboolean mimedir_attribute_has_parameter (MIMEDirAttribute *attribute, const gchar *parameter); GSList* mimedir_attribute_get_parameter_values (MIMEDirAttribute *attribute, const gchar *parameter); const gchar* mimedir_attribute_get_parameter_value (MIMEDirAttribute *attribute, const gchar *parameter); void mimedir_attribute_free_parameter_values (MIMEDirAttribute *attribute, GSList *list); void mimedir_attribute_set_value_uri (MIMEDirAttribute *attribute, const gchar *uri); gchar* mimedir_attribute_get_value_uri (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_set_value_text (MIMEDirAttribute *attribute, const gchar *text); gchar* mimedir_attribute_get_value_text (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_set_value_text_list (MIMEDirAttribute *attribute, GSList *list); GSList* mimedir_attribute_get_value_text_list (MIMEDirAttribute *attribute, GError **error); #define mimedir_attribute_free_text_list (list) void mimedir_attribute_set_value_datetime (MIMEDirAttribute *attribute, MIMEDirDateTime *datetime); MIMEDirDateTime* mimedir_attribute_get_value_datetime (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_set_value_datetime_list (MIMEDirAttribute *attribute, GSList *list); GSList* mimedir_attribute_get_value_datetime_list (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_free_datetime_list (GSList *list); void mimedir_attribute_set_value_bool (MIMEDirAttribute *attribute, gboolean b); gboolean mimedir_attribute_get_value_bool (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_set_value_int (MIMEDirAttribute *attribute, gint i); gint mimedir_attribute_get_value_int (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_set_value_int_list (MIMEDirAttribute *attribute, GSList *list); GSList* mimedir_attribute_get_value_int_list (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_free_int_list (GSList *list); void mimedir_attribute_set_value_float_list (MIMEDirAttribute *attribute, GSList *list); GSList* mimedir_attribute_get_value_float_list (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_free_float_list (GSList *list); void mimedir_attribute_set_value_structured_text (MIMEDirAttribute *attribute, GSList *list); GSList* mimedir_attribute_get_value_structured_text (MIMEDirAttribute *attribute, GError **error); void mimedir_attribute_free_structured_text_list (GSList *list);
#define MIMEDIR_ATTRIBUTE_ERROR mimedir_attribute_error_quark ()
Error domain for MIMEDirAttribute operations. Errors in this domain will be from the MIMEDirAttributeError enumeration. See GError for information on error domains.
typedef enum { MIMEDIR_ATTRIBUTE_ERROR_SYNTAX, MIMEDIR_ATTRIBUTE_ERROR_ILLEGAL_CHAR, MIMEDIR_ATTRIBUTE_ERROR_INVALID_FORMAT, MIMEDIR_ATTRIBUTE_ERROR_UNKNOWN_ENCODING, MIMEDIR_ATTRIBUTE_ERROR_INVALID_VALUE, MIMEDIR_ATTRIBUTE_ERROR_PARAMETER_NOT_UNIQUE, MIMEDIR_ATTRIBUTE_ERROR_INVALID_BASE64, MIMEDIR_ATTRIBUTE_ERROR_INVALID_QP, MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_SHORT, MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_LONG } MIMEDirAttributeError;
Error codes returned by MIMEDirAttribute operations.
MIMEDIR_ATTRIBUTE_ERROR_SYNTAX | There was a syntax error. |
MIMEDIR_ATTRIBUTE_ERROR_ILLEGAL_CHAR | An illegal character was found in the input stream. |
MIMEDIR_ATTRIBUTE_ERROR_INVALID_FORMAT | The format of an attribute value does not match the requested value type. |
MIMEDIR_ATTRIBUTE_ERROR_UNKNOWN_ENCODING | The attribute value can not be decoded, since its encoding is unknown. |
MIMEDIR_ATTRIBUTE_ERROR_INVALID_VALUE | The attribute value is out of range. |
MIMEDIR_ATTRIBUTE_ERROR_PARAMETER_NOT_UNIQUE | A parameter that is required to be unique is not. |
MIMEDIR_ATTRIBUTE_ERROR_INVALID_BASE64 | Invalid Base64-encoded string. |
MIMEDIR_ATTRIBUTE_ERROR_INVALID_QP | Invalid quoted-printable-encoded string. |
MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_SHORT | The parameter list is too short. |
MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_LONG | The parameter list is too long. |
#define MIMEDIR_ATTRIBUTE_ERROR_SYNTAX_STR _("syntax error (%s)")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_SYNTAX error code.
#define MIMEDIR_ATTRIBUTE_ERROR_ILLEGAL_CHAR_STR _("illegal character 0x%02x for type \"%s\"")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_ILLEGAL_CHAR error code.
#define MIMEDIR_ATTRIBUTE_ERROR_INVALID_FORMAT_STR _("invalid format for type \"%s\" in attribute %s")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_INVALID_FORMAT error code.
#define MIMEDIR_ATTRIBUTE_ERROR_UNKNOWN_ENCODING_STR _("attribute %s could not be decoded, since its encoding is unknown")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_UNKNOWN_ENCODING error code.
#define MIMEDIR_ATTRIBUTE_ERROR_INVALID_VALUE_STR _("invalid value in attribute %s")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_INVALID_VALUE error code.
#define MIMEDIR_ATTRIBUTE_ERROR_PARAMETER_NOT_UNIQUE_STR _("parameter \"%s\" must not be used more than once in attribute %s")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_PARAMETER_NOT_UNIQUE error code.
#define MIMEDIR_ATTRIBUTE_ERROR_INVALID_BASE64_STR _("invalid Base64 sequence")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_INVALID_BASE64 error code.
#define MIMEDIR_ATTRIBUTE_ERROR_INVALID_QP_STR _("invalid quoted-printable sequence")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_INVALID_QP error code.
#define MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_SHORT_STR _("attribute list of %s is too short")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_SHORT error code.
#define MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_LONG_STR _("attribute list of %s is too long")
Default string representation of the MIMEDIR_ATTRIBUTE_ERROR_LIST_TOO_LONG error code.
typedef enum { MIMEDIR_ATTRIBUTE_TYPE_UNKNOWN, MIMEDIR_ATTRIBUTE_TYPE_URI, MIMEDIR_ATTRIBUTE_TYPE_TEXT, MIMEDIR_ATTRIBUTE_TYPE_DATE, MIMEDIR_ATTRIBUTE_TYPE_TIME, MIMEDIR_ATTRIBUTE_TYPE_DATETIME, MIMEDIR_ATTRIBUTE_TYPE_INTEGER, MIMEDIR_ATTRIBUTE_TYPE_FLOAT, MIMEDIR_ATTRIBUTE_TYPE_BOOLEAN, /* VCard */ MIMEDIR_ATTRIBUTE_TYPE_STRUCTURED_TEXT, MIMEDIR_ATTRIBUTE_TYPE_PARAMETERS, } MIMEDirAttributeType;
The attribute's type.
MIMEDIR_ATTRIBUTE_TYPE_UNKNOWN | Attribute type is unknown. |
MIMEDIR_ATTRIBUTE_TYPE_URI | Attribute represents an URI as defined in [RFC 1738]. |
MIMEDIR_ATTRIBUTE_TYPE_TEXT | Attribute consists of a list of text string. |
MIMEDIR_ATTRIBUTE_TYPE_DATE | Attribute consists of a list of dates. |
MIMEDIR_ATTRIBUTE_TYPE_TIME | Attribute consists of a list of times. |
MIMEDIR_ATTRIBUTE_TYPE_DATETIME | Attribute consists of list of dates and times. |
MIMEDIR_ATTRIBUTE_TYPE_INTEGER | Attribute consists of a list of integer values. |
MIMEDIR_ATTRIBUTE_TYPE_FLOAT | Attribute consists of a list of floating point values. |
MIMEDIR_ATTRIBUTE_TYPE_BOOLEAN | Attribute is a boolean value. |
MIMEDIR_ATTRIBUTE_TYPE_STRUCTURED_TEXT | Attribute is a structured text value. |
MIMEDIR_ATTRIBUTE_TYPE_PARAMETERS |
typedef enum { MIMEDIR_ATTRIBUTE_ENCODING_UNKNOWN, MIMEDIR_ATTRIBUTE_ENCODING_BASE64, MIMEDIR_ATTRIBUTE_ENCODING_QP, /* read-only */ } MIMEDirAttributeEncoding;
The encoding of the attribute's value.
MIMEDIR_ATTRIBUTE_ENCODING_UNKNOWN | The encoding is unknown. |
MIMEDIR_ATTRIBUTE_ENCODING_BASE64 | The value is Base64-encoded. |
MIMEDIR_ATTRIBUTE_ENCODING_QP | The value is encoded as a quoted-printable string. This encoding is read-only and must not be set. |
#define MIMEDIR_ATTRIBUTE_ENCODING_NONE MIMEDIR_ATTRIBUTE_ENCODING_UNKNOWN
Alias for MIMEDIR_ATTRIBUTE_ENCODING_UNKNOWN.
typedef struct { GObject parent; MIMEDirAttributePriv *priv; } MIMEDirAttribute;
The MIMEDirAttribute struct contains private data only, and should be accessed using the functions below.
MIMEDirAttribute* mimedir_attribute_new (void);
Create a new MIMEDirAttribute object.
Returns : | the new MIMEDirAttribute object |
gboolean mimedir_attribute_write_to_channel (MIMEDirAttribute *attribute, GIOChannel *channel, GError **error);
Writes the attribute to the supplied channel. If an error occurs during
the write, error
will be set and FALSE will be returned. Otherwise
TRUE is returned.
attribute : | |
channel : | an I/O channel |
error : | error storage location or NULL |
Returns : | success indicator |
const gchar* mimedir_attribute_get_name (MIMEDirAttribute *attribute);
Returns the name of the attribute.
attribute : | |
Returns : | the attribute name |
void mimedir_attribute_set_group (MIMEDirAttribute *attribute, const gchar *group);
Sets the name of the attribute to group
. If group
is NULL the
attribute will not belong to any group.
attribute : | |
group : | new group name or NULL |
const gchar* mimedir_attribute_get_group (MIMEDirAttribute *attribute);
Returns the group of the attribute. A NULL value means that the attribute does not belong to a group.
attribute : | |
Returns : | the attribute group or NULL |
void mimedir_attribute_set_attribute_type (MIMEDirAttribute *attribute, MIMEDirAttributeType type);
Sets the attribute's type.
attribute : | |
type : | the new type |
MIMEDirAttributeType mimedir_attribute_get_attribute_type (MIMEDirAttribute *attribute);
Gets the attribute's type.
attribute : | |
Returns : | the attribute type |
void mimedir_attribute_append_parameter (MIMEDirAttribute *attribute, const gchar *name, GSList *values);
Appends a parameter to an attribute. If a parameter with the same name does already exist, the values are appended to it.
attribute : | |
name : | parameter name |
values : | list of parameter values |
void mimedir_attribute_append_parameter_simple (MIMEDirAttribute *attribute, const gchar *name, const gchar *value);
Appends a parameter to an attribute. If a parameter with the same name does already exist, the value is appended to it.
attribute : | |
name : | parameter name |
value : | parameter value |
gboolean mimedir_attribute_has_parameter (MIMEDirAttribute *attribute, const gchar *parameter);
Returns TRUE if the attribute possesses the given parameter. Otherwise FALSE is returned.
attribute : | |
parameter : | parameter name |
Returns : | possession indicator |
GSList* mimedir_attribute_get_parameter_values (MIMEDirAttribute *attribute, const gchar *parameter);
Returns the list of string values for the given parameter. If the
attribute does not possess the parameter, NULL is returned. Otherwise
the list has at least one element. This list must be freed with
mimedir_attribute_free_parameter_values()
.
attribute : | |
parameter : | parameter name |
Returns : | the value list or NULL |
const gchar* mimedir_attribute_get_parameter_value (MIMEDirAttribute *attribute, const gchar *parameter);
Returns the value for the given parameter. If the attribute does not possess the parameter, NULL is returned.
attribute : | |
parameter : | parameter name |
Returns : | the value or NULL |
void mimedir_attribute_free_parameter_values (MIMEDirAttribute *attribute, GSList *list);
Frees an parameter list as obtained through
mimedir_attribute_get_parameter_values()
.
attribute : | |
list : | the value list |
void mimedir_attribute_set_value_uri (MIMEDirAttribute *attribute, const gchar *uri);
Sets the attribute's value to the supplied URI argument. uri
must be a valid URI as
described in [URI].
attribute : | |
uri : | the new URI |
gchar* mimedir_attribute_get_value_uri (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of attribute
as an URI as described in
[URI]
and returns it. The returned string should be freed with g_free()
. If the attribute
value can't be interpreted as an URI, error
will be set and NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | the URI or NULL |
void mimedir_attribute_set_value_text (MIMEDirAttribute *attribute, const gchar *text);
Sets the value of the attribute to a single text value.
attribute : | |
text : | the text to set |
gchar* mimedir_attribute_get_value_text (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a single text value
and returns it. The returned string should be freed with g_free()
.
If the attribute value can't be interpreted as text, error
will be
set and NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | the text value or NULL |
void mimedir_attribute_set_value_text_list (MIMEDirAttribute *attribute, GSList *list);
Sets the attribute to a list of comma-separated text values.
attribute : | |
list : | list of string pointers |
GSList* mimedir_attribute_get_value_text_list (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a comma-separated list of
text values and returns the list. The returned list should be freed
with mimedir_attribute_free_text_list()
. If the attribute value can't
be interpreted as text list, error
will be set and NULL will be
returned.
attribute : | |
error : | error storage location or NULL |
Returns : | the text list or NULL |
#define mimedir_attribute_free_text_list(list) mimedir_attribute_free_list(list)
Frees a list of string pointers as returned by
mimedir_attribute_get_value_text_list()
.
list : |
|
void mimedir_attribute_set_value_datetime (MIMEDirAttribute *attribute, MIMEDirDateTime *datetime);
Sets the attribute's value to the supplied date and time.
attribute : | |
datetime : |
MIMEDirDateTime* mimedir_attribute_get_value_datetime (MIMEDirAttribute *attribute, GError **error);
Tries to interpret the attribute's value as a single date/time value.
It honors the VALUE parameter if it is set. A newly allocated
MIMEDirDateTime object will be returned. It is set to the date
and time read. If an error occurs, error
will be set and NULL
will be returned. Otherwise the returned object must be freed with
g_object_unref()
.
attribute : | |
error : | error storage location or NULL |
Returns : | a newly allocated MIMEDirDateTime object |
void mimedir_attribute_set_value_datetime_list (MIMEDirAttribute *attribute, GSList *list);
Sets the attribute's value to a comma-separated list of times and dates.
attribute : | |
list : | a list of MIMEDirDateTime pointers |
GSList* mimedir_attribute_get_value_datetime_list (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a comma-separated list of
date and time values and returns the list. The returned list should be
freed with mimedir_attribute_free_datetime_list()
. If the attribute
value can't be interpreted as date/time list, error
will be set and
NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | a list of MIMEDirDateTime pointers |
void mimedir_attribute_free_datetime_list (GSList *list);
Frees a list of MIMEDirAttributeDateTime pointers as returned by
mimedir_attribute_get_value_datetime_list()
.
list : | a GSList |
void mimedir_attribute_set_value_bool (MIMEDirAttribute *attribute, gboolean b);
Sets the attribute's value to a boolean value.
attribute : | |
b : | boolean value |
gboolean mimedir_attribute_get_value_bool (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a boolean value and returns.
it. If the attribute value can't be interpreted as boolean value, error
will be set and NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | a boolean value |
void mimedir_attribute_set_value_int (MIMEDirAttribute *attribute, gint i);
Sets the attribute's value to this integer value.
attribute : | |
i : | a gint value |
gint mimedir_attribute_get_value_int (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a single integer value
and returns it. If the attribute value can't be interpreted as an
integer value, error
will be set.
attribute : | |
error : | error storage location or NULL |
Returns : | a gint value |
void mimedir_attribute_set_value_int_list (MIMEDirAttribute *attribute, GSList *list);
Sets the attribute's value to a comma-separated list of integer values.
attribute : | |
list : | a list of gint values |
GSList* mimedir_attribute_get_value_int_list (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a comma-separated list of
integer values and returns the list. The returned list should be
freed with mimedir_attribute_free_int_list()
. If the attribute value
can't be interpreted as int list, error
will be set and NULL will be
returned.
attribute : | |
error : | error storage location or NULL |
Returns : | a list of gint values |
void mimedir_attribute_free_int_list (GSList *list);
Frees a list of integer values as returned by
mimedir_attribute_get_value_int_list()
.
list : | a GSList |
void mimedir_attribute_set_value_float_list (MIMEDirAttribute *attribute, GSList *list);
Sets the attribute's value to a comma-separated list of floating point values.
attribute : | |
list : | a list of gdouble pointers |
GSList* mimedir_attribute_get_value_float_list (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a comma-separated list of
floating point values and returns the list. The returned list should be
freed with mimedir_attribute_free_float_list()
. If the attribute value
can't be interpreted as a list of floating point values, error
will be
set and NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | a list of gdouble pointers |
void mimedir_attribute_free_float_list (GSList *list);
Frees a list of gdouble pointers as returned by
mimedir_attribute_get_value_float_list()
.
list : | a GSList |
void mimedir_attribute_set_value_structured_text (MIMEDirAttribute *attribute, GSList *list);
Sets the attribute's value to a structured text list, i.e. a semicolon-separated list of comma-separated text strings.
attribute : | |
list : | a list of GSLists, containing string pointers |
GSList* mimedir_attribute_get_value_structured_text (MIMEDirAttribute *attribute, GError **error);
Tries to parse the value of an attribute as a structured text type,
i.e. where a comma-separated list of strings is in turn separated by
semi-colons. The returned list should be freed with
mimedir_attribute_free_structured_text_list()
. If the attribute value
can't be interpreted as a structured text type, error
will be set and
NULL will be returned.
attribute : | |
error : | error storage location or NULL |
Returns : | a list of GSLists, containing string pointers |
void mimedir_attribute_free_structured_text_list (GSList *list);
Frees a list as returned by mimedir_attribute_get_value_structured_text()
.
list : | a GSList |
<<< mimedir-init | MIMEDirProfile >>> |