4 #include <glib-object.h>
5 #include <lttv/iattribute.h>
7 #define LTTV_ATTRIBUTE_TYPE (lttv_attribute_get_type ())
8 #define LTTV_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_ATTRIBUTE_TYPE, LttvAttribute))
9 #define LTTV_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
10 #define LTTV_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_ATTRIBUTE_TYPE))
11 #define LTTV_IS_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_ATTRIBUTE_TYPE))
12 #define LTTV_ATTRIBUTE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
15 typedef struct _LttvAttribute LttvAttribute
;
16 typedef struct _LttvAttributeClass LttvAttributeClass
;
18 struct _LttvAttribute
{
26 struct _LttvAttributeClass
{
30 GType
lttv_attribute_get_type (void);
33 /* The functions exported in the IAttribute interface are also available
37 /* Total number of attributes */
39 unsigned int lttv_attribute_get_number(LttvAttribute
*self
);
42 /* Container type. Named (fields in struct or elements in a hash table)
43 or unnamed (elements in an array) attributes, homogeneous type or not. */
45 gboolean
lttv_attribute_named(LttvAttribute
*self
, gboolean
*homogeneous
);
48 /* Get the i th attribute along with its type and a pointer to its value. */
50 LttvAttributeType
lttv_attribute_get(LttvAttribute
*self
, unsigned i
,
51 LttvAttributeName
*name
, LttvAttributeValue
*v
);
54 /* Get the named attribute in the table along with its type and a pointer to
55 its value. If the named attribute does not exist, the type is LTTV_NONE. */
57 LttvAttributeType
lttv_attribute_get_by_name(LttvAttribute
*self
,
58 LttvAttributeName name
, LttvAttributeValue
*v
);
61 /* Add an attribute, which must not exist. The name is an empty string for
62 containers with unnamed attributes. */
64 LttvAttributeValue
lttv_attribute_add(LttvAttribute
*self
,
65 LttvAttributeName name
, LttvAttributeType t
);
68 /* Remove an attribute */
70 void lttv_attribute_remove(LttvAttribute
*self
, unsigned i
);
72 void lttv_attribute_remove_by_name(LttvAttribute
*self
,
73 LttvAttributeName name
);
76 /* Create an empty iattribute object and add it as an attribute under the
77 specified name, or return an existing iattribute attribute. If an
78 attribute of that name already exists but is not a GObject supporting the
79 iattribute interface, return NULL. */
81 LttvIAttribute
* lttv_attribute_create_subdir(LttvAttribute
*self
,
82 LttvAttributeName name
);
84 gboolean
lttv_attribute_find(LttvAttribute
*self
, LttvAttributeName name
,
85 LttvAttributeType t
, LttvAttributeValue
*v
);