na-ifactory-object

na-ifactory-object

Synopsis

#define             NA_IFACTORY_OBJECT_TYPE
#define             NA_IFACTORY_OBJECT_GET_INTERFACE    (instance)
typedef             NAIFactoryObject;
typedef             NAIFactoryObjectInterfacePrivate;
                    NAIFactoryObjectInterface;
NADataGroup *       na_ifactory_object_get_data_groups  (const NAIFactoryObject *object);
NADataBoxed *       na_ifactory_object_get_data_boxed   (const NAIFactoryObject *object,
                                                         const gchar *name);
void *              na_ifactory_object_get_as_void      (const NAIFactoryObject *object,
                                                         const gchar *name);
void                na_ifactory_object_set_from_void    (NAIFactoryObject *object,
                                                         const gchar *name,
                                                         const void *data);

Object Hierarchy

  GInterface
   +----NAIFactoryObject

Prerequisites

NAIFactoryObject requires GObject.

Known Implementations

NAIFactoryObject is implemented by NAObjectAction, NAObjectMenu and NAObjectProfile.

Description

Details

NA_IFACTORY_OBJECT_TYPE

#define NA_IFACTORY_OBJECT_TYPE							( na_ifactory_object_get_type())


NA_IFACTORY_OBJECT_GET_INTERFACE()

#define NA_IFACTORY_OBJECT_GET_INTERFACE( instance ) ( G_TYPE_INSTANCE_GET_INTERFACE(( instance ), NA_IFACTORY_OBJECT_TYPE, NAIFactoryObjectInterface ))

instance :


NAIFactoryObject

typedef struct NAIFactoryObject                 NAIFactoryObject;


NAIFactoryObjectInterfacePrivate

typedef struct NAIFactoryObjectInterfacePrivate NAIFactoryObjectInterfacePrivate;


NAIFactoryObjectInterface

typedef struct {
	GTypeInterface                    parent;
	NAIFactoryObjectInterfacePrivate *private;

	/**
	 * get_version:
	 * @instance: this #NAIFactoryObject instance.
	 *
	 * Returns: the version of this interface supported by @instance implementation.
	 *
	 * Defaults to 1.
	 */
	guint         ( *get_version )( const NAIFactoryObject *instance );

	/**
	 * get_groups:
	 * @instance: this #NAIFactoryObject instance.
	 *
	 * Returns: a pointer to the NADataGroup which defines this object.
	 */
	NADataGroup * ( *get_groups ) ( const NAIFactoryObject *instance );

	/**
	 * copy:
	 * @instance: the target #NAIFactoryObject instance.
	 * @source: the source #NAIFactoryObject instance.
	 *
	 * This function is triggered after having copied @source to
	 * @instance target. This later may take advantage of this call
	 * to do some particular copy tasks.
	 */
	void          ( *copy )       ( NAIFactoryObject *instance, const NAIFactoryObject *source );

	/**
	 * are_equal:
	 * @a: the first #NAIFactoryObject instance.
	 * @b: the second #NAIFactoryObject instance.
	 *
	 * Returns: %TRUE if @a is equal to @b.
	 *
	 * This function is triggered after all elementary data comparisons
	 * have been sucessfully made.
	 */
	gboolean      ( *are_equal )  ( const NAIFactoryObject *a, const NAIFactoryObject *b );

	/**
	 * is_valid:
	 * @object: the #NAIFactoryObject instance whose validity is to be checked.
	 *
	 * Returns: %TRUE if @object is valid.
	 *
	 * This function is triggered after all elementary data comparisons
	 * have been sucessfully made.
	 */
	gboolean      ( *is_valid )   ( const NAIFactoryObject *object );

	/**
	 * read_start:
	 * @instance: this #NAIFactoryObject instance.
	 * @reader: the instance which has provided read services.
	 * @reader_data: the data associated to @reader.
	 * @messages: a pointer to a #GSList list of strings; the instance
	 *  may append messages to this list, but shouldn't reinitialize it.
	 *
	 * Called just before the object is unserialized.
	 */
	void          ( *read_start ) ( NAIFactoryObject *instance, const NAIFactoryProvider *reader, void *reader_data, GSList **messages );

	/**
	 * read_done:
	 * @instance: this #NAIFactoryObject instance.
	 * @reader: the instance which has provided read services.
	 * @reader_data: the data associated to @reader.
	 * @messages: a pointer to a #GSList list of strings; the instance
	 *  may append messages to this list, but shouldn't reinitialize it.
	 *
	 * Called when the object has been unserialized.
	 */
	void          ( *read_done )  ( NAIFactoryObject *instance, const NAIFactoryProvider *reader, void *reader_data, GSList **messages );

	/**
	 * write_start:
	 * @instance: this #NAIFactoryObject instance.
	 * @writer: the instance which has provided writing services.
	 * @writer_data: the data associated to @writer.
	 * @messages: a pointer to a #GSList list of strings; the instance
	 *  may append messages to this list, but shouldn't reinitialize it.
	 *
	 * Called just before the object is serialized.
	 *
	 * Returns: a NAIIOProvider operation return code.
	 */
	guint         ( *write_start )( NAIFactoryObject *instance, const NAIFactoryProvider *writer, void *writer_data, GSList **messages );

	/**
	 * write_done:
	 * @instance: this #NAIFactoryObject instance.
	 * @writer: the instance which has provided writing services.
	 * @writer_data: the data associated to @writer.
	 * @messages: a pointer to a #GSList list of strings; the instance
	 *  may append messages to this list, but shouldn't reinitialize it.
	 *
	 * Called when the object has been serialized.
	 *
	 * Returns: a NAIIOProvider operation return code.
	 */
	guint         ( *write_done ) ( NAIFactoryObject *instance, const NAIFactoryProvider *writer, void *writer_data, GSList **messages );
} NAIFactoryObjectInterface;


na_ifactory_object_get_data_groups ()

NADataGroup *       na_ifactory_object_get_data_groups  (const NAIFactoryObject *object);

object :

a NAIFactoryObject object.

Returns :

The NADataGroup groups definition, or NULL. The returned NADataGroup is owned by the NAIFactoryObject object, and should not be released by the caller.

na_ifactory_object_get_data_boxed ()

NADataBoxed *       na_ifactory_object_get_data_boxed   (const NAIFactoryObject *object,
                                                         const gchar *name);

object :

a NAIFactoryObject object.

name :

the name of the elementary data we are searching for.

Returns :

The NADataBoxed object which contains the specified data, or NULL. The returned NADataBoxed is owned by NAIFactoryObject object, and should not be released by the caller.

na_ifactory_object_get_as_void ()

void *              na_ifactory_object_get_as_void      (const NAIFactoryObject *object,
                                                         const gchar *name);

object :

this NAIFactoryObject instance.

name :

the elementary data whose value is to be got.

Returns :

the searched value. If the type of the value is NAFD_TYPE_STRING, NAFD_TYPE_LOCALE_STRING, or NAFD_TYPE_STRING_LIST, then the returned value is a newly allocated one and should be g_free() (resp. na_core_utils_slist_free()) by the caller.

na_ifactory_object_set_from_void ()

void                na_ifactory_object_set_from_void    (NAIFactoryObject *object,
                                                         const gchar *name,
                                                         const void *data);

Set the elementary data with the given value.

object :

this NAIFactoryObject instance.

name :

the name of the elementary data whose value is to be set.

data :

the value to set.