libngf
proplist.h
Go to the documentation of this file.
1 /*
2  * libngf - Non-graphical feedback library
3  *
4  * Copyright (C) 2010 Nokia Corporation. All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef NGF_PROPLIST_H
22 #define NGF_PROPLIST_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include <stdint.h>
29 
30 typedef enum _NgfProplistType {
37 
39 typedef struct _NgfProplist NgfProplist;
40 
42 typedef void (*NgfProplistCallback) (const char *key, const void *value, void *userdata);
43 
45 typedef void (*NgfProplistExtendedCallback) (const char *key, const void *value, NgfProplistType type, void *userdata);
46 
53 
60 
66 void ngf_proplist_free (NgfProplist *proplist);
67 
76 int ngf_proplist_sets (NgfProplist *proplist, const char *key, const char *value);
77 
85 const char* ngf_proplist_gets (NgfProplist *proplist, const char *key);
86 
95 int ngf_proplist_set_as_integer (NgfProplist *proplist, const char *key, int32_t value);
96 
105 int ngf_proplist_get_as_integer (NgfProplist *proplist, const char *key, int32_t *integer_value);
106 
115 int ngf_proplist_set_as_unsigned (NgfProplist *proplist, const char *key, uint32_t value);
116 
125 int ngf_proplist_get_as_unsigned (NgfProplist *proplist, const char *key, uint32_t *unsigned_value);
126 
135 int ngf_proplist_set_as_boolean (NgfProplist *proplist, const char *key, int value);
136 
145 int ngf_proplist_get_as_boolean (NgfProplist *proplist, const char *key, int *boolean_value);
146 
155 
163 int ngf_proplist_parse_integer (const char *value, int32_t *integer_value);
164 
172 int ngf_proplist_parse_unsigned (const char *value, uint32_t *unsigned_value);
173 
181 int ngf_proplist_parse_boolean (const char *value, int *boolean_value);
182 
190 void ngf_proplist_foreach (NgfProplist *proplist, NgfProplistCallback callback, void *userdata);
191 
199 void ngf_proplist_foreach_extended (NgfProplist *proplist, NgfProplistExtendedCallback callback, void *userdata);
200 
216 const char** ngf_proplist_get_keys (NgfProplist *proplist);
217 
223 void ngf_proplist_free_keys (const char **keys);
224 
225 #ifdef __cplusplus
226 }
227 #endif
228 
229 #endif /* NGF_PROPLIST_H */
struct _NgfProplist NgfProplist
Internal property list instance.
Definition: proplist.h:39
void(* NgfProplistCallback)(const char *key, const void *value, void *userdata)
Property list callback for iterating over each entry.
Definition: proplist.h:42
int ngf_proplist_set_as_integer(NgfProplist *proplist, const char *key, int32_t value)
Set a integer value to property list.
NgfProplist * ngf_proplist_copy(NgfProplist *orig)
Create an identical copy of other proplist.
void(* NgfProplistExtendedCallback)(const char *key, const void *value, NgfProplistType type, void *userdata)
Extended iteration callback with type information.
Definition: proplist.h:45
void ngf_proplist_foreach(NgfProplist *proplist, NgfProplistCallback callback, void *userdata)
Iterate over each entry in the property list.
int ngf_proplist_parse_unsigned(const char *value, uint32_t *unsigned_value)
Parse unsigned integer value.
void ngf_proplist_free_keys(const char **keys)
Free a list of property keys.
const char ** ngf_proplist_get_keys(NgfProplist *proplist)
Get a list of all keys in the property list.
NgfProplist * ngf_proplist_new(void)
Create a new property list instance.
int ngf_proplist_parse_integer(const char *value, int32_t *integer_value)
Parse integer value.
int ngf_proplist_get_as_boolean(NgfProplist *proplist, const char *key, int *boolean_value)
Get a boolean value from the property list.
_NgfProplistType
Definition: proplist.h:30
@ NGF_PROPLIST_VALUE_TYPE_INTEGER
Definition: proplist.h:32
@ NGF_PROPLIST_VALUE_TYPE_STRING
Definition: proplist.h:31
@ NGF_PROPLIST_VALUE_TYPE_BOOLEAN
Definition: proplist.h:34
@ NGF_PROPLIST_VALUE_TYPE_INVALID
Definition: proplist.h:35
@ NGF_PROPLIST_VALUE_TYPE_UNSIGNED
Definition: proplist.h:33
int ngf_proplist_get_as_unsigned(NgfProplist *proplist, const char *key, uint32_t *unsigned_value)
Get unsigned integer value from the property list.
void ngf_proplist_foreach_extended(NgfProplist *proplist, NgfProplistExtendedCallback callback, void *userdata)
Iterate over each entry in the property list and supply a value type.
int ngf_proplist_set_as_boolean(NgfProplist *proplist, const char *key, int value)
Set a boolean value to property list.
int ngf_proplist_sets(NgfProplist *proplist, const char *key, const char *value)
Set a string value to property list.
int ngf_proplist_set_as_unsigned(NgfProplist *proplist, const char *key, uint32_t value)
Set a unsigned integer value to property list.
const char * ngf_proplist_gets(NgfProplist *proplist, const char *key)
Get a string value from property list.
void ngf_proplist_free(NgfProplist *proplist)
Free property list.
NgfProplistType ngf_proplist_get_value_type(NgfProplist *proplist, const char *key)
Get value type of the property.
int ngf_proplist_get_as_integer(NgfProplist *proplist, const char *key, int32_t *integer_value)
Get integer value from the property list.
enum _NgfProplistType NgfProplistType
int ngf_proplist_parse_boolean(const char *value, int *boolean_value)
Parse boolean value.