|  |  |  | MIME Directory Library Reference Manual |  | 
|---|
#include <mimedir/mimedir-profile.h> #define MIMEDIR_PROFILE_ERROR enum MIMEDirProfileError; #define MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR #define MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR #define MIMEDIR_PROFILE_ERROR_UNMATCHED_END_STR #define MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR #define MIMEDIR_PROFILE_ERROR_WRONG_PROFILE_STR MIMEDirProfile; MIMEDirProfile* mimedir_profile_new (const gchar *type); gboolean mimedir_profile_write_to_channel (MIMEDirProfile *profile, GIOChannel *channel, GError **error); gchar* mimedir_profile_write_to_string (MIMEDirProfile *profile); void mimedir_profile_append_attribute (MIMEDirProfile *profile, MIMEDirAttribute *attribute); MIMEDirAttribute* mimedir_profile_get_attribute (MIMEDirProfile *profile, const gchar *name); GSList* mimedir_profile_get_attribute_list (MIMEDirProfile *profile); void mimedir_profile_append_subprofile (MIMEDirProfile *profile, MIMEDirProfile *sub_profile); GSList* mimedir_profile_get_subprofiles (MIMEDirProfile *profile);
#define MIMEDIR_PROFILE_ERROR mimedir_profile_error_quark ()
Error domain for MIMEDirProfile operations. Errors in this domain will be from the MIMEDirProfileError enumeration. See GError for information on error domains.
typedef enum {
	MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE,
	MIMEDIR_PROFILE_ERROR_UNEXPECTED_END,
	MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING,
	MIMEDIR_PROFILE_ERROR_UNMATCHED_END,
	MIMEDIR_PROFILE_ERROR_WRONG_PROFILE
} MIMEDirProfileError;Error codes returned by MIMEDirProfile operations.
| MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE | An unique attribute was specified twice. | 
| MIMEDIR_PROFILE_ERROR_UNEXPECTED_END | The profile is missing a proper END attribute. | 
| MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING | An attribute that is required for a specific profile type is missing from the profile. | 
| MIMEDIR_PROFILE_ERROR_UNMATCHED_END | The profile has an END attribute, but no BEGIN attribute or the profile's END attribute doesn't match the BEGIN attribute. | 
| MIMEDIR_PROFILE_ERROR_WRONG_PROFILE | The PROFILE attribute does not match the BEGIN attribute. | 
#define MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR	_("attribute %s defined twice")Default string representation of the MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE error code.
#define MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR	_("unexpected end of profile")Default string representation of the MIMEDIR_PROFILE_ERROR_UNEXPECTED_END error code.
#define MIMEDIR_PROFILE_ERROR_UNMATCHED_END_STR		_("unmatched END attribute")Default string representation of the MIMEDIR_PROFILE_ERROR_UNMATCHED_END error code.
#define MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR	_("required attribute %s is missing")Default string representation of the MIMEDIR_PROFILE_ERROR_MISSING_STR error code.
#define MIMEDIR_PROFILE_ERROR_WRONG_PROFILE_STR		_("wrong profile %s; expected %s")Default string representation of the MIMEDIR_PROFILE_ERROR_WRONG_PROFILE error code.
typedef struct {
	GObject parent;
	MIMEDirProfilePriv *priv;
} MIMEDirProfile;The MIMEDirProfile struct contains private data only, and should be accessed using the functions below.
MIMEDirProfile* mimedir_profile_new (const gchar *type);
Creates a new profile of a given type.
| type: | the profile type, may be NULL | 
| Returns : | pointer to the new profile | 
gboolean mimedir_profile_write_to_channel (MIMEDirProfile *profile, GIOChannel *channel, GError **error);
Writes the profile to the supplied I/O channel. If an error occurs
during the write, error will be set and FALSE will be returned.
Otherwise TRUE is returned.
| profile: | |
| channel: | I/O channel to write to | 
| error: | error storage location or NULL | 
| Returns : | success indicator | 
gchar* mimedir_profile_write_to_string (MIMEDirProfile *profile);
Saves the profile to a newly allocated string. It should be freed with
g_free().
| profile: | |
| Returns : | a string | 
void mimedir_profile_append_attribute (MIMEDirProfile *profile, MIMEDirAttribute *attribute);
Adds an attribute to the supplied profile.
| profile: | |
| attribute: | attribute to add | 
MIMEDirAttribute* mimedir_profile_get_attribute (MIMEDirProfile *profile, const gchar *name);
Tries to find the first occurence of a given attribute by name and
return the MIMEDirAttribute object. If no attribute with the given
name is found, NULL is returned.
| profile: | |
| name: | attribute name | 
| Returns : | the attribute or NULL | 
GSList* mimedir_profile_get_attribute_list (MIMEDirProfile *profile);
Return the ordered list of all the profile's attributes.
| profile: | |
| Returns : | the attribute list | 
void mimedir_profile_append_subprofile (MIMEDirProfile *profile, MIMEDirProfile *sub_profile);
Appends sub_profile to profile as a sub-profile.
| profile: | |
| sub_profile: | a MIMEDirProfile that's to be appended | 
GSList* mimedir_profile_get_subprofiles (MIMEDirProfile *profile);
Returns the list of all sub-profiles of profile. The returned list
must not be altered in any way!
| profile: | |
| Returns : | GSList containing all sub-profiles | 
| <<< MIMEDirAttribute | vCard Object Reference >>> |