git-svn-id: http://ltt.polymtl.ca/svn@289 04897980-b3bd-0310-b5e0-8ef037075253
[lttv.git] / ltt / branches / poly / include / lttv / attribute.h
CommitLineData
c5d77517 1#ifndef ATTRIBUTE_H
2#define ATTRIBUTE_H
3
dc877563 4#include <glib-object.h>
5#include <lttv/iattribute.h>
c5d77517 6
dc877563 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))
c5d77517 13
c5d77517 14
dc877563 15typedef struct _LttvAttribute LttvAttribute;
16typedef struct _LttvAttributeClass LttvAttributeClass;
c5d77517 17
dc877563 18struct _LttvAttribute {
19 GObject parent;
c5d77517 20
dc877563 21 /* private members */
22 GHashTable *names;
23 GArray *attributes;
24};
c5d77517 25
dc877563 26struct _LttvAttributeClass {
27 GObjectClass parent;
28};
c5d77517 29
dc877563 30GType lttv_attribute_get_type (void);
c5d77517 31
c5d77517 32
dc877563 33/* The functions exported in the IAttribute interface are also available
34 directly. */
c5d77517 35
c5d77517 36
dc877563 37/* Total number of attributes */
c5d77517 38
dc877563 39unsigned int lttv_attribute_get_number(LttvAttribute *self);
c5d77517 40
c5d77517 41
dc877563 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. */
c5d77517 44
dc877563 45gboolean lttv_attribute_named(LttvAttribute *self, gboolean *homogeneous);
c5d77517 46
47
dc877563 48/* Get the i th attribute along with its type and a pointer to its value. */
c5d77517 49
dc877563 50LttvAttributeType lttv_attribute_get(LttvAttribute *self, unsigned i,
51 LttvAttributeName *name, LttvAttributeValue *v);
52
c5d77517 53
dc877563 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. */
c5d77517 56
dc877563 57LttvAttributeType lttv_attribute_get_by_name(LttvAttribute *self,
58 LttvAttributeName name, LttvAttributeValue *v);
c5d77517 59
60
dc877563 61/* Add an attribute, which must not exist. The name is an empty string for
62 containers with unnamed attributes. */
c5d77517 63
dc877563 64LttvAttributeValue lttv_attribute_add(LttvAttribute *self,
65 LttvAttributeName name, LttvAttributeType t);
c5d77517 66
c5d77517 67
dc877563 68/* Remove an attribute */
c5d77517 69
dc877563 70void lttv_attribute_remove(LttvAttribute *self, unsigned i);
c5d77517 71
dc877563 72void lttv_attribute_remove_by_name(LttvAttribute *self,
73 LttvAttributeName name);
c5d77517 74
c5d77517 75
dc877563 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. */
1b82f325 80
dc877563 81LttvIAttribute* lttv_attribute_create_subdir(LttvAttribute *self,
82 LttvAttributeName name);
1b82f325 83
dc877563 84gboolean lttv_attribute_find(LttvAttribute *self, LttvAttributeName name,
85 LttvAttributeType t, LttvAttributeValue *v);
1b82f325 86
1b82f325 87
c5d77517 88#endif // ATTRIBUTE_H
This page took 0.027432 seconds and 4 git commands to generate.