00001 00002 #ifndef __SKYPE_REF_LIST_H 00003 #define __SKYPE_REF_LIST_H 00004 00005 #include <stdio.h> 00006 #include <skype-thread.h> 00007 00008 class SEReference; 00009 00010 /*! \class SERefList skype-ref-list.h "skype-ref-list.h" 00011 * \brief SERefList represents a list of SEReference objects. 00012 * 00013 * The operator [] is supported, which can be used to go through the list. 00014 */ 00015 class SERefList 00016 { 00017 public: 00018 /** Creates an empty list of references. */ 00019 SERefList(); 00020 /** Constructs an implicitly shared copy of sl. */ 00021 SERefList(const SERefList& sl); 00022 /** Destroys the list and frees the data if this is the last reference to the list. */ 00023 ~SERefList(); 00024 00025 /** \cond INTERNAL */ 00026 protected: 00027 class Element; 00028 class Data; 00029 Data* d; 00030 /** \endcond */ 00031 public: 00032 /** Appends a ref at the end of the list. */ 00033 void push_back(const SEReference & ref) { 00034 append(ref); 00035 } 00036 /** Appends a ref at the end of the list. */ 00037 SERefList& append(const SEReference & ref); 00038 /** Removes the first element from the list and returns it. */ 00039 SEReference& peek(); 00040 /** Returns the size of the list. */ 00041 size_t size() const; 00042 /** Returns the ref specified by its index. */ 00043 SEReference& operator[](size_t n) const; 00044 /** Assigns a shallow copy of sl to this list and returns a reference to it. 00045 * This is very fast because the list isn't actually copied. 00046 */ 00047 SERefList& operator=(const SERefList& sl); 00048 00049 bool contains(const SEReference & val); 00050 bool remove_val(const SEReference & val); 00051 bool remove_pos(const unsigned int pos); 00052 int find_pos(const SEReference & val); 00053 00054 void resize(const unsigned int new_size); 00055 void clear(); 00056 00057 /** \cond INTERNAL */ 00058 protected: 00059 void init(); 00060 void d_ref(); 00061 void d_unref(); 00062 void detach(); 00063 /** \endcond */ 00064 }; 00065 00066 #endif // __SKYPE_REF_LIST_H
(c) Skype Technologies S.A. Confidential/Proprietary
Last updated: Fri Jan 27 2012