GCpp general purpose C++ library
version 1.0
|
#include <GSortListT.hh>
Public Member Functions | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
virtual GSortListT< T > * | Clone () const |
virtual const char * | ClassName () const |
GSortListT (u_int fl=0) | |
GSortListT (const GSortListT< T > &list) | |
GSortListT (const GListT< T > &list) | |
GSortListT (const GListT< T > &list, u_int fl) | |
GSortListT< T > & | operator= (const GListT< T > &list) |
virtual | ~GSortListT () |
virtual void | ReverseSort () |
virtual int | Compare (const T &obj1, const T &obj2) const |
virtual void | Sort () |
virtual bool | IsSorted () const |
![]() | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
GListT (u_int opts=0) | |
GListT (const GListT< T > &list) | |
GListT (const GListT< T > &list, u_int opts) | |
GListT< T > & | operator= (const GListT< T > &list) |
virtual | ~GListT () |
virtual GListIterT< T > | Begin () const |
virtual GListIterT< T > | End () const |
virtual bool | Exist (const T *ptr) const |
virtual GListIterT< T > | Find (const T *ptr) const |
virtual GListIterT< T > | FindNext (const T *ptr) const |
virtual GListIterT< T > | FindPrevious (const T *ptr) const |
virtual GListIterT< T > | FindFirst (const T *ptr) const |
virtual GListIterT< T > | FindLast (const T *ptr) const |
GListIterT< T > | Current () const |
GListIterT< T > | Previous () const |
GListIterT< T > | Next () const |
GListIterT< T > | First () const |
GListIterT< T > | Last () const |
GListIterT< T > | Goto (u_int n=0) const |
T & | At (u_int n) const |
int | Index () const |
virtual int | Move (int n) |
virtual bool | MoveUp () |
virtual bool | MoveDown () |
virtual bool | MoveTop () |
virtual bool | MoveBottom () |
virtual GListIterT< T > | Add (T *obj_ptr) |
virtual GListIterT< T > | Insert (T *obj_ptr) |
virtual GListIterT< T > | Append (T *obj_ptr) |
virtual GListIterT< T > | Prepend (T *obj_ptr) |
virtual GListIterT< T > | Add (T &obj_ptr) |
virtual GListIterT< T > | Insert (T &obj_ptr) |
virtual GListIterT< T > | Append (T &obj_ptr) |
virtual GListIterT< T > | Prepend (T &obj_ptr) |
virtual T * | Take () |
virtual T * | Take (const T *ptr) |
virtual bool | Remove () |
virtual bool | Remove (const T *ptr, bool all=true) |
virtual void | Empty () |
![]() | |
template<class Q > | |
bool | IsInstanceOf () const |
template<class Q > | |
bool | IsInstanceOf () |
GCollectionT (u_int flg=0) | |
virtual | ~GCollectionT () |
virtual u_int | GetSize () const |
virtual u_int | GetCount () const |
virtual u_int | GetOptions () const |
bool | CheckOptions (u_int opts) const |
bool | FixPositionOption () const |
bool | IsSortable () const |
bool | IsAlwaysSorted () const |
bool | IsReverseSorted () const |
bool | UniqueNameOption () const |
bool | IsCaseSensitive () const |
bool | DictSortOption () const |
Static Public Member Functions | |
static const char * | StaticClassName () |
![]() | |
static const char * | StaticClassName () |
static GListIterT< T > | Null () |
![]() | |
static const char * | StaticClassName () |
Protected Member Functions | |
virtual GListIterT< T > | __Add (T *item) |
virtual GListIterT< T > | __Insert (T *item) |
virtual GListIterT< T > | __AddSorted (T *item) |
![]() | |
virtual GListIterT< T > * | __Exist (const T *ptr, GListIterT< T > *except=NULL) const |
virtual GListIterT< T > * | __Find (const T *ptr, GListIterT< T > *except=NULL) const |
virtual T * | __Take () |
virtual void | __Swap (GListIterT< T > *iter) |
virtual bool | __MoveUp () |
virtual bool | __MoveDown () |
Additional Inherited Members | |
![]() | |
GListIterT< T > ** | first_item |
Iterator on first object in the list. | |
GListIterT< T > ** | last_item |
Iterator on last object in the list. | |
GListIterT< T > ** | current_item |
Iterator on current object in the list. | |
![]() | |
u_int | options |
Collection option flags. | |
u_int | count_item |
Number of objects in the collection. | |
Template class to define a sortable list of objects.
If the gcollection::gAlwaysSorted flags are set, then elements are inserted at their sorted position, and cannot be moved. Else they are inserted at current position, like in the base class, and the list is sorted only if the Sort() function is called.
The objects class must define the Compare() function, on which the sorting is based (returning -1, 0 or 1).
See GCpp template classes for more information about the template classes.
|
inline |
Default constructor of an empty sortable list.
fl | option flags (the bit gcollection::gIsSortable is set anyway) |
References GDebugConst.
|
inline |
Constructor copying the argument list. The list to copy does not need to be sortable, but the copied objects will be placed according to the current list options.
list | list to copy |
References GDebugConst.
|
inline |
Constructor copying the argument list. The list to copy does not need to be sortable, but the copied objects will be placed according to the current list options.
list | list to copy |
References GDebugConst.
|
inline |
Constructor copying the argument list, and specifying option flags. The list to copy does not need to be sortable, but the copied objects will be placed according to the current list options.
list | list to copy |
fl | option flags (the bit gcollection::gIsSortable is set anyway) |
References GDebugConst.
|
inlinevirtual |
Destructor: does not more than the base class.
References GDebugDest.
|
protectedvirtual |
Internal function modified from the base class in order to take into account the sorting.
item | pointer on the object to be added in the list. |
Reimplemented from GListT< T >.
Reimplemented in GTreeBranchT< T >, GNamedListT< T >, GNamedListT< GTreeNodeT< T > >, and GNamedListT< GItem >.
References GListT< T >::__Add(), GDebugClass, and GGetString().
Referenced by GNamedListT< T >::__Add().
|
protectedvirtual |
This function adds an object at its correct place in a sorted list.
item | pointer on the object to be added in the list. |
References GListT< T >::__Add(), GListT< T >::__Insert(), GListT< T >::Current(), GListT< T >::First(), GDebugClass, GGetStringHexa(), and GListT< T >::Null().
|
protectedvirtual |
Internal function modified from the base class in order to take into account the sorting.
item | pointer on the object to be added in the list. |
Reimplemented from GListT< T >.
Reimplemented in GTreeBranchT< T >, GNamedListT< T >, GNamedListT< GTreeNodeT< T > >, and GNamedListT< GItem >.
References GListT< T >::__Insert(), GDebugClass, and GGetString().
Referenced by GNamedListT< T >::__Insert().
|
inlinevirtual |
Comparison of 2 objects of the elements class, base on the Compare function of the objects class (that must be defined). The function returns -1, 0 or 1 depending if obj1 is respectively before, equal or after obj2.
obj1 | first object |
obj2 | second object |
Reimplemented in GNamedListT< T >, GNamedListT< GTreeNodeT< T > >, and GNamedListT< GItem >.
Macro from GCpp library that defines the following functions:
|
virtual |
Return true if the list is sorted according sorting order.
References GIterT< T >::GetPointer(), and GListIterT< T >::Next().
|
inline |
Affectation operator The list to copy does not need to be sortable, but the copied objects will be placed according to the current list options.
list | list to copy |
References G_AFFECT_MOTHER, and GDebugClass.
|
inlinevirtual |
Flip the sorting order.
References gcollection::gReverseSort.
|
virtual |
Sort the list (according to sorting order option).
References GIterT< T >::GetPointer(), GListIterT< T >::NextIterPtr(), and GListIterT< T >::PreviousIterPtr().