1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22 /* FIXME : unnamed attributed not implemented *"
24 #include <glib-object.h>
25 #include <lttv/iattribute.h>
28 #define LTTV_ATTRIBUTE_TYPE (lttv_attribute_get_type ())
29 #define LTTV_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_ATTRIBUTE_TYPE, LttvAttribute))
30 #define LTTV_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
31 #define LTTV_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_ATTRIBUTE_TYPE))
32 #define LTTV_IS_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_ATTRIBUTE_TYPE))
33 #define LTTV_ATTRIBUTE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
36 typedef struct _LttvAttribute LttvAttribute;
37 typedef struct _LttvAttributeClass LttvAttributeClass;
39 struct _LttvAttribute {
47 struct _LttvAttributeClass
{
52 GType
lttv_attribute_get_type (void);
55 /* The functions exported in the IAttribute interface are also available
59 /* Total number of attributes */
61 unsigned int lttv_attribute_get_number(LttvAttribute
*self
);
64 /* Container type. Named (fields in struct or elements in a hash table)
65 or unnamed (elements in an array) attributes, homogeneous type or not. */
67 gboolean
lttv_attribute_named(LttvAttribute
*self
, gboolean
*homogeneous
);
70 /* Get the i th attribute along with its type and a pointer to its value. */
72 LttvAttributeType
lttv_attribute_get(LttvAttribute
*self
, unsigned i
,
73 LttvAttributeName
*name
, LttvAttributeValue
*v
);
76 /* Get the named attribute in the table along with its type and a pointer to
77 its value. If the named attribute does not exist, the type is LTTV_NONE. */
79 LttvAttributeType
lttv_attribute_get_by_name(LttvAttribute
*self
,
80 LttvAttributeName name
, LttvAttributeValue
*v
);
83 /* Add an attribute, which must not exist. The name is an empty string for
84 containers with unnamed attributes. */
86 LttvAttributeValue
lttv_attribute_add(LttvAttribute
*self
,
87 LttvAttributeName name
, LttvAttributeType t
);
90 /* Remove an attribute */
92 void lttv_attribute_remove(LttvAttribute
*self
, unsigned i
);
94 void lttv_attribute_remove_by_name(LttvAttribute
*self
,
95 LttvAttributeName name
);
98 /* Create an empty iattribute object and add it as an attribute under the
99 specified name, or return an existing iattribute attribute. If an
100 attribute of that name already exists but is not a GObject supporting the
101 iattribute interface, return NULL. */
103 LttvAttribute
* lttv_attribute_find_subdir(LttvAttribute
*self
,
104 LttvAttributeName name
);
106 gboolean
lttv_attribute_find(LttvAttribute
*self
, LttvAttributeName name
,
107 LttvAttributeType t
, LttvAttributeValue
*v
);
110 /* Free recursively a tree of attributes. All contained gobject of type
111 LttvAttribute are freed (unreferenced) recursively. */
113 void lttv_attribute_recursive_free(LttvAttribute
*self
);
115 /* Add items from a tree of attributes to another tree. */
117 void lttv_attribute_recursive_add(LttvAttribute
*dest
, LttvAttribute
*src
);
120 lttv_attribute_write_xml(LttvAttribute
*self
, FILE *fp
, int pos
, int indent
);
122 void lttv_attribute_read_xml(LttvAttribute
*self
, FILE *fp
);
124 #endif // ATTRIBUTE_H
This page took 0.030996 seconds and 4 git commands to generate.