1 /***************************************************************************
4 * property.c : HalProperty methods
6 * Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
7 * Copyright (C) 2004 Novell, Inc.
9 * Licensed under the Academic Free License version 2.1
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 **************************************************************************/
30 #include <dbus/dbus.h>
32 typedef struct _HalProperty HalProperty
;
34 #define HAL_PROPERTY_TYPE_INVALID DBUS_TYPE_INVALID
35 #define HAL_PROPERTY_TYPE_INT32 DBUS_TYPE_INT32
36 #define HAL_PROPERTY_TYPE_UINT64 DBUS_TYPE_UINT64
37 #define HAL_PROPERTY_TYPE_DOUBLE DBUS_TYPE_DOUBLE
38 #define HAL_PROPERTY_TYPE_BOOLEAN DBUS_TYPE_BOOLEAN
39 #define HAL_PROPERTY_TYPE_STRING DBUS_TYPE_STRING
40 #define HAL_PROPERTY_TYPE_STRLIST ((int) (DBUS_TYPE_STRING<<8)+('l'))
42 enum PropertyAttribute
{
48 void hal_property_free (HalProperty
*prop
);
50 HalProperty
*hal_property_new_string (const char *key
,
52 HalProperty
*hal_property_new_int (const char *key
,
54 HalProperty
*hal_property_new_uint64 (const char *key
,
56 HalProperty
*hal_property_new_bool (const char *key
,
58 HalProperty
*hal_property_new_double (const char *key
,
60 HalProperty
*hal_property_new_strlist (const char *key
);
62 const char *hal_property_get_key (HalProperty
*prop
);
63 int hal_property_get_type (HalProperty
*prop
);
64 char *hal_property_to_string (HalProperty
*prop
);
66 const char *hal_property_get_string (HalProperty
*prop
);
67 dbus_int32_t
hal_property_get_int (HalProperty
*prop
);
68 dbus_uint64_t
hal_property_get_uint64 (HalProperty
*prop
);
69 dbus_bool_t
hal_property_get_bool (HalProperty
*prop
);
70 double hal_property_get_double (HalProperty
*prop
);
71 GSList
*hal_property_get_strlist (HalProperty
*prop
);
73 void hal_property_set_string (HalProperty
*prop
,
75 void hal_property_set_int (HalProperty
*prop
,
77 void hal_property_set_uint64 (HalProperty
*prop
,
79 void hal_property_set_bool (HalProperty
*prop
,
81 void hal_property_set_double (HalProperty
*prop
,
83 gboolean
hal_property_strlist_append (HalProperty
*prop
,
85 gboolean
hal_property_strlist_prepend (HalProperty
*prop
,
87 gboolean
hal_property_strlist_remove_elem (HalProperty
*prop
,
90 gboolean
hal_property_strlist_add (HalProperty
*prop
,
92 gboolean
hal_property_strlist_remove (HalProperty
*prop
,
94 gboolean
hal_property_strlist_clear (HalProperty
*prop
);
97 void hal_property_set_attribute (HalProperty
*prop
,
98 enum PropertyAttribute attr
,
100 gboolean
hal_property_get_attribute (HalProperty
*prop
,
101 enum PropertyAttribute attr
);
103 #endif /* PROPERTY_H */