diff options
Diffstat (limited to 'include/plist')
| -rw-r--r-- | include/plist/plist.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index 9f71777..953ecad 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -164,7 +164,7 @@ extern "C" | |||
| 164 | PLIST_OPT_INDENT = 1 << 3, /**< Indent each line of output. Currently only #PLIST_FORMAT_PRINT and #PLIST_FORMAT_LIMD are supported. Use #PLIST_OPT_INDENT_BY() macro to specify the level of indentation. */ | 164 | PLIST_OPT_INDENT = 1 << 3, /**< Indent each line of output. Currently only #PLIST_FORMAT_PRINT and #PLIST_FORMAT_LIMD are supported. Use #PLIST_OPT_INDENT_BY() macro to specify the level of indentation. */ |
| 165 | } plist_write_options_t; | 165 | } plist_write_options_t; |
| 166 | 166 | ||
| 167 | /** To be used with #PLIST_OPT_INDENT. Encodes the level of indentation for OR'ing it into the #plist_write_options_t bitfield. */ | 167 | /** To be used with #PLIST_OPT_INDENT - encodes the level of indentation for OR'ing it into the #plist_write_options_t bitfield. */ |
| 168 | #define PLIST_OPT_INDENT_BY(x) ((x & 0xFF) << 24) | 168 | #define PLIST_OPT_INDENT_BY(x) ((x & 0xFF) << 24) |
| 169 | 169 | ||
| 170 | 170 | ||
| @@ -834,7 +834,7 @@ extern "C" | |||
| 834 | * This function will look at the first bytes of the file data | 834 | * This function will look at the first bytes of the file data |
| 835 | * to determine if it contains a binary, JSON, OpenStep, or XML plist | 835 | * to determine if it contains a binary, JSON, OpenStep, or XML plist |
| 836 | * and tries to parse the data in the appropriate format. | 836 | * and tries to parse the data in the appropriate format. |
| 837 | * Uses #plist_read_from_data() internally. | 837 | * Uses plist_from_memory() internally. |
| 838 | * | 838 | * |
| 839 | * @param filename The name of the file to parse. | 839 | * @param filename The name of the file to parse. |
| 840 | * @param plist A pointer to the imported plist. | 840 | * @param plist A pointer to the imported plist. |
| @@ -944,18 +944,29 @@ extern "C" | |||
| 944 | */ | 944 | */ |
| 945 | char plist_compare_node_value(plist_t node_l, plist_t node_r); | 945 | char plist_compare_node_value(plist_t node_l, plist_t node_r); |
| 946 | 946 | ||
| 947 | /** Helper macro used by PLIST_IS_* macros that will evaluate the type of a plist node. */ | ||
| 947 | #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) | 948 | #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) |
| 948 | 949 | ||
| 949 | /* Helper macros for the different plist types */ | 950 | /* Helper macros for the different plist types */ |
| 951 | /** Evaluates to true if the given plist node is of type PLIST_BOOLEAN */ | ||
| 950 | #define PLIST_IS_BOOLEAN(__plist) _PLIST_IS_TYPE(__plist, BOOLEAN) | 952 | #define PLIST_IS_BOOLEAN(__plist) _PLIST_IS_TYPE(__plist, BOOLEAN) |
| 953 | /** Evaluates to true if the given plist node is of type PLIST_INT */ | ||
| 951 | #define PLIST_IS_INT(__plist) _PLIST_IS_TYPE(__plist, INT) | 954 | #define PLIST_IS_INT(__plist) _PLIST_IS_TYPE(__plist, INT) |
| 955 | /** Evaluates to true if the given plist node is of type PLIST_REAL */ | ||
| 952 | #define PLIST_IS_REAL(__plist) _PLIST_IS_TYPE(__plist, REAL) | 956 | #define PLIST_IS_REAL(__plist) _PLIST_IS_TYPE(__plist, REAL) |
| 957 | /** Evaluates to true if the given plist node is of type PLIST_STRING */ | ||
| 953 | #define PLIST_IS_STRING(__plist) _PLIST_IS_TYPE(__plist, STRING) | 958 | #define PLIST_IS_STRING(__plist) _PLIST_IS_TYPE(__plist, STRING) |
| 959 | /** Evaluates to true if the given plist node is of type PLIST_ARRAY */ | ||
| 954 | #define PLIST_IS_ARRAY(__plist) _PLIST_IS_TYPE(__plist, ARRAY) | 960 | #define PLIST_IS_ARRAY(__plist) _PLIST_IS_TYPE(__plist, ARRAY) |
| 961 | /** Evaluates to true if the given plist node is of type PLIST_DICT */ | ||
| 955 | #define PLIST_IS_DICT(__plist) _PLIST_IS_TYPE(__plist, DICT) | 962 | #define PLIST_IS_DICT(__plist) _PLIST_IS_TYPE(__plist, DICT) |
| 963 | /** Evaluates to true if the given plist node is of type PLIST_DATE */ | ||
| 956 | #define PLIST_IS_DATE(__plist) _PLIST_IS_TYPE(__plist, DATE) | 964 | #define PLIST_IS_DATE(__plist) _PLIST_IS_TYPE(__plist, DATE) |
| 965 | /** Evaluates to true if the given plist node is of type PLIST_DATA */ | ||
| 957 | #define PLIST_IS_DATA(__plist) _PLIST_IS_TYPE(__plist, DATA) | 966 | #define PLIST_IS_DATA(__plist) _PLIST_IS_TYPE(__plist, DATA) |
| 967 | /** Evaluates to true if the given plist node is of type PLIST_KEY */ | ||
| 958 | #define PLIST_IS_KEY(__plist) _PLIST_IS_TYPE(__plist, KEY) | 968 | #define PLIST_IS_KEY(__plist) _PLIST_IS_TYPE(__plist, KEY) |
| 969 | /** Evaluates to true if the given plist node is of type PLIST_UID */ | ||
| 959 | #define PLIST_IS_UID(__plist) _PLIST_IS_TYPE(__plist, UID) | 970 | #define PLIST_IS_UID(__plist) _PLIST_IS_TYPE(__plist, UID) |
| 960 | /* for backwards compatibility */ | 971 | /* for backwards compatibility */ |
| 961 | #define PLIST_IS_UINT PLIST_IS_INT | 972 | #define PLIST_IS_UINT PLIST_IS_INT |
