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