updated NEWS and ChangeLogs about new proplist code in WINGs before a new release
[wmaker-crm.git] / WINGs / WINGs / proplist-compat.h
blob3d15bf5856145d3937baae362955c75407a489c3
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;
65 #ifndef YES
66 #define YES True
67 #endif
69 #ifndef NO
70 #define NO False
71 #endif
74 #define PLSetCaseSensitive(c) WMPLSetCaseSensitive(c)
76 #define PLMakeString(bytes) WMCreatePLString(bytes)
77 #define PLMakeData(bytes, length) WMCreatePLDataFromBytes(bytes, length)
78 #define PLMakeArrayFromElements WMCreatePLArray
79 #define PLMakeDictionaryFromEntries WMCreatePLDictionary
81 #define PLRetain(pl) WMRetainPropList(pl)
82 #define PLRelease(pl) WMReleasePropList(pl)
84 #define PLInsertArrayElement(array, pl, pos) WMInsertInPLArray(array, pos, pl)
85 #define PLAppendArrayElement(array, pl) WMAddToPLArray(array, pl)
86 #define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
87 #define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
88 #define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
89 #define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source)
91 #define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
93 #define PLIsString(pl) WMIsPLString(pl)
94 #define PLIsData(pl) WMIsPLData(pl)
95 #define PLIsArray(pl) WMIsPLArray(pl)
96 #define PLIsDictionary(pl) WMIsPLDictionary(pl)
97 #define PLIsSimple(pl) (WMIsPLString(pl) || WMIsPLData(pl))
98 #define PLIsCompound(pl) (WMIsPLArray(pl) || WMIsPLDictionary(pl))
99 #define PLIsEqual(pl1, pl2) WMIsPropListEqualTo(pl1, pl2)
101 #define PLGetString(pl) WMGetFromPLString(pl)
102 #define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
103 #define PLGetDataLength(pl) WMGetPLDataLength(pl)
104 #define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
105 #define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
106 #define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
108 #define PLShallowCopy(pl) WMShallowCopyPropList(pl)
109 #define PLDeepCopy(pl) WMDeepCopyPropList(pl)
111 #define PLGetProplistWithDescription(desc) WMCreatePropListFromDescription(desc)
112 #define PLGetDescriptionIndent(pl, level) WMGetPropListDescription(pl, True)
113 #define PLGetDescription(pl) WMGetPropListDescription(pl, False)
114 #define PLGetStringDescription(pl) WMGetPropListDescription(pl, False)
115 #define PLGetDataDescription(pl) WMGetPropListDescription(pl, False)
117 #define PLGetProplistWithPath(file) WMReadPropListFromFile(file)
118 #define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
121 /* Unsupported functions. Do not ask for them. They're evil :P */
122 #define PLSetStringCmpHook(fn) error_PLSetStringCmpHook_is_not_supported
123 #define PLDeepSynchronize(pl) error_PLDeepSynchronize_is_not_supported
124 #define PLSynchronize(pl) error_PLSynchronize_is_not_supported
125 #define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
126 #define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
127 #define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
128 #define PLGetContainer(pl) error_PLGetContainer_is_not_supported
130 #define PLGetDomainNames error_PLGetDomainNames_is_not_supported
131 #define PLGetDomain(name) error_PLGetDomain_is_not_supported
132 #define PLSetDomain(name, value, kickme) error_PLSetDomain_is_not_supported
133 #define PLDeleteDomain(name, kickme) error_PLDeleteDomain_is_not_supported
134 #define PLRegister(name, callback) error_PLRegister_is_not_supported
135 #define PLUnregister(name) error_PLUnregister_is_not_supported
138 #endif