diff options
| author | 2009-01-29 22:20:48 +0100 | |
|---|---|---|
| committer | 2009-01-29 22:20:48 +0100 | |
| commit | ff1fa73f33e9223e69cbb71e70b084e3482dce3f (patch) | |
| tree | fdd756e97501a62f1229044e1fe6233447a0fb23 /include/plist/plist.h | |
| parent | 7bb672f801c3a245b38535f5a33f9fffa88c683c (diff) | |
| download | libplist-ff1fa73f33e9223e69cbb71e70b084e3482dce3f.tar.gz libplist-ff1fa73f33e9223e69cbb71e70b084e3482dce3f.tar.bz2 | |
Fix indent.
Diffstat (limited to 'include/plist/plist.h')
| -rw-r--r-- | include/plist/plist.h | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 2c0df11..9f82cb8 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -39,24 +39,27 @@ extern "C" { | |||
| 39 | /** | 39 | /** |
| 40 | * The basic plist abstract data type. | 40 | * The basic plist abstract data type. |
| 41 | */ | 41 | */ |
| 42 | typedef void* plist_t; | 42 | typedef void *plist_t; |
| 43 | 43 | ||
| 44 | /** | 44 | /** |
| 45 | * The enumeration of plist node types. | 45 | * The enumeration of plist node types. |
| 46 | */ | 46 | */ |
| 47 | typedef enum { | 47 | typedef enum { |
| 48 | PLIST_BOOLEAN, /**< Boolean, scalar type */ | 48 | PLIST_BOOLEAN, |
| 49 | PLIST_UINT, /**< Unsigned integer, scalar type */ | 49 | /**< Boolean, scalar type */ |
| 50 | PLIST_REAL, /**< Real, scalar type */ | 50 | PLIST_UINT, /**< Unsigned integer, scalar type */ |
| 51 | PLIST_STRING, /**< ASCII string, scalar type */ | 51 | PLIST_REAL, /**< Real, scalar type */ |
| 52 | PLIST_UNICODE, /**< Unicode strin, scalar type */ | 52 | PLIST_STRING, |
| 53 | PLIST_ARRAY, /**< Ordered array, structured type */ | 53 | /**< ASCII string, scalar type */ |
| 54 | PLIST_DICT, /**< Unordered dictionary (key/value pair), structured type */ | 54 | PLIST_UNICODE, |
| 55 | PLIST_DATE, /**< Date, scalar type */ | 55 | /**< Unicode strin, scalar type */ |
| 56 | PLIST_DATA, /**< Binary data, scalar type */ | 56 | PLIST_ARRAY,/**< Ordered array, structured type */ |
| 57 | PLIST_KEY, /**< Key in dictionaries (ASCII String), scalar type */ | 57 | PLIST_DICT, /**< Unordered dictionary (key/value pair), structured type */ |
| 58 | PLIST_NONE /**< No type */ | 58 | PLIST_DATE, /**< Date, scalar type */ |
| 59 | } plist_type; | 59 | PLIST_DATA, /**< Binary data, scalar type */ |
| 60 | PLIST_KEY, /**< Key in dictionaries (ASCII String), scalar type */ | ||
| 61 | PLIST_NONE /**< No type */ | ||
| 62 | } plist_type; | ||
| 60 | 63 | ||
| 61 | 64 | ||
| 62 | /******************************************** | 65 | /******************************************** |
| @@ -71,7 +74,7 @@ typedef enum { | |||
| 71 | * @return the created plist | 74 | * @return the created plist |
| 72 | * @sa #plist_type | 75 | * @sa #plist_type |
| 73 | */ | 76 | */ |
| 74 | plist_t plist_new_dict(); | 77 | plist_t plist_new_dict(); |
| 75 | 78 | ||
| 76 | /** | 79 | /** |
| 77 | * Create a new root plist_t type #PLIST_ARRAY | 80 | * Create a new root plist_t type #PLIST_ARRAY |
| @@ -79,14 +82,14 @@ plist_t plist_new_dict(); | |||
| 79 | * @return the created plist | 82 | * @return the created plist |
| 80 | * @sa #plist_type | 83 | * @sa #plist_type |
| 81 | */ | 84 | */ |
| 82 | plist_t plist_new_array(); | 85 | plist_t plist_new_array(); |
| 83 | 86 | ||
| 84 | /** | 87 | /** |
| 85 | * Destruct a plist_t node and all its children recursively | 88 | * Destruct a plist_t node and all its children recursively |
| 86 | * | 89 | * |
| 87 | * @param plist the plist to free | 90 | * @param plist the plist to free |
| 88 | */ | 91 | */ |
| 89 | void plist_free(plist_t plist); | 92 | void plist_free(plist_t plist); |
| 90 | 93 | ||
| 91 | /******************************************** | 94 | /******************************************** |
| 92 | * * | 95 | * * |
| @@ -99,7 +102,7 @@ void plist_free(plist_t plist); | |||
| 99 | * | 102 | * |
| 100 | * @param node the first child | 103 | * @param node the first child |
| 101 | */ | 104 | */ |
| 102 | plist_t plist_get_first_child(plist_t node); | 105 | plist_t plist_get_first_child(plist_t node); |
| 103 | 106 | ||
| 104 | 107 | ||
| 105 | /** | 108 | /** |
| @@ -107,7 +110,7 @@ plist_t plist_get_first_child(plist_t node); | |||
| 107 | * | 110 | * |
| 108 | * @param node the next sibling | 111 | * @param node the next sibling |
| 109 | */ | 112 | */ |
| 110 | plist_t plist_get_next_sibling(plist_t node); | 113 | plist_t plist_get_next_sibling(plist_t node); |
| 111 | 114 | ||
| 112 | 115 | ||
| 113 | /** | 116 | /** |
| @@ -115,7 +118,7 @@ plist_t plist_get_next_sibling(plist_t node); | |||
| 115 | * | 118 | * |
| 116 | * @param node the previous sibling | 119 | * @param node the previous sibling |
| 117 | */ | 120 | */ |
| 118 | plist_t plist_get_prev_sibling(plist_t node); | 121 | plist_t plist_get_prev_sibling(plist_t node); |
| 119 | 122 | ||
| 120 | /******************************************** | 123 | /******************************************** |
| 121 | * * | 124 | * * |
| @@ -131,7 +134,7 @@ plist_t plist_get_prev_sibling(plist_t node); | |||
| 131 | * @param node the node to add a children to | 134 | * @param node the node to add a children to |
| 132 | * @param subnode the children node | 135 | * @param subnode the children node |
| 133 | */ | 136 | */ |
| 134 | void plist_add_sub_node(plist_t node, plist_t subnode); | 137 | void plist_add_sub_node(plist_t node, plist_t subnode); |
| 135 | 138 | ||
| 136 | /** | 139 | /** |
| 137 | * Add a subnode of type #PLIST_KEY to a node. The node must be of a structured type | 140 | * Add a subnode of type #PLIST_KEY to a node. The node must be of a structured type |
| @@ -140,7 +143,7 @@ void plist_add_sub_node(plist_t node, plist_t subnode); | |||
| 140 | * @param node the node to add a children to | 143 | * @param node the node to add a children to |
| 141 | * @param val the key value encoded as an ASCII string (must be null terminated) | 144 | * @param val the key value encoded as an ASCII string (must be null terminated) |
| 142 | */ | 145 | */ |
| 143 | void plist_add_sub_key_el(plist_t node, const char* val); | 146 | void plist_add_sub_key_el(plist_t node, const char *val); |
| 144 | 147 | ||
| 145 | /** | 148 | /** |
| 146 | * Add a subnode of type #PLIST_STRING to a node. The node must be of a structured type | 149 | * Add a subnode of type #PLIST_STRING to a node. The node must be of a structured type |
| @@ -149,7 +152,7 @@ void plist_add_sub_key_el(plist_t node, const char* val); | |||
| 149 | * @param node the node to add a children to | 152 | * @param node the node to add a children to |
| 150 | * @param val the string value encoded as an ASCII string (must be null terminated) | 153 | * @param val the string value encoded as an ASCII string (must be null terminated) |
| 151 | */ | 154 | */ |
| 152 | void plist_add_sub_string_el(plist_t node, const char* val); | 155 | void plist_add_sub_string_el(plist_t node, const char *val); |
| 153 | 156 | ||
| 154 | /** | 157 | /** |
| 155 | * Add a subnode of type #PLIST_BOOLEAN to a node. The node must be of a structured type | 158 | * Add a subnode of type #PLIST_BOOLEAN to a node. The node must be of a structured type |
| @@ -158,7 +161,7 @@ void plist_add_sub_string_el(plist_t node, const char* val); | |||
| 158 | * @param node the node to add a children to | 161 | * @param node the node to add a children to |
| 159 | * @param val the boolean value (TRUE or FALSE) | 162 | * @param val the boolean value (TRUE or FALSE) |
| 160 | */ | 163 | */ |
| 161 | void plist_add_sub_bool_el(plist_t node, uint8_t val); | 164 | void plist_add_sub_bool_el(plist_t node, uint8_t val); |
| 162 | 165 | ||
| 163 | /** | 166 | /** |
| 164 | * Add a subnode of type #PLIST_UINT to a node. The node must be of a structured type | 167 | * Add a subnode of type #PLIST_UINT to a node. The node must be of a structured type |
| @@ -167,7 +170,7 @@ void plist_add_sub_bool_el(plist_t node, uint8_t val); | |||
| 167 | * @param node the node to add a children to | 170 | * @param node the node to add a children to |
| 168 | * @param val the unsigned integer value | 171 | * @param val the unsigned integer value |
| 169 | */ | 172 | */ |
| 170 | void plist_add_sub_uint_el(plist_t node, uint64_t val); | 173 | void plist_add_sub_uint_el(plist_t node, uint64_t val); |
| 171 | 174 | ||
| 172 | /** | 175 | /** |
| 173 | * Add a subnode of type #PLIST_REAL to a node. The node must be of a structured type | 176 | * Add a subnode of type #PLIST_REAL to a node. The node must be of a structured type |
| @@ -176,7 +179,7 @@ void plist_add_sub_uint_el(plist_t node, uint64_t val); | |||
| 176 | * @param node the node to add a children to | 179 | * @param node the node to add a children to |
| 177 | * @param val the real value | 180 | * @param val the real value |
| 178 | */ | 181 | */ |
| 179 | void plist_add_sub_real_el(plist_t node, double val); | 182 | void plist_add_sub_real_el(plist_t node, double val); |
| 180 | 183 | ||
| 181 | /** | 184 | /** |
| 182 | * Add a subnode of type #PLIST_DATA to a node. The node must be of a structured type | 185 | * Add a subnode of type #PLIST_DATA to a node. The node must be of a structured type |
| @@ -186,7 +189,7 @@ void plist_add_sub_real_el(plist_t node, double val); | |||
| 186 | * @param val the binary buffer | 189 | * @param val the binary buffer |
| 187 | * @param length the length of the buffer | 190 | * @param length the length of the buffer |
| 188 | */ | 191 | */ |
| 189 | void plist_add_sub_data_el(plist_t node, const char* val, uint64_t length); | 192 | void plist_add_sub_data_el(plist_t node, const char *val, uint64_t length); |
| 190 | 193 | ||
| 191 | /** | 194 | /** |
| 192 | * Add a subnode of type #PLIST_UNICODE to a node. The node must be of a structured type | 195 | * Add a subnode of type #PLIST_UNICODE to a node. The node must be of a structured type |
| @@ -195,7 +198,7 @@ void plist_add_sub_data_el(plist_t node, const char* val, uint64_t length); | |||
| 195 | * @param node the node to add a children to | 198 | * @param node the node to add a children to |
| 196 | * @param val the unicode string encoded in UTF-8 (must be null terminated) | 199 | * @param val the unicode string encoded in UTF-8 (must be null terminated) |
| 197 | */ | 200 | */ |
| 198 | void plist_add_sub_unicode_el(plist_t node, const char* val); | 201 | void plist_add_sub_unicode_el(plist_t node, const char *val); |
| 199 | 202 | ||
| 200 | /** | 203 | /** |
| 201 | * Add a subnode of type #PLIST_DATE to a node. The node must be of a structured type | 204 | * Add a subnode of type #PLIST_DATE to a node. The node must be of a structured type |
| @@ -205,7 +208,7 @@ void plist_add_sub_unicode_el(plist_t node, const char* val); | |||
| 205 | * @param sec the number of seconds since 01/01/2001 | 208 | * @param sec the number of seconds since 01/01/2001 |
| 206 | * @param usec the number of microseconds | 209 | * @param usec the number of microseconds |
| 207 | */ | 210 | */ |
| 208 | void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); | 211 | void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); |
| 209 | 212 | ||
| 210 | 213 | ||
| 211 | /******************************************** | 214 | /******************************************** |
| @@ -220,7 +223,7 @@ void plist_add_sub_date_el(plist_t node, int32_t sec, int32_t usec); | |||
| 220 | * @param node the node | 223 | * @param node the node |
| 221 | * @return the type of the node | 224 | * @return the type of the node |
| 222 | */ | 225 | */ |
| 223 | plist_type plist_get_node_type(plist_t node); | 226 | plist_type plist_get_node_type(plist_t node); |
| 224 | 227 | ||
| 225 | /** | 228 | /** |
| 226 | * Get the value of a #PLIST_KEY node. | 229 | * Get the value of a #PLIST_KEY node. |
| @@ -230,7 +233,7 @@ plist_type plist_get_node_type(plist_t node); | |||
| 230 | * @param val a pointer to a C-string. This function allocates the memory, | 233 | * @param val a pointer to a C-string. This function allocates the memory, |
| 231 | * caller is responsible for freeing it. | 234 | * caller is responsible for freeing it. |
| 232 | */ | 235 | */ |
| 233 | void plist_get_key_val(plist_t node, char** val); | 236 | void plist_get_key_val(plist_t node, char **val); |
| 234 | 237 | ||
| 235 | /** | 238 | /** |
| 236 | * Get the value of a #PLIST_STRING node. | 239 | * Get the value of a #PLIST_STRING node. |
| @@ -240,7 +243,7 @@ void plist_get_key_val(plist_t node, char** val); | |||
| 240 | * @param val a pointer to a C-string. This function allocates the memory, | 243 | * @param val a pointer to a C-string. This function allocates the memory, |
| 241 | * caller is responsible for freeing it. | 244 | * caller is responsible for freeing it. |
| 242 | */ | 245 | */ |
| 243 | void plist_get_string_val(plist_t node, char** val); | 246 | void plist_get_string_val(plist_t node, char **val); |
| 244 | 247 | ||
| 245 | /** | 248 | /** |
| 246 | * Get the value of a #PLIST_BOOLEAN node. | 249 | * Get the value of a #PLIST_BOOLEAN node. |
| @@ -249,7 +252,7 @@ void plist_get_string_val(plist_t node, char** val); | |||
| 249 | * @param node the node | 252 | * @param node the node |
| 250 | * @param val a pointer to a uint8_t variable. | 253 | * @param val a pointer to a uint8_t variable. |
| 251 | */ | 254 | */ |
| 252 | void plist_get_bool_val(plist_t node, uint8_t* val); | 255 | void plist_get_bool_val(plist_t node, uint8_t * val); |
| 253 | 256 | ||
| 254 | /** | 257 | /** |
| 255 | * Get the value of a #PLIST_UINT node. | 258 | * Get the value of a #PLIST_UINT node. |
| @@ -258,7 +261,7 @@ void plist_get_bool_val(plist_t node, uint8_t* val); | |||
| 258 | * @param node the node | 261 | * @param node the node |
| 259 | * @param val a pointer to a uint64_t variable. | 262 | * @param val a pointer to a uint64_t variable. |
| 260 | */ | 263 | */ |
| 261 | void plist_get_uint_val(plist_t node, uint64_t* val); | 264 | void plist_get_uint_val(plist_t node, uint64_t * val); |
| 262 | 265 | ||
| 263 | /** | 266 | /** |
| 264 | * Get the value of a #PLIST_REAL node. | 267 | * Get the value of a #PLIST_REAL node. |
| @@ -267,7 +270,7 @@ void plist_get_uint_val(plist_t node, uint64_t* val); | |||
| 267 | * @param node the node | 270 | * @param node the node |
| 268 | * @param val a pointer to a double variable. | 271 | * @param val a pointer to a double variable. |
| 269 | */ | 272 | */ |
| 270 | void plist_get_real_val(plist_t node, double* val); | 273 | void plist_get_real_val(plist_t node, double *val); |
| 271 | 274 | ||
| 272 | /** | 275 | /** |
| 273 | * Get the value of a #PLIST_DATA node. | 276 | * Get the value of a #PLIST_DATA node. |
| @@ -277,7 +280,7 @@ void plist_get_real_val(plist_t node, double* val); | |||
| 277 | * @param val a pointer to an unallocated char buffer. This function allocates the memory, | 280 | * @param val a pointer to an unallocated char buffer. This function allocates the memory, |
| 278 | * caller is responsible for freeing it. | 281 | * caller is responsible for freeing it. |
| 279 | */ | 282 | */ |
| 280 | void plist_get_data_val(plist_t node, char** val, uint64_t* length); | 283 | void plist_get_data_val(plist_t node, char **val, uint64_t * length); |
| 281 | 284 | ||
| 282 | /** | 285 | /** |
| 283 | * Get the value of a #PLIST_UNICODE node. | 286 | * Get the value of a #PLIST_UNICODE node. |
| @@ -287,7 +290,7 @@ void plist_get_data_val(plist_t node, char** val, uint64_t* length); | |||
| 287 | * @param val a pointer to a C-string. This function allocates the memory, | 290 | * @param val a pointer to a C-string. This function allocates the memory, |
| 288 | * caller is responsible for freeing it. Data is UTF-8 encoded. | 291 | * caller is responsible for freeing it. Data is UTF-8 encoded. |
| 289 | */ | 292 | */ |
| 290 | void plist_get_unicode_val(plist_t node, char** val); | 293 | void plist_get_unicode_val(plist_t node, char **val); |
| 291 | 294 | ||
| 292 | /** | 295 | /** |
| 293 | * Get the value of a #PLIST_DATE node. | 296 | * Get the value of a #PLIST_DATE node. |
| @@ -297,7 +300,7 @@ void plist_get_unicode_val(plist_t node, char** val); | |||
| 297 | * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. | 300 | * @param sec a pointer to an int32_t variable. Represents the number of seconds since 01/01/2001. |
| 298 | * @param usec a pointer to an int32_t variable. Represents the number of microseconds | 301 | * @param usec a pointer to an int32_t variable. Represents the number of microseconds |
| 299 | */ | 302 | */ |
| 300 | void plist_get_date_val(plist_t node, int32_t* sec, int32_t* usec); | 303 | void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec); |
| 301 | 304 | ||
| 302 | 305 | ||
| 303 | 306 | ||
| @@ -315,7 +318,7 @@ void plist_get_date_val(plist_t node, int32_t* sec, int32_t* usec); | |||
| 315 | * caller is responsible for freeing it. Data is UTF-8 encoded. | 318 | * caller is responsible for freeing it. Data is UTF-8 encoded. |
| 316 | * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. | 319 | * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. |
| 317 | */ | 320 | */ |
| 318 | void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); | 321 | void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); |
| 319 | 322 | ||
| 320 | /** | 323 | /** |
| 321 | * Export the #plist_t structure to binary format. | 324 | * Export the #plist_t structure to binary format. |
| @@ -325,7 +328,7 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length); | |||
| 325 | * caller is responsible for freeing it. | 328 | * caller is responsible for freeing it. |
| 326 | * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. | 329 | * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer. |
| 327 | */ | 330 | */ |
| 328 | void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); | 331 | void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); |
| 329 | 332 | ||
| 330 | /** | 333 | /** |
| 331 | * Import the #plist_t structure from XML format. | 334 | * Import the #plist_t structure from XML format. |
| @@ -334,7 +337,7 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length); | |||
| 334 | * @param length length of the buffer to read. | 337 | * @param length length of the buffer to read. |
| 335 | * @param plist a pointer to the imported plist. | 338 | * @param plist a pointer to the imported plist. |
| 336 | */ | 339 | */ |
| 337 | void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); | 340 | void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); |
| 338 | 341 | ||
| 339 | /** | 342 | /** |
| 340 | * Import the #plist_t structure from binary format. | 343 | * Import the #plist_t structure from binary format. |
| @@ -343,7 +346,7 @@ void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist); | |||
| 343 | * @param length length of the buffer to read. | 346 | * @param length length of the buffer to read. |
| 344 | * @param plist a pointer to the imported plist. | 347 | * @param plist a pointer to the imported plist. |
| 345 | */ | 348 | */ |
| 346 | void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); | 349 | void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); |
| 347 | 350 | ||
| 348 | 351 | ||
| 349 | 352 | ||
| @@ -360,7 +363,7 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist); | |||
| 360 | * @param plist the root node of the plist structure. | 363 | * @param plist the root node of the plist structure. |
| 361 | * @param value the ASCII Key to match. | 364 | * @param value the ASCII Key to match. |
| 362 | */ | 365 | */ |
| 363 | plist_t plist_find_node_by_key(plist_t plist, const char *value); | 366 | plist_t plist_find_node_by_key(plist_t plist, const char *value); |
| 364 | 367 | ||
| 365 | /** | 368 | /** |
| 366 | * Find the first encountered #PLIST_STRING node mathing that string. | 369 | * Find the first encountered #PLIST_STRING node mathing that string. |
| @@ -369,7 +372,7 @@ plist_t plist_find_node_by_key(plist_t plist, const char *value); | |||
| 369 | * @param plist the root node of the plist structure. | 372 | * @param plist the root node of the plist structure. |
| 370 | * @param value the ASCII String to match. | 373 | * @param value the ASCII String to match. |
| 371 | */ | 374 | */ |
| 372 | plist_t plist_find_node_by_string(plist_t plist, const char *value); | 375 | plist_t plist_find_node_by_string(plist_t plist, const char *value); |
| 373 | 376 | ||
| 374 | 377 | ||
| 375 | /*@}*/ | 378 | /*@}*/ |
| @@ -378,6 +381,4 @@ plist_t plist_find_node_by_string(plist_t plist, const char *value); | |||
| 378 | #ifdef __cplusplus | 381 | #ifdef __cplusplus |
| 379 | } | 382 | } |
| 380 | #endif | 383 | #endif |
| 381 | |||
| 382 | #endif | 384 | #endif |
| 383 | |||
