- Main Page
- Related Pages
- Classes
- Files
- Examples

- File List
- File Members

# skype-obj-dict.h

Go to the documentation of this file.

    00001
    00002 #ifndef __SKYPE_OBJ_DICT_H
    00003 #define __SKYPE_OBJ_DICT_H
    00004
    00005 #include <stddef.h>
    00006 #include <skype-int-list.h>
    00007 #include <skype-thread.h>
    00008
    00009 class SEObject;
    00010
    00011 /** \class SEObjDict skype-obj-dict.h "skype-obj-dict.h"
    00012  *  \brief SEObjDict is a dictionary class of SEObject pointers associated to integers.
    00013  */
    00014 class SEObjDict
    00015 {
    00016 public:
    00017         /** Creates an empty dictionary of pointers. */
    00018         SEObjDict();
    00019         /** Constructs an implicitly shared copy of dict. */
    00020         SEObjDict(const SEObjDict& dict);
    00021         /** Destroys the dictionary and frees the data if this is the last reference to it. */
    00022         ~SEObjDict();
    00023
    00024         /** \cond INTERNAL */
    00025 protected:
    00026         class Element;
    00027         class Data;
    00028         Data* d;
    00029         /** \endcond */
    00030
    00031 public:
    00032         /** Inserts the key with the value into the dictionary.
    00033          * Multiple items can have the same key, they are not overwritten.
    00034          * You can access them with the offset parameter of the find() function.
    00035          * If key is null, nothing is inserted.
    00036          */
    00037         void insert(const int key, const SEObject* value);
    00038         /** Finds the specified key in the dictionary.
    00039          * \param key       Key to search.
    00040          * \param offset    When the dictionary contains several entries with the same key,
    00041          *                  use the offset param to indicate which key you want.
    00042          * \return null if the key is not found.
    00043          */
    00044         const SEObject*& find(const int key, unsigned int offset = 0) const;
    00045         /** Assigns a shallow copy of dict to this dictionary and returns a reference to it.
    00046          * This is very fast because the dictionary isn't actually copied.
    00047          */
    00048         SEObjDict& operator=(const SEObjDict& dict);
    00049
    00050         /** Returns how many elements are in the dictionary. */
    00051         size_t size() const;
    00052
    00053         /** Use this function to iterate through the dictionary.
    00054          * It doesn't make sense to use this functions outside of an iteration (i.e. a loop).
    00055          * See also keyAt()
    00056          */
    00057         const SEObject*& operator[](size_t i) const;
    00058         /** Use this function to iterate through the dictionary.
    00059          * It doesn't make sense to use this functions outside of an iteration (i.e. a loop).
    00060          * See also operator[]()
    00061          */
    00062         int keyAt(size_t i) const;
    00063
    00064         bool remove(const int key);
    00065
    00066         const SEObject*& value(const int key) { return find(key); }
    00067
    00068         SEIntList keys();
    00069
    00070         /** \cond INTERNAL */
    00071
    00072 protected:
    00073         void d_ref();
    00074         void d_unref();
    00075         void detach();
    00076         /** \endcond */
    00077 };
    00078
    00079 #endif // __SKYPE_OBJ_DICT_H

All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

(c) Skype Technologies S.A. Confidential/Proprietary

Last updated: Fri Jan 27 2012