00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_UTIL_ABSTRACTCOLLECTION_HXX_ 00009 #define _SK_UTIL_ABSTRACTCOLLECTION_HXX_ 00010 00011 #include <sk/util/Collection.h> 00012 #include <sk/util/Class.h> 00013 00014 namespace sk { 00015 namespace util { 00016 template<class T> 00017 class AbstractCollection 00018 : public virtual sk::util::Collection<T> 00019 { 00020 public: 00021 AbstractCollection(); 00022 virtual ~AbstractCollection(); 00023 00024 // sk::util::Object re-implementation. 00025 const sk::util::Class getClass() const; 00026 00027 // sk::util::Collection<T> implementation. 00028 T& get(const Selector<T>& selector) const; 00029 void forEach(const Processor<T>& procesor) const; 00030 bool find(sk::util::Holder<T>& holder, const Selector<T>& selector) const; 00031 bool isEmpty() const; 00032 int size() const; 00033 bool contains(const T& object) const; 00034 bool contains(const Selector<T>& selector) const; 00035 bool containsAll(const Collection<T>& other) const; 00036 bool add(T& object); 00037 bool add(T* object); 00038 bool addAll(const Collection<T>& other); 00039 bool moveAll(Collection<T>& other); 00040 void clear(); 00041 bool remove(const T& object); 00042 bool remove(const Selector<T>& selector); 00043 T* cutoff(const T& object); 00044 T* cutoff(const Selector<T>& selector); 00045 T* release(const T& object); 00046 T* release(const Selector<T>& selector); 00047 bool removeAll(const Collection<T>& other); 00048 bool removeAll(const Selector<T>& selector); 00049 bool retainAll(const Collection<T>& other); 00050 bool retainAll(const Selector<T>& selector); 00051 00052 private: 00053 AbstractCollection(const AbstractCollection<T>& other); 00054 AbstractCollection<T>& operator = (const AbstractCollection<T>& other); 00055 }; 00056 } 00057 } 00058 00059 #endif /* _SK_UTIL_ABSTRACTCOLLECTION_HXX_ */