- Finished moving to the new proplist handling code in WINGs.
[wmaker-crm.git] / WINGs / WINGs / proplist-compat.h
blob13693740f4f117cf7a79450ff7014afcbc826313
1 /*
2 * This header file is provided for old libPropList compatibility.
3 * DO _NOT_ USE this except for letting your old libPropList-based code to
4 * work with the new property list code from WINGs, with minimal changes.
6 * All code written with old libPropList functions should work, given
7 * that the following changes are made:
9 * 1. Replace all
10 * #include <proplist.h>
11 * with
12 * #include <WINGs/proplist-compat.h>
13 * in your code.
15 * 2. Change all calls to PLSave() to have the extra filename parameter like:
16 * PLSave(proplist_t proplist, char* filename, Bool atomically)
18 * 3. The PLSetStringCmpHook() function is no longer available. There is a
19 * similar but simpler function provided which is enough for practical
20 * purposes:
21 * PLSetCaseSensitive(Bool caseSensitive)
23 * 4. The following functions do no longer exist. They were removed because
24 * they were based on concepts borrowed from UserDefaults which conflict
25 * with the retain/release mechanism:
26 * PLSynchronize(), PLDeepSynchronize(), PLShallowSynchronize()
27 * PLSetFilename(), PLGetFilename()
28 * PLGetContainer()
29 * You should change your code to not use them anymore.
31 * 5. The following functions are no longer available. They were removed
32 * because they also used borrowed concepts which have no place in a
33 * property list as defined in the OpenStep specifications. Also these
34 * functions were hardly ever used in programs to our knowledge.
35 * PLGetDomainNames(), PLGetDomain(), PLSetDomain(), PLDeleteDomain()
36 * PLRegister(), PLUnregister()
37 * You should also change your code to not use them anymore (in case you
38 * ever used them anyway ;-) ).
40 * 6. Link your program with libWINGs or libWUtil instead of libPropList.
41 * (libWINGs should be used for GUI apps, while libWUtil for non-GUI apps)
44 * Our recommandation is to rewrite your code to use the new functions and
45 * link against libWINGs/libWUtil. We do not recommend you to keep using old
46 * libPropList function names. This file is provided just to allow existing
47 * libropList based applications to run with minimal changes with the new
48 * proplist code from WINGs before their authors get the time to rewrite
49 * them. New proplist code from WINGs provide a better integration with the
50 * other data types from WINGs, not to mention that the proplist code in WINGs
51 * is actively maintained while the old libPropList is dead.
56 #ifndef _PROPLIST_COMPAT_H_
57 #define _PROPLIST_COMPAT_H_
59 #include <WINGs/WUtil.h>
62 typedef WMPropList* proplist_t;
64 #define PLSetCaseSensitive(c) WMPLSetCaseSensitive(c)
66 #define PLMakeString(bytes) WMCreatePLString(bytes)
67 #define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
68 #define PLMakeArrayFromElements WMCreatePLArray
69 #define PLMakeDictionaryFromEntries WMCreatePLDictionary
71 #define PLRetain(pl) WMRetainPropList(pl)
72 #define PLRelease(pl) WMReleasePropList(pl)
74 #define PLInsertArrayElement(array, pl, pos) WMInsertInPLArray(array, pos, pl)
75 #define PLAppendArrayElement(array, pl) WMAddToPLArray(array, pl)
76 #define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
77 #define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
78 #define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
79 #define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source)
81 #define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
83 #define PLIsString(pl) WMIsPLString(pl)
84 #define PLIsData(pl) WMIsPLData(pl)
85 #define PLIsArray(pl) WMIsPLArray(pl)
86 #define PLIsDictionary(pl) WMIsPLDictionary(pl)
87 #define PLIsSimple(pl) (WMIsPLString(pl) || WMIsPLData(pl))
88 #define PLIsCompound(pl) (WMIsPLArray(pl) || WMIsPLDictionary(pl))
89 #define PLIsEqual(pl1, pl2) WMIsPropListEqualTo(pl1, pl2)
91 #define PLGetString(pl) WMGetFromPLString(pl)
92 #define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
93 #define PLGetDataLength(pl) WMGetPLDataLength(pl)
94 #define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
95 #define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
96 #define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
98 #define PLShallowCopy(pl) WMShallowCopyPropList(pl)
99 #define PLDeepCopy(pl) WMDeepCopyPropList(pl)
101 #define PLGetProplistWithDescription(desc) WMCreatePropListFromDescription(desc)
102 #define PLGetDescriptionIndent(pl, level) WMGetPropListDescription(pl, True)
103 #define PLGetDescription(pl) WMGetPropListDescription(pl, False)
104 #define PLGetStringDescription(pl) WMGetPropListDescription(pl, False)
105 #define PLGetDataDescription(pl) WMGetPropListDescription(pl, False)
107 #define PLGetProplistWithPath(file) WMReadPropListFromFile(file)
108 #define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
111 #if 0
112 #define PLSetStringCmpHook(fn)
113 #define PLDeepSynchronize(pl) PLDeepSynchronize_is_not_supported
114 #define PLSynchronize(pl) PLSynchronize_is_not_supported
115 #define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
116 #define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
117 #define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
118 #define PLGetContainer(pl)
120 #define PLGetDomainNames()
121 #define PLGetDomain(name)
122 #define PLSetDomain(name, value, kickme)
123 #define PLDeleteDomain(name, kickme)
124 #define PLRegister(name, callback)
125 #define PLUnregister(name)
126 #endif
129 #endif