00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00057
00058
00059
00060 #ifndef __MXM_PERLSTYLEHASH_H__
00061 #define __MXM_PERLSTYLEHASH_H__
00062
00063
00064
00065 #include <mxm/core/mxmList.h>
00066 #include <mxm/core/mxmTypeDecider.h>
00067 #include <mxm/core/mxmString.h>
00068
00069
00070
00071 class mxmStringList;
00072
00073
00074
00077
00120 class MXM_CORE_API mxmPerlStyleHash : public mxmList {
00121
00122 public:
00124 class MXM_CORE_API Iterator : public mxmList::Iterator {
00125 public:
00126 Iterator(const mxmPerlStyleHash *hash);
00127 Iterator();
00128 public:
00130 mxmObject *nextItem(void);
00131 };
00133 class MXM_CORE_API KeyValuePair : public mxmObject {
00134 private:
00135 mxmString *Key;
00136 mxmString *Value;
00137 public:
00138 KeyValuePair(mxmString *key, mxmString *value);
00139 ~KeyValuePair();
00140 public:
00141 mxmString *key(void);
00142 mxmString *value(void);
00143 };
00145 class KeyValuePairDecider : public mxmTypeDecider {
00146 public:
00147 bool isOfProperType(const mxmObject *object);
00148 };
00149
00150 private:
00151 bool CaseInsensitiveKeys;
00152 void *StableABIDataExtension;
00153
00154 public:
00156 static mxmPerlStyleHash emptyHash(void);
00158 static mxmPerlStyleHash fromCommandLineArg(const mxmString &arg);
00159
00160 public:
00161 mxmPerlStyleHash();
00162 mxmPerlStyleHash(const mxmPerlStyleHash &other_hash);
00163 private:
00164 void init_mxmPerlStyleHash(void);
00165
00166 public:
00167 mxmPerlStyleHash &operator=(const mxmPerlStyleHash &other_hash);
00168
00169 public:
00171 mxmString &operator[](const mxmString &key);
00174 mxmString value(const mxmString &key) const;
00177 void deleteKey(const mxmString &key);
00179 void setCaseInsensitiveKeysMode(bool enabled);
00182 void mergeKeys(const mxmPerlStyleHash &other_hash,
00183 const mxmStringList &allowed_key_mask,
00184 bool treat_mask_as_prefixes = false,
00185 const mxmString &target_key_prefix = "");
00187 void mergeKeysFromString(const mxmString &hash_string,
00188 const mxmString &pair_delimiters,
00189 const mxmString &key_value_separators,
00190 const mxmString &trim_chars);
00192 mxm::smart<mxmStringList> enumerateKeys(void) const;
00195 void purgeValueCharacters(const mxmString &key,
00196 const mxmString &characters_to_purge);
00198 mxmString concatenate(const mxmString &pair_separator = ",",
00199 const mxmString &key_value_separator = "=") const;
00200
00202 int size(void) const;
00203
00205 mxmPerlStyleHash::Iterator iterator(void) const;
00207 void appendItemToTail(mxmObject *item);
00208 };
00209
00210
00211
00212 #endif // __MXM_PERLSTYLEHASH_H__
00213