libngf: libngf/proplist.h Source File

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
25extern "C" {
26#endif
27
28#include <stdint.h>
29
30 typedef enum _NgfProplistType {
31 NGF_PROPLIST_VALUE_TYPE_STRING = 0,
32 NGF_PROPLIST_VALUE_TYPE_INTEGER,
33 NGF_PROPLIST_VALUE_TYPE_UNSIGNED,
34 NGF_PROPLIST_VALUE_TYPE_BOOLEAN,
35 NGF_PROPLIST_VALUE_TYPE_INVALID
36} 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
52 NgfProplist* ngf_proplist_new (void);
53
59 NgfProplist* ngf_proplist_copy (NgfProplist *orig);
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
154 NgfProplistType ngf_proplist_get_value_type (NgfProplist *proplist, const char *key);
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 */
NgfProplist
struct _NgfProplist NgfProplist
Internal property list instance.
Definition: proplist.h:39
NgfProplistCallback
void(* NgfProplistCallback)(const char *key, const void *value, void *userdata)
Property list callback for iterating over each entry.
Definition: proplist.h:42
ngf_proplist_set_as_integer
int ngf_proplist_set_as_integer(NgfProplist *proplist, const char *key, int32_t value)
Set a integer value to property list.
NgfProplistExtendedCallback
void(* NgfProplistExtendedCallback)(const char *key, const void *value, NgfProplistType type, void *userdata)
Extended iteration callback with type information.
Definition: proplist.h:45
ngf_proplist_foreach
void ngf_proplist_foreach(NgfProplist *proplist, NgfProplistCallback callback, void *userdata)
Iterate over each entry in the property list.
ngf_proplist_parse_unsigned
int ngf_proplist_parse_unsigned(const char *value, uint32_t *unsigned_value)
Parse unsigned integer value.
ngf_proplist_gets
const char * ngf_proplist_gets(NgfProplist *proplist, const char *key)
Get a string value from property list.
ngf_proplist_free_keys
void ngf_proplist_free_keys(const char **keys)
Free a list of property keys.
ngf_proplist_parse_integer
int ngf_proplist_parse_integer(const char *value, int32_t *integer_value)
Parse integer value.
ngf_proplist_copy
NgfProplist * ngf_proplist_copy(NgfProplist *orig)
Create an identical copy of other proplist.
ngf_proplist_get_as_boolean
int ngf_proplist_get_as_boolean(NgfProplist *proplist, const char *key, int *boolean_value)
Get a boolean value from the property list.
_NgfProplistType
_NgfProplistType
Definition: proplist.h:30
NGF_PROPLIST_VALUE_TYPE_INTEGER
@ NGF_PROPLIST_VALUE_TYPE_INTEGER
Definition: proplist.h:32
NGF_PROPLIST_VALUE_TYPE_STRING
@ NGF_PROPLIST_VALUE_TYPE_STRING
Definition: proplist.h:31
NGF_PROPLIST_VALUE_TYPE_BOOLEAN
@ NGF_PROPLIST_VALUE_TYPE_BOOLEAN
Definition: proplist.h:34
NGF_PROPLIST_VALUE_TYPE_INVALID
@ NGF_PROPLIST_VALUE_TYPE_INVALID
Definition: proplist.h:35
NGF_PROPLIST_VALUE_TYPE_UNSIGNED
@ NGF_PROPLIST_VALUE_TYPE_UNSIGNED
Definition: proplist.h:33
ngf_proplist_new
NgfProplist * ngf_proplist_new(void)
Create a new property list instance.
ngf_proplist_get_as_unsigned
int ngf_proplist_get_as_unsigned(NgfProplist *proplist, const char *key, uint32_t *unsigned_value)
Get unsigned integer value from the property list.
ngf_proplist_foreach_extended
void ngf_proplist_foreach_extended(NgfProplist *proplist, NgfProplistExtendedCallback callback, void *userdata)
Iterate over each entry in the property list and supply a value type.
ngf_proplist_set_as_boolean
int ngf_proplist_set_as_boolean(NgfProplist *proplist, const char *key, int value)
Set a boolean value to property list.
ngf_proplist_sets
int ngf_proplist_sets(NgfProplist *proplist, const char *key, const char *value)
Set a string value to property list.
ngf_proplist_set_as_unsigned
int ngf_proplist_set_as_unsigned(NgfProplist *proplist, const char *key, uint32_t value)
Set a unsigned integer value to property list.
ngf_proplist_free
void ngf_proplist_free(NgfProplist *proplist)
Free property list.
ngf_proplist_get_value_type
NgfProplistType ngf_proplist_get_value_type(NgfProplist *proplist, const char *key)
Get value type of the property.
ngf_proplist_get_as_integer
int ngf_proplist_get_as_integer(NgfProplist *proplist, const char *key, int32_t *integer_value)
Get integer value from the property list.
NgfProplistType
enum _NgfProplistType NgfProplistType
ngf_proplist_parse_boolean
int ngf_proplist_parse_boolean(const char *value, int *boolean_value)
Parse boolean value.
ngf_proplist_get_keys
const char ** ngf_proplist_get_keys(NgfProplist *proplist)
Get a list of all keys in the property list.