diff options
| author | 2016-11-10 02:14:59 +0100 | |
|---|---|---|
| committer | 2016-11-10 02:14:59 +0100 | |
| commit | ad1a95e96218e411b4dbde38c002fc5f4b530a65 (patch) | |
| tree | 9172c150414993c8790ce1d68d0c4369f27198a3 /include/plist | |
| parent | 35f13502ddd7c5682671b315f0865fa4ba6b646d (diff) | |
| download | libplist-ad1a95e96218e411b4dbde38c002fc5f4b530a65.tar.gz libplist-ad1a95e96218e411b4dbde38c002fc5f4b530a65.tar.bz2 | |
Add new PLIST_IS_* helper macros for the different plist node types
Instead of e.g.:
if (plist_get_node_type(plist) == PLIST_STRING)
you can now write:
if (PLIST_IS_STRING(plist))
Diffstat (limited to 'include/plist')
| -rw-r--r-- | include/plist/plist.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h index ace86f8..e817b4b 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h | |||
| @@ -664,6 +664,20 @@ extern "C" | |||
| 664 | */ | 664 | */ |
| 665 | char plist_compare_node_value(plist_t node_l, plist_t node_r); | 665 | char plist_compare_node_value(plist_t node_l, plist_t node_r); |
| 666 | 666 | ||
| 667 | #define _PLIST_IS_TYPE(__plist, __plist_type) (__plist && (plist_get_node_type(__plist) == PLIST_##__plist_type)) | ||
| 668 | |||
| 669 | /* Helper macros for the different plist types */ | ||
| 670 | #define PLIST_IS_BOOLEAN(__plist) _PLIST_IS_TYPE(__plist, BOOLEAN) | ||
| 671 | #define PLIST_IS_UINT(__plist) _PLIST_IS_TYPE(__plist, UINT) | ||
| 672 | #define PLIST_IS_REAL(__plist) _PLIST_IS_TYPE(__plist, REAL) | ||
| 673 | #define PLIST_IS_STRING(__plist) _PLIST_IS_TYPE(__plist, STRING) | ||
| 674 | #define PLIST_IS_ARRAY(__plist) _PLIST_IS_TYPE(__plist, ARRAY) | ||
| 675 | #define PLIST_IS_DICT(__plist) _PLIST_IS_TYPE(__plist, DICT) | ||
| 676 | #define PLIST_IS_DATE(__plist) _PLIST_IS_TYPE(__plist, DATE) | ||
| 677 | #define PLIST_IS_DATA(__plist) _PLIST_IS_TYPE(__plist, DATA) | ||
| 678 | #define PLIST_IS_KEY(__plist) _PLIST_IS_TYPE(__plist, KEY) | ||
| 679 | #define PLIST_IS_UID(__plist) _PLIST_IS_TYPE(__plist, UID) | ||
| 680 | |||
| 667 | /*@}*/ | 681 | /*@}*/ |
| 668 | 682 | ||
| 669 | #ifdef __cplusplus | 683 | #ifdef __cplusplus |
