summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/plist/plist.h87
1 files changed, 47 insertions, 40 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h
index e9266e5..df30ac4 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -27,17 +27,24 @@ extern "C" {
27#endif 27#endif
28 28
29#ifdef _MSC_VER 29#ifdef _MSC_VER
30 typedef __int8 int8_t; 30 typedef __int8 int8_t;
31 typedef __int16 int16_t; 31 typedef __int16 int16_t;
32 typedef __int32 int32_t; 32 typedef __int32 int32_t;
33 typedef __int64 int64_t; 33 typedef __int64 int64_t;
34 34
35 typedef unsigned __int8 uint8_t; 35 typedef unsigned __int8 uint8_t;
36 typedef unsigned __int16 uint16_t; 36 typedef unsigned __int16 uint16_t;
37 typedef unsigned __int32 uint32_t; 37 typedef unsigned __int32 uint32_t;
38 typedef unsigned __int64 uint64_t; 38 typedef unsigned __int64 uint64_t;
39
40 #ifdef plist_EXPORTS
41 #define PLIST_API __declspec( dllexport )
42 #else
43 #define PLIST_API __declspec( dllimport )
44 #endif
39#else 45#else
40#include <stdint.h> 46 #include <stdint.h>
47 #define PLIST_API
41#endif 48#endif
42 49
43#include <sys/types.h> 50#include <sys/types.h>
@@ -87,7 +94,7 @@ extern "C" {
87 * @return the created plist 94 * @return the created plist
88 * @sa #plist_type 95 * @sa #plist_type
89 */ 96 */
90 plist_t plist_new_dict(); 97 PLIST_API plist_t plist_new_dict();
91 98
92/** 99/**
93 * Create a new root plist_t type #PLIST_ARRAY 100 * Create a new root plist_t type #PLIST_ARRAY
@@ -95,14 +102,14 @@ extern "C" {
95 * @return the created plist 102 * @return the created plist
96 * @sa #plist_type 103 * @sa #plist_type
97 */ 104 */
98 plist_t plist_new_array(); 105 PLIST_API plist_t plist_new_array();
99 106
100/** 107/**
101 * Destruct a plist_t node and all its children recursively 108 * Destruct a plist_t node and all its children recursively
102 * 109 *
103 * @param plist the plist to free 110 * @param plist the plist to free
104 */ 111 */
105 void plist_free(plist_t plist); 112 PLIST_API void plist_free(plist_t plist);
106 113
107/******************************************** 114/********************************************
108 * * 115 * *
@@ -115,7 +122,7 @@ extern "C" {
115 * 122 *
116 * @param node the first child 123 * @param node the first child
117 */ 124 */
118 plist_t plist_get_first_child(plist_t node); 125 PLIST_API plist_t plist_get_first_child(plist_t node);
119 126
120 127
121/** 128/**
@@ -123,7 +130,7 @@ extern "C" {
123 * 130 *
124 * @param node the next sibling 131 * @param node the next sibling
125 */ 132 */
126 plist_t plist_get_next_sibling(plist_t node); 133 PLIST_API plist_t plist_get_next_sibling(plist_t node);
127 134
128 135
129/** 136/**
@@ -131,7 +138,7 @@ extern "C" {
131 * 138 *
132 * @param node the previous sibling 139 * @param node the previous sibling
133 */ 140 */
134 plist_t plist_get_prev_sibling(plist_t node); 141 PLIST_API plist_t plist_get_prev_sibling(plist_t node);
135 142
136/******************************************** 143/********************************************
137 * * 144 * *
@@ -147,7 +154,7 @@ extern "C" {
147 * @param node the node to add a children to 154 * @param node the node to add a children to
148 * @param subnode the children node 155 * @param subnode the children node
149 */ 156 */
150 void plist_add_sub_node(plist_t node, plist_t subnode); 157 PLIST_API void plist_add_sub_node(plist_t node, plist_t subnode);
151 158
152/** 159/**
153 * Add a subnode of type #PLIST_KEY to a node. The node must be of a structured type 160 * Add a subnode of type #PLIST_KEY to a node. The node must be of a structured type
@@ -156,7 +163,7 @@ extern "C" {
156 * @param node the node to add a children to 163 * @param node the node to add a children to
157 * @param val the key value encoded as an ASCII string (must be null terminated) 164 * @param val the key value encoded as an ASCII string (must be null terminated)
158 */ 165 */
159 void plist_add_sub_key_el(plist_t node, const char *val); 166 PLIST_API void plist_add_sub_key_el(plist_t node, const char *val);
160 167
161/** 168/**
162 * Add a subnode of type #PLIST_STRING to a node. The node must be of a structured type 169 * Add a subnode of type #PLIST_STRING to a node. The node must be of a structured type
@@ -165,7 +172,7 @@ extern "C" {
165 * @param node the node to add a children to 172 * @param node the node to add a children to
166 * @param val the string value encoded as an ASCII string (must be null terminated) 173 * @param val the string value encoded as an ASCII string (must be null terminated)
167 */ 174 */
168 void plist_add_sub_string_el(plist_t node, const char *val); 175 PLIST_API void plist_add_sub_string_el(plist_t node, const char *val);
169 176
170/** 177/**
171 * Add a subnode of type #PLIST_BOOLEAN to a node. The node must be of a structured type 178 * Add a subnode of type #PLIST_BOOLEAN to a node. The node must be of a structured type
@@ -174,7 +181,7 @@ extern "C" {
174 * @param node the node to add a children to 181 * @param node the node to add a children to
175 * @param val the boolean value (TRUE or FALSE) 182 * @param val the boolean value (TRUE or FALSE)
176 */ 183 */
177 void plist_add_sub_bool_el(plist_t node, uint8_t val); 184 PLIST_API void plist_add_sub_bool_el(plist_t node, uint8_t val);
178 185
179/** 186/**
180 * Add a subnode of type #PLIST_UINT to a node. The node must be of a structured type 187 * Add a subnode of type #PLIST_UINT to a node. The node must be of a structured type
@@ -183,7 +190,7 @@ extern "C" {
183 * @param node the node to add a children to 190 * @param node the node to add a children to
184 * @param val the unsigned integer value 191 * @param val the unsigned integer value
185 */ 192 */
186 void plist_add_sub_uint_el(plist_t node, uint64_t val); 193 PLIST_API void plist_add_sub_uint_el(plist_t node, uint64_t val);
187 194
188/** 195/**
189 * Add a subnode of type #PLIST_REAL to a node. The node must be of a structured type 196 * Add a subnode of type #PLIST_REAL to a node. The node must be of a structured type
@@ -192,7 +199,7 @@ extern "C" {
192 * @param node the node to add a children to 199 * @param node the node to add a children to
193 * @param val the real value 200 * @param val the real value
194 */ 201 */
195 void plist_add_sub_real_el(plist_t node, double val); 202 PLIST_API void plist_add_sub_real_el(plist_t node, double val);
196 203
197/** 204/**
198 * Add a subnode of type #PLIST_DATA to a node. The node must be of a structured type 205 * Add a subnode of type #PLIST_DATA to a node. The node must be of a structured type
@@ -202,7 +209,7 @@ extern "C" {
202 * @param val the binary buffer 209 * @param val the binary buffer
203 * @param length the length of the buffer 210 * @param length the length of the buffer
204 */ 211 */
205 void plist_add_sub_data_el(plist_t node, const char *val, uint64_t length); 212 PLIST_API void plist_add_sub_data_el(plist_t node, const char *val, uint64_t length);
206 213
207/** 214/**
208 * Add a subnode of type #PLIST_UNICODE to a node. The node must be of a structured type 215 * Add a subnode of type #PLIST_UNICODE to a node. The node must be of a structured type
@@ -211,7 +218,7 @@ extern "C" {
211 * @param node the node to add a children to 218 * @param node the node to add a children to
212 * @param val the unicode string encoded in UTF-8 (must be null terminated) 219 * @param val the unicode string encoded in UTF-8 (must be null terminated)
213 */ 220 */
214 void plist_add_sub_unicode_el(plist_t node, const char *val); 221 PLIST_API void plist_add_sub_unicode_el(plist_t node, const char *val);
215 222
216/** 223/**
217 * Add a subnode of type #PLIST_DATE to a node. The node must be of a structured type 224 * Add a subnode of type #PLIST_DATE to a node. The node must be of a structured type
@@ -221,7 +228,7 @@ extern "C" {
221 * @param sec the number of seconds since 01/01/2001 228 * @param sec the number of seconds since 01/01/2001
222 * @param usec the number of microseconds 229 * @param usec the number of microseconds
223 */ 230 */
224 void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); 231 PLIST_API void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec);
225 232
226 233
227/******************************************** 234/********************************************
@@ -236,7 +243,7 @@ extern "C" {
236 * @param node the node 243 * @param node the node
237 * @return the type of the node 244 * @return the type of the node
238 */ 245 */
239 plist_type plist_get_node_type(plist_t node); 246 PLIST_API plist_type plist_get_node_type(plist_t node);
240 247
241/** 248/**
242 * Get the value of a #PLIST_KEY node. 249 * Get the value of a #PLIST_KEY node.
@@ -246,7 +253,7 @@ extern "C" {
246 * @param val a pointer to a C-string. This function allocates the memory, 253 * @param val a pointer to a C-string. This function allocates the memory,
247 * caller is responsible for freeing it. 254 * caller is responsible for freeing it.
248 */ 255 */
249 void plist_get_key_val(plist_t node, char **val); 256 PLIST_API void plist_get_key_val(plist_t node, char **val);
250 257
251/** 258/**
252 * Get the value of a #PLIST_STRING node. 259 * Get the value of a #PLIST_STRING node.
@@ -256,7 +263,7 @@ extern "C" {
256 * @param val a pointer to a C-string. This function allocates the memory, 263 * @param val a pointer to a C-string. This function allocates the memory,
257 * caller is responsible for freeing it. 264 * caller is responsible for freeing it.
258 */ 265 */
259 void plist_get_string_val(plist_t node, char **val); 266 PLIST_API void plist_get_string_val(plist_t node, char **val);
260 267
261/** 268/**
262 * Get the value of a #PLIST_BOOLEAN node. 269 * Get the value of a #PLIST_BOOLEAN node.
@@ -265,7 +272,7 @@ extern "C" {
265 * @param node the node 272 * @param node the node
266 * @param val a pointer to a uint8_t variable. 273 * @param val a pointer to a uint8_t variable.
267 */ 274 */
268 void plist_get_bool_val(plist_t node, uint8_t * val); 275 PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val);
269 276
270/** 277/**
271 * Get the value of a #PLIST_UINT node. 278 * Get the value of a #PLIST_UINT node.
@@ -274,7 +281,7 @@ extern "C" {
274 * @param node the node 281 * @param node the node
275 * @param val a pointer to a uint64_t variable. 282 * @param val a pointer to a uint64_t variable.
276 */ 283 */
277 void plist_get_uint_val(plist_t node, uint64_t * val); 284 PLIST_API void plist_get_uint_val(plist_t node, uint64_t * val);
278 285
279/** 286/**
280 * Get the value of a #PLIST_REAL node. 287 * Get the value of a #PLIST_REAL node.
@@ -283,7 +290,7 @@ extern "C" {
283 * @param node the node 290 * @param node the node
284 * @param val a pointer to a double variable. 291 * @param val a pointer to a double variable.
285 */ 292 */
286 void plist_get_real_val(plist_t node, double *val); 293 PLIST_API void plist_get_real_val(plist_t node, double *val);
287 294
288/** 295/**
289 * Get the value of a #PLIST_DATA node. 296 * Get the value of a #PLIST_DATA node.
@@ -293,7 +300,7 @@ extern "C" {
293 * @param val a pointer to an unallocated char buffer. This function allocates the memory, 300 * @param val a pointer to an unallocated char buffer. This function allocates the memory,
294 * caller is responsible for freeing it. 301 * caller is responsible for freeing it.
295 */ 302 */
296 void plist_get_data_val(plist_t node, char **val, uint64_t * length); 303 PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length);
297 304
298/** 305/**
299 * Get the value of a #PLIST_UNICODE node. 306 * Get the value of a #PLIST_UNICODE node.
@@ -303,7 +310,7 @@ extern "C" {
303 * @param val a pointer to a C-string. This function allocates the memory, 310 * @param val a pointer to a C-string. This function allocates the memory,
304 * caller is responsible for freeing it. Data is UTF-8 encoded. 311 * caller is responsible for freeing it. Data is UTF-8 encoded.
305 */ 312 */
306 void plist_get_unicode_val(plist_t node, char **val); 313 PLIST_API void plist_get_unicode_val(plist_t node, char **val);
307 314
308/** 315/**
309 * Get the value of a #PLIST_DATE node. 316 * Get the value of a #PLIST_DATE node.
@@ -313,7 +320,7 @@ extern "C" {
313 * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. 320 * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001.
314 * @param usec a pointer to an int32_t variable. Represents the number of microseconds 321 * @param usec a pointer to an int32_t variable. Represents the number of microseconds
315 */ 322 */
316 void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); 323 PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec);
317 324
318 325
319 326
@@ -331,7 +338,7 @@ extern "C" {
331 * caller is responsible for freeing it. Data is UTF-8 encoded. 338 * caller is responsible for freeing it. Data is UTF-8 encoded.
332 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 339 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
333 */ 340 */
334 void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); 341 PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length);
335 342
336/** 343/**
337 * Export the #plist_t structure to binary format. 344 * Export the #plist_t structure to binary format.
@@ -341,7 +348,7 @@ extern "C" {
341 * caller is responsible for freeing it. 348 * caller is responsible for freeing it.
342 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. 349 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
343 */ 350 */
344 void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); 351 PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length);
345 352
346/** 353/**
347 * Import the #plist_t structure from XML format. 354 * Import the #plist_t structure from XML format.
@@ -350,7 +357,7 @@ extern "C" {
350 * @param length length of the buffer to read. 357 * @param length length of the buffer to read.
351 * @param plist a pointer to the imported plist. 358 * @param plist a pointer to the imported plist.
352 */ 359 */
353 void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); 360 PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist);
354 361
355/** 362/**
356 * Import the #plist_t structure from binary format. 363 * Import the #plist_t structure from binary format.
@@ -359,7 +366,7 @@ extern "C" {
359 * @param length length of the buffer to read. 366 * @param length length of the buffer to read.
360 * @param plist a pointer to the imported plist. 367 * @param plist a pointer to the imported plist.
361 */ 368 */
362 void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); 369 PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist);
363 370
364 371
365 372
@@ -376,7 +383,7 @@ extern "C" {
376 * @param plist the root node of the plist structure. 383 * @param plist the root node of the plist structure.
377 * @param value the ASCII Key to match. 384 * @param value the ASCII Key to match.
378 */ 385 */
379 plist_t plist_find_node_by_key(plist_t plist, const char *value); 386 PLIST_API plist_t plist_find_node_by_key(plist_t plist, const char *value);
380 387
381/** 388/**
382 * Find the first encountered #PLIST_STRING node mathing that string. 389 * Find the first encountered #PLIST_STRING node mathing that string.
@@ -385,7 +392,7 @@ extern "C" {
385 * @param plist the root node of the plist structure. 392 * @param plist the root node of the plist structure.
386 * @param value the ASCII String to match. 393 * @param value the ASCII String to match.
387 */ 394 */
388 plist_t plist_find_node_by_string(plist_t plist, const char *value); 395 PLIST_API plist_t plist_find_node_by_string(plist_t plist, const char *value);
389 396
390 397
391/*@}*/ 398/*@}*/