MIMEDirProfile

Name

MIMEDirProfile -- MIME Directory Profile object

Synopsis


#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);


Description

Details

MIMEDIR_PROFILE_ERROR

#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.


enum MIMEDirProfileError

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.


MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR

#define MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE_STR	_("attribute %s defined twice")

Default string representation of the MIMEDIR_PROFILE_ERROR_DUPLICATE_ATTRIBUTE error code.


MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR

#define MIMEDIR_PROFILE_ERROR_UNEXPECTED_END_STR	_("unexpected end of profile")

Default string representation of the MIMEDIR_PROFILE_ERROR_UNEXPECTED_END error code.


MIMEDIR_PROFILE_ERROR_UNMATCHED_END_STR

#define MIMEDIR_PROFILE_ERROR_UNMATCHED_END_STR		_("unmatched END attribute")

Default string representation of the MIMEDIR_PROFILE_ERROR_UNMATCHED_END error code.


MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR

#define MIMEDIR_PROFILE_ERROR_ATTRIBUTE_MISSING_STR	_("required attribute %s is missing")

Default string representation of the MIMEDIR_PROFILE_ERROR_MISSING_STR error code.


MIMEDIR_PROFILE_ERROR_WRONG_PROFILE_STR

#define MIMEDIR_PROFILE_ERROR_WRONG_PROFILE_STR		_("wrong profile %s; expected %s")

Default string representation of the MIMEDIR_PROFILE_ERROR_WRONG_PROFILE error code.


MIMEDirProfile

typedef struct {
	GObject parent;

	MIMEDirProfilePriv *priv;
} MIMEDirProfile;

The MIMEDirProfile struct contains private data only, and should be accessed using the functions below.


mimedir_profile_new ()

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


mimedir_profile_write_to_channel ()

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 :

a MIMEDirProfile

channel :

I/O channel to write to

error :

error storage location or NULL

Returns :

success indicator


mimedir_profile_write_to_string ()

gchar*              mimedir_profile_write_to_string     (MIMEDirProfile *profile);

Saves the profile to a newly allocated string. It should be freed with g_free().

profile :

a MIMEDirProfile

Returns :

a string


mimedir_profile_append_attribute ()

void                mimedir_profile_append_attribute    (MIMEDirProfile *profile,
                                                         MIMEDirAttribute *attribute);

Adds an attribute to the supplied profile.

profile :

a MIMEDirProfile

attribute :

attribute to add


mimedir_profile_get_attribute ()

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 :

a MIMEDirProfile

name :

attribute name

Returns :

the attribute or NULL


mimedir_profile_get_attribute_list ()

GSList*             mimedir_profile_get_attribute_list  (MIMEDirProfile *profile);

Return the ordered list of all the profile's attributes.

profile :

a MIMEDirProfile

Returns :

the attribute list


mimedir_profile_append_subprofile ()

void                mimedir_profile_append_subprofile   (MIMEDirProfile *profile,
                                                         MIMEDirProfile *sub_profile);

Appends sub_profile to profile as a sub-profile.

profile :

a MIMEDirProfile

sub_profile :

a MIMEDirProfile that's to be appended


mimedir_profile_get_subprofiles ()

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 :

a MIMEDirProfile

Returns :

GSList containing all sub-profiles