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_ABSTRACTLIST_HXX_ 00009 #define _SK_UTIL_ABSTRACTLIST_HXX_ 00010 00011 #include <sk/util/AbstractCollection.hxx> 00012 #include <sk/util/Class.h> 00013 #include <sk/util/List.h> 00014 00015 namespace sk { 00016 namespace util { 00017 template<class T> 00018 class AbstractList 00019 : public sk::util::AbstractCollection<T>, 00020 public virtual sk::util::List<T> 00021 { 00022 public: 00023 AbstractList(); 00024 virtual ~AbstractList(); 00025 00026 // sk::util::Object re-implementation. 00027 const sk::util::Class getClass() const; 00028 00029 // sk::util::List<T> implementation. 00030 void add(int index, T& object); 00031 void add(int index, T* object); 00032 using AbstractCollection<T>::add; 00033 00034 bool addAll(int index, const Collection<T>& other); 00035 using AbstractCollection<T>::addAll; 00036 00037 bool moveAll(int index, Collection<T>& other); 00038 using AbstractCollection<T>::moveAll; 00039 00040 T& get(int index) const; 00041 using AbstractCollection<T>::get; 00042 00043 int indexOf(const T& object) const; 00044 int indexOf(const Selector<T>& selector) const; 00045 00046 int lastIndexOf(const T& object) const; 00047 int lastIndexOf(const Selector<T>& selector) const; 00048 00049 T& remove(int index); 00050 using AbstractCollection<T>::remove; 00051 00052 T* cutoff(int index); 00053 using AbstractCollection<T>::cutoff; 00054 00055 T* release(int index); 00056 using AbstractCollection<T>::release; 00057 00058 void set(int index, T& object); 00059 void set(int index, T* object); 00060 00061 private: 00062 AbstractList(const AbstractList<T>& other); 00063 AbstractList<T>& operator = (const AbstractList<T>& other); 00064 }; 00065 } 00066 } 00067 00068 #endif /* _SK_UTIL_ABSTRACTLIST_HXX_ */