class CCL::ObjectList
Overview
Double-linked object list <> More…
#include <objectlist.h> class ObjectList: public CCL::Container, public Core::LinkedList { public: // typedefs typedef ObjectListIterator IteratorClass; // construction ObjectList (const Container& objects); ObjectList (const ObjectList& objects); // methods DECLARE_CLASS (ObjectList, Container); virtual Iterator* newIterator () const; virtual bool isEmpty () const; virtual int count () const; virtual Object* at (int idx) const; virtual int index (const Object& obj) const; virtual int index (const Object* obj) const; virtual bool add (Object* obj); virtual bool remove (Object* obj); virtual void removeAll (); virtual Object* findEqual (const Object& obj) const; virtual bool addSorted (Object* obj); bool insertAt (int idx, Object*const& obj); bool remove (ListIterator <Object*>& iter); bool addDuringIteration (Object* obj); template <class Element = Object> RangeIterator <ObjectList, ObjectListIterator, Element*> begin () const; template <class Element = Object> RangeIterator <ObjectList, ObjectListIterator, Element*> end () const; virtual bool add (Object* obj); void add (const Container& objects, CopyMode mode = kNormal); bool contains (const Object& obj) const; bool contains (const Object* obj) const; template <class Predicate> Object* findIf (const Predicate& recognize) const; template <class Class, class Predicate> Class* findIf (const Predicate& recognize) const; template <class T, class Predicate> T* findIf (const Predicate& recognize) const; template <class Predicate> int removeIf (const Predicate& recognize); template <class Class, class Predicate> int removeIf (const Predicate& recognize); };
Inherited Members
public: // typedefs typedef CStringRef MemberID; typedef Iterator IteratorClass; // enums enum CopyMode; // fields IContainer; // methods virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0; virtual unsigned int CCL_API retain () = 0; virtual unsigned int CCL_API release () = 0; Unknown& operator = (const Unknown&); unsigned int getRetainCount () const; virtual Object*CCL_API revealObject (const void* moduleAddress) = 0; virtual void CCL_API addObserver (IObserver* observer) = 0; virtual void CCL_API removeObserver (IObserver* observer) = 0; virtual void CCL_API signal (MessageRef msg) = 0; virtual void CCL_API deferSignal (IMessage* msg) = 0; static ISubject void addObserver (IUnknown* unknown, IObserver* observer); static void removeObserver (IUnknown* unknown, IObserver* observer); virtual void CCL_API notify (ISubject* subject, MessageRef msg) = 0; static IObserver void notify ( IUnknown* unknown, ISubject* subject, MessageRef msg ); virtual const ITypeInfo&CCL_API getTypeInfo () const = 0; virtual tbool CCL_API getProperty (Variant& var, MemberID propertyId) const = 0; virtual tbool CCL_API setProperty (MemberID propertyId, const Variant& var) = 0; virtual tbool CCL_API getPropertyNames (IPropertyCollector& collector) const = 0; virtual tbool CCL_API invokeMethod (Variant& returnValue, MessageRef msg) = 0; DECLARE_BASE_CLASS (Object); virtual void CCL_API removeObserver (IObserver* observer); virtual void CCL_API signal (MessageRef msg); virtual void CCL_API deferSignal (IMessage* msg); virtual void deferChanged (); virtual void CCL_API notify (ISubject* subject, MessageRef msg); virtual bool equals (const Object& obj) const; virtual int compare (const Object& obj) const; virtual bool load (const Storage& storage); virtual bool save (const Storage& storage) const; virtual bool save (const OutputStorage& storage) const; virtual bool toString (String& string, int flags = 0) const; virtual int getHashCode (int size) const; IUnknown* asUnknown (); static void addGarbageCollected (Object* obj, bool globalScope = true); static void deferDestruction (Object* obj); static const void* getModuleAddress (); virtual IUnknownIterator*CCL_API createIterator () const = 0; DECLARE_CLASS_ABSTRACT (Container, Object); void objectCleanup (bool state = true); bool isObjectCleanup () const; virtual Iterator* newIterator () const = 0; virtual bool isEmpty () const = 0; virtual int count () const = 0; virtual Object* at (int idx) const = 0; virtual int index (const Object& obj) const = 0; virtual int index (const Object* obj) const = 0; virtual bool add (Object* obj) = 0; virtual bool remove (Object* obj) = 0; virtual void removeAll () = 0; virtual Object* findEqual (const Object& obj) const = 0; virtual bool addSorted (Object* obj) = 0; template <class Class, class Predicate> Class* findIf (const Predicate& recognize) const; void add (const Container& objects, CopyMode mode = kNormal); virtual bool load (const Storage& storage); virtual bool save (const Storage& storage) const; template <class Element = Object> RangeIterator <CCL::Container, CCL::Iterator, Element*> begin () const; template <class Element = Object> RangeIterator <CCL::Container, CCL::Iterator, Element*> end () const; void append (const T& data); void prepend (const T& data); bool insertBefore (const T& before, const T& data); bool insertBefore (ListIterator <T>& iter, const T& data); bool insertAfter (ListIterator <T>& iter, const T& data); bool insertAt (int idx, const T& data); bool addSorted (const T& data); bool replace (ListIterator <T>& iter, const T& newData); void swapContent (LinkedList <T>& other); bool remove (const T& data); bool removeAt (int idx); bool remove (ListIterator <T>& iter); template <class Predicate> int removeIf (const Predicate& recognize); int removeIf (ContainerPredicateFunction recognize); void removeAll (); T removeFirst (); T removeLast (); bool isEmpty () const; bool isMultiple () const; int count () const; void sort (); template <class Predicate> void sort (Predicate greater); const T& at (int idx) const; bool contains (const T& data) const; const T& lookup (const T& data) const; const T& getFirst () const; const T& getLast () const; template <class Predicate> const T& findIf (const Predicate& recognize) const; const T& findIf (ContainerPredicateFunction recognize) const; RangeIterator <LinkedList <T>, ListIterator <T>, T&> begin () const; RangeIterator <LinkedList <T>, ListIterator <T>, T&> end () const;
Detailed Documentation
Double-linked object list <>
Methods
virtual Iterator* newIterator () const
Create new iterator.
virtual bool isEmpty () const
Check if container is empty.
virtual int count () const
Count number of items in container.
virtual Object* at (int idx) const
Get object at given index.
virtual int index (const Object& obj) const
Get index of object, compares via Object::equals.
virtual int index (const Object* obj) const
Get index of object, compares object address.
virtual bool add (Object* obj)
Add object.
virtual bool remove (Object* obj)
Remove object, ownership is transfered to caller.
virtual void removeAll ()
Remove (and optionally release) all object.
virtual Object* findEqual (const Object& obj) const
Find equal object.
virtual bool addSorted (Object* obj)
Add object sorted using Object::compare.
virtual bool add (Object* obj)
Add object.
void add (const Container& objects, CopyMode mode = kNormal)
Add from other container using given copy mode.
bool contains (const Object& obj) const
Check if object is contained, compares via Object::equals.
bool contains (const Object* obj) const
Check if object is contained, compares object address.
template <class Predicate> Object* findIf (const Predicate& recognize) const
Check if object is contained using lamda function.
Predicate: (Object*) -> bool.
template <class Class, class Predicate> Class* findIf (const Predicate& recognize) const
Check if object is contained using lamda function; performs ccl_cast to check type.
Predicate: (Class&) -> bool.
template <class Predicate> int removeIf (const Predicate& recognize)
Delete all objects satisfying lambda function, releases object optionally.
Predicate: (Object*) -> bool.
Returns:
number of removed elements
template <class Class, class Predicate> int removeIf (const Predicate& recognize)
Delete all objects satisfying lambda function; performs ccl_cast to check type, releases object optionally.
Predicate: (Class&) -> bool.
Returns:
number of removed elements