This class stores key:value pairs of String data and provides functions to access them. More...
#include <dictionary.h>
Public Member Functions | |
| Dictionary () | |
| Constructor, initializes the dictionary. | |
| void | put (zmm::String key, zmm::String value) |
| Adds a new key:value pair to the dictionary. | |
| zmm::String | get (zmm::String key) |
| Returns the value for a given key. | |
| int | size () |
| Returns the number of elements in the dictinary. | |
| void | remove (zmm::String key) |
| Deletes a key value pair. | |
| zmm::String | encode () |
| Returns an url encoded version of the whole dictionary. | |
| zmm::String | encodeSimple () |
| It seems that a lot of devices can not cope with a param=value encoded URL, so we will use a simplified encoding scheme. | |
| void | clear () |
| Removes all elements from the dictionary. | |
| void | decode (zmm::String url) |
| Makes a dictionary out of url encoded data. | |
| void | decodeSimple (zmm::String url) |
| Makes a dictionary out of simplified url encoded data. | |
| zmm::Ref< Dictionary > | clone () |
| Makes a shallow copy of the dictionary. | |
| void | merge (zmm::Ref< Dictionary > other) |
| Merge dictionary with another dictionary. If keys with the same name already exist, the existing ones will be overwritten. | |
| bool | isSubsetOf (zmm::Ref< Dictionary > other) |
| returns true if the dictionary is a subset of another dictionary.# | |
| bool | equals (zmm::Ref< Dictionary > other) |
| checks two dictionaries for equality | |
| zmm::Ref< zmm::Array < DictionaryElement > > | getElements () |
| void | optimize () |
| Frees unnecessary memory. | |
| void | retain () |
| void | release () |
| int | getRefCount () |
Static Public Member Functions | |
| static void * | operator new (size_t size) |
| static void | operator delete (void *ptr) |
Protected Member Functions | |
| zmm::String | _encode (char sep1, char sep2) |
| Allow to specify encoding separators. | |
Protected Attributes | |
| zmm::Ref< zmm::Array < DictionaryElement > > | elements |
| Array of DictionaryElements, representing our Dictionary. | |
| mt_atomic_t | _ref_count |
| pthread_mutex_t | mutex |
This class stores key:value pairs of String data and provides functions to access them.
Definition at line 65 of file dictionary.h.
| Dictionary::Dictionary | ( | ) |
Constructor, initializes the dictionary.
Definition at line 71 of file dictionary.cc.
References elements.
Referenced by clone().
| String Dictionary::_encode | ( | char | sep1, | |
| char | sep2 | |||
| ) | [protected] |
Allow to specify encoding separators.
Definition at line 122 of file dictionary.cc.
References elements, and url_escape().
Referenced by encode(), and encodeSimple().
| void Dictionary::clear | ( | ) |
Removes all elements from the dictionary.
Reimplemented in Dictionary_r.
Definition at line 200 of file dictionary.cc.
References elements.
| Ref< Dictionary > Dictionary::clone | ( | ) |
Makes a shallow copy of the dictionary.
Reimplemented in Dictionary_r.
Definition at line 205 of file dictionary.cc.
References Dictionary(), and elements.
Referenced by Dictionary_r::clone().
| void Dictionary::decode | ( | zmm::String | url | ) |
Makes a dictionary out of url encoded data.
Reimplemented in Dictionary_r.
Definition at line 147 of file dictionary.cc.
References zmm::String::c_str(), zmm::String::length(), put(), and url_unescape().
| void Dictionary::decodeSimple | ( | zmm::String | url | ) |
Makes a dictionary out of simplified url encoded data.
Definition at line 174 of file dictionary.cc.
References zmm::String::index(), zmm::String::length(), put(), zmm::String::substring(), and url_unescape().
| String Dictionary::encode | ( | ) |
Returns an url encoded version of the whole dictionary.
Reimplemented in Dictionary_r.
Definition at line 137 of file dictionary.cc.
References _encode().
| String Dictionary::encodeSimple | ( | ) |
It seems that a lot of devices can not cope with a param=value encoded URL, so we will use a simplified encoding scheme.
Definition at line 142 of file dictionary.cc.
References _encode().
| bool Dictionary::equals | ( | zmm::Ref< Dictionary > | other | ) |
checks two dictionaries for equality
Definition at line 242 of file dictionary.cc.
References isSubsetOf().
| String Dictionary::get | ( | zmm::String | key | ) |
Returns the value for a given key.
Reimplemented in Dictionary_r.
Definition at line 91 of file dictionary.cc.
| Ref< Array< DictionaryElement > > Dictionary::getElements | ( | ) |
| int Object::getRefCount | ( | ) | [inherited] |
Definition at line 78 of file object.cc.
References zmm::Object::_ref_count, and atomic_get().
| bool Dictionary::isSubsetOf | ( | zmm::Ref< Dictionary > | other | ) |
returns true if the dictionary is a subset of another dictionary.#
Definition at line 231 of file dictionary.cc.
References elements.
Referenced by equals().
| void Dictionary::merge | ( | zmm::Ref< Dictionary > | other | ) |
Merge dictionary with another dictionary. If keys with the same name already exist, the existing ones will be overwritten.
Definition at line 217 of file dictionary.cc.
| void Object::operator delete | ( | void * | ptr | ) | [static, inherited] |
| void * Object::operator new | ( | size_t | size | ) | [static, inherited] |
| void Dictionary::optimize | ( | ) | [inline] |
Frees unnecessary memory.
Reimplemented in Dictionary_r.
Definition at line 121 of file dictionary.h.
References elements.
| void Dictionary::put | ( | zmm::String | key, | |
| zmm::String | value | |||
| ) |
Adds a new key:value pair to the dictionary.
Reimplemented in Dictionary_r.
Definition at line 76 of file dictionary.cc.
References elements.
Referenced by decode(), decodeSimple(), and merge().
| void Object::release | ( | ) | [inherited] |
Definition at line 66 of file object.cc.
References zmm::Object::_ref_count, atomic_dec(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::clear(), zmm::String::operator=(), DSOHash< zmm::Array< CacheObject > >::releaseData(), DSBHash< VT >::releaseData(), DSOHash< zmm::Array< CacheObject > >::remove(), zmm::ArrayBase::remove(), zmm::ArrayBase::removeUnordered(), zmm::ArrayBase::set(), zmm::ArrayBase::~ArrayBase(), DSOHash< zmm::Array< CacheObject > >::~DSOHash(), zmm::ObjectQueue< AutoscanDirectory >::~ObjectQueue(), zmm::ObjectStack< Element >::~ObjectStack(), and zmm::String::~String().
| void Dictionary::remove | ( | zmm::String | key | ) |
Deletes a key value pair.
Reimplemented in Dictionary_r.
Definition at line 109 of file dictionary.cc.
References elements.
| void Object::retain | ( | ) | [inherited] |
Definition at line 58 of file object.cc.
References zmm::Object::_ref_count, atomic_inc(), and zmm::Object::mutex.
Referenced by zmm::ArrayBase::append(), zmm::ObjectQueue< AutoscanDirectory >::enqueue(), zmm::ArrayBase::insert(), zmm::String::operator=(), zmm::ObjectStack< Element >::push(), DSOHash< zmm::Array< CacheObject > >::put(), DSBHash< VT >::put(), zmm::ArrayBase::set(), and zmm::String::String().
| int Dictionary::size | ( | ) |
Returns the number of elements in the dictinary.
Definition at line 104 of file dictionary.cc.
References elements.
mt_atomic_t zmm::Object::_ref_count [protected, inherited] |
Definition at line 54 of file object.h.
Referenced by zmm::Object::getRefCount(), zmm::Object::Object(), zmm::Object::release(), and zmm::Object::retain().
zmm::Ref<zmm::Array<DictionaryElement> > Dictionary::elements [protected] |
Array of DictionaryElements, representing our Dictionary.
Definition at line 69 of file dictionary.h.
Referenced by _encode(), clear(), clone(), Dictionary(), get(), getElements(), isSubsetOf(), optimize(), put(), remove(), and size().
pthread_mutex_t zmm::Object::mutex [protected, inherited] |
Reimplemented in AutoscanList, AutoscanInotify, CachedURL, Dictionary_r, DVDNavReader, IOHandlerBufferHelper, ReentrantArray< T >, SingletonManager, Singleton< T >, StorageCache, MutexAutolock, Cond, ThreadExecutor, Singleton< UpdateManager >, Singleton< Timer >, Singleton< ContentDirectoryService >, Singleton< ConfigManager >, Singleton< Server >, Singleton< Runtime >, Singleton< ContentManager >, Singleton< ConnectionManagerService >, Singleton< PlayHook >, Singleton< Storage >, and Singleton< SessionManager >.
Definition at line 56 of file object.h.
Referenced by zmm::Object::Object(), zmm::Object::release(), zmm::Object::retain(), and zmm::Object::~Object().
1.6.1