00001 00002 #ifndef __SKYPE_INT_DICT_H 00003 #define __SKYPE_INT_DICT_H 00004 00005 #include <stddef.h> 00006 #include <skype-thread.h> 00007 00008 class SEString; 00009 class SEStringList; 00010 00011 /*! \class SEIntDict skype-int-dict.h "skype-int-dict.h" 00012 * \brief SEIntDict is a dictionary class of integers associated to strings. 00013 * 00014 * It is used to set or retrieve multiple properties at once (see the SEObject class). 00015 */ 00016 class SEIntDict 00017 { 00018 public: 00019 /** Creates an empty dictionary of integers. */ 00020 SEIntDict(); 00021 /** Constructs an implicitly shared copy of dict. */ 00022 SEIntDict(const SEIntDict& dict); 00023 /** Destroys the dictionary and frees the data if this is the last reference to it. */ 00024 ~SEIntDict(); 00025 00026 /** \cond INTERNAL */ 00027 protected: 00028 class Element; 00029 class Data; 00030 Data* d; 00031 /** \endcond */ 00032 00033 public: 00034 /** Insert a value into dictionary. If the key already exists, replace. 00035 * \param key 00036 * \param value 00037 * \param replace_only Do not insert, if key is not found, only replace. 00038 */ 00039 void insert(const int key, const SEString& new_value, bool replace_only = false); 00040 /** Finds the value correspinding to the key. */ 00041 SEString find(const int key) const; 00042 00043 /** Assigns a shallow copy of dict to this dictionary and returns a reference to it. 00044 * This is very fast because the dictionary isn't actually copied. 00045 */ 00046 SEIntDict& operator=(const SEIntDict& dict); 00047 00048 /** Returns how many elements are in the dictionary. */ 00049 size_t size() const; 00050 00051 /** Use this function to iterate through the dictionary. 00052 * It doesn't make sense to use this functions outside of an iteration (i.e. a loop). 00053 * See also keyAt() 00054 */ 00055 SEString operator[](size_t i) const; 00056 /** Use this function to iterate through the dictionary. 00057 * It doesn't make sense to use this functions outside of an iteration (i.e. a loop). 00058 * See also operator[]() 00059 */ 00060 int keyAt(size_t i) const; 00061 00062 /** \cond INTERNAL */ 00063 /** This function is used by the internals of the wrapper. */ 00064 SEString format() const; 00065 00066 SEString value(const int key); 00067 00068 protected: 00069 void d_ref(); 00070 void d_unref(); 00071 void detach(); 00072 /** \endcond */ 00073 }; 00074 00075 #endif // __SKYPE_INT_DICT_H
(c) Skype Technologies S.A. Confidential/Proprietary
Last updated: Fri Mar 16 2012