| 1 | /* $Id: ppath.h,v 1.1 2011/08/25 16:15:29 dyoung Exp $ */ |
| 2 | |
| 3 | /* Copyright (c) 2010 David Young. All rights reserved. */ |
| 4 | |
| 5 | #ifndef _PPATH_H |
| 6 | #define _PPATH_H |
| 7 | |
| 8 | #include <prop/proplib.h> |
| 9 | |
| 10 | #define PPATH_MAX_COMPONENTS 16 |
| 11 | |
| 12 | struct _ppath; |
| 13 | struct _ppath_component; |
| 14 | typedef struct _ppath ppath_t; |
| 15 | typedef struct _ppath_component ppath_component_t; |
| 16 | |
| 17 | ppath_component_t *ppath_idx(unsigned int); |
| 18 | ppath_component_t *ppath_key(const char *); |
| 19 | |
| 20 | ppath_component_t *ppath_component_retain(ppath_component_t *); |
| 21 | void ppath_component_release(ppath_component_t *); |
| 22 | |
| 23 | ppath_t *ppath_create(void); |
| 24 | unsigned int ppath_length(const ppath_t *); |
| 25 | int ppath_component_idx(const ppath_component_t *); |
| 26 | const char *ppath_component_key(const ppath_component_t *); |
| 27 | ppath_t *ppath_pop(ppath_t *, ppath_component_t **); |
| 28 | ppath_t *ppath_push(ppath_t *, ppath_component_t *); |
| 29 | ppath_component_t *ppath_component_at(const ppath_t *, unsigned int); |
| 30 | ppath_t *ppath_subpath(const ppath_t *, unsigned int, unsigned int); |
| 31 | ppath_t *ppath_push_idx(ppath_t *, unsigned int); |
| 32 | ppath_t *ppath_push_key(ppath_t *, const char *); |
| 33 | ppath_t *ppath_replace_idx(ppath_t *, unsigned int); |
| 34 | ppath_t *ppath_replace_key(ppath_t *, const char *); |
| 35 | |
| 36 | ppath_t *ppath_copy(const ppath_t *); |
| 37 | ppath_t *ppath_retain(ppath_t *); |
| 38 | void ppath_release(ppath_t *); |
| 39 | |
| 40 | prop_object_t ppath_lookup(prop_object_t, const ppath_t *); |
| 41 | |
| 42 | int ppath_copydel_object(prop_object_t, prop_object_t *, const ppath_t *); |
| 43 | int ppath_copyset_object(prop_object_t, prop_object_t *, const ppath_t *, |
| 44 | prop_object_t); |
| 45 | int ppath_create_object(prop_object_t, const ppath_t *, prop_object_t); |
| 46 | int ppath_set_object(prop_object_t, const ppath_t *, prop_object_t); |
| 47 | int ppath_get_object(prop_object_t, const ppath_t *, prop_object_t *); |
| 48 | int ppath_delete_object(prop_object_t, const ppath_t *); |
| 49 | |
| 50 | int ppath_copydel_bool(prop_object_t, prop_object_t *, const ppath_t *); |
| 51 | int ppath_copyset_bool(prop_object_t, prop_object_t *, const ppath_t *, bool); |
| 52 | int ppath_create_bool(prop_object_t, const ppath_t *, bool); |
| 53 | int ppath_create_int64(prop_object_t, const ppath_t *, int64_t); |
| 54 | int ppath_create_uint64(prop_object_t, const ppath_t *, uint64_t); |
| 55 | int ppath_create_data(prop_object_t, const ppath_t *, const void *, size_t); |
| 56 | int ppath_create_string(prop_object_t, const ppath_t *, const char *); |
| 57 | int ppath_set_bool(prop_object_t, const ppath_t *, bool); |
| 58 | int ppath_get_bool(prop_object_t, const ppath_t *, bool *); |
| 59 | int ppath_delete_bool(prop_object_t, const ppath_t *); |
| 60 | |
| 61 | int ppath_copydel_data(prop_object_t, prop_object_t *, const ppath_t *); |
| 62 | int ppath_copyset_data(prop_object_t, prop_object_t *, const ppath_t *, |
| 63 | const void *, size_t); |
| 64 | int ppath_set_data(prop_object_t, const ppath_t *, const void *, size_t); |
| 65 | int ppath_get_data(prop_object_t, const ppath_t *, const void **, size_t *); |
| 66 | int ppath_dup_data(prop_object_t, const ppath_t *, void **, size_t *); |
| 67 | int ppath_delete_data(prop_object_t, const ppath_t *); |
| 68 | |
| 69 | int ppath_copydel_int64(prop_object_t, prop_object_t *, const ppath_t *); |
| 70 | int ppath_copyset_int64(prop_object_t, prop_object_t *, const ppath_t *, |
| 71 | int64_t); |
| 72 | int ppath_set_int64(prop_object_t, const ppath_t *, int64_t); |
| 73 | int ppath_get_int64(prop_object_t, const ppath_t *, int64_t *); |
| 74 | int ppath_delete_int64(prop_object_t, const ppath_t *); |
| 75 | |
| 76 | int ppath_copydel_string(prop_object_t, prop_object_t *, const ppath_t *); |
| 77 | int ppath_copyset_string(prop_object_t, prop_object_t *, const ppath_t *, |
| 78 | const char *); |
| 79 | int ppath_set_string(prop_object_t, const ppath_t *, const char *); |
| 80 | int ppath_get_string(prop_object_t, const ppath_t *, const char **); |
| 81 | int ppath_dup_string(prop_object_t, const ppath_t *, char **); |
| 82 | int ppath_delete_string(prop_object_t, const ppath_t *); |
| 83 | |
| 84 | int ppath_copydel_uint64(prop_object_t, prop_object_t *, const ppath_t *); |
| 85 | int ppath_copyset_uint64(prop_object_t, prop_object_t *, const ppath_t *, |
| 86 | uint64_t); |
| 87 | int ppath_set_uint64(prop_object_t, const ppath_t *, uint64_t); |
| 88 | int ppath_get_uint64(prop_object_t, const ppath_t *, uint64_t *); |
| 89 | int ppath_delete_uint64(prop_object_t, const ppath_t *); |
| 90 | |
| 91 | #endif /* _PPATH_H */ |
| 92 | |