GCpp general purpose C++ library  version 1.0
GNamedListT< T > Class Template Reference

#include <GNamedListT.hh>

Inheritance diagram for GNamedListT< T >:
GSortListT< T > GListT< T > GCollectionT< T >

Public Member Functions

template<class Q >
bool IsInstanceOf () const
 
template<class Q >
bool IsInstanceOf ()
 
virtual GNamedListT< T > * Clone () const
 
virtual const char * ClassName () const
 
 GNamedListT (u_int fl=0)
 
 GNamedListT (const GNamedListT< T > &list)
 
 GNamedListT (const GNamedListT< T > &list, u_int fl)
 
GNamedListT< T > & operator= (const GNamedListT< T > &list)
 
virtual ~GNamedListT ()
 
virtual void SetCaseSensitive (bool b=true)
 
virtual void SetDictSort (bool b=true)
 
virtual int Compare (const T &obj1, const T &obj2) const
 
virtual bool ExistName (const string &obj_name) const
 
virtual GListIterT< T > FindName (const string &obj_name, const char smod= 'f') const
 
virtual GListIterT< T > FindNameFirst (const string &obj_name) const
 
virtual GListIterT< T > FindNameLast (const string &obj_name) const
 
virtual GListIterT< T > FindNameNext (const string &obj_name) const
 
virtual GListIterT< T > FindNamePrevious (const string &obj_name) const
 
virtual string * CreateNamesTable () const
 
virtual void SetNamesTable (string table[]) const
 
virtual void Print (FILE *fp=stdout, const string &prefix="") const
 
virtual void Print (ostream &os, const string &prefix="") const
 
- Public Member Functions inherited from GSortListT< T >
template<class Q >
bool IsInstanceOf () const
 
template<class Q >
bool IsInstanceOf ()
 
 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 void Sort ()
 
virtual bool IsSorted () const
 
- Public Member Functions inherited from GListT< T >
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 ()
 
- Public Member Functions inherited from GCollectionT< T >
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 Public Member Functions inherited from GSortListT< T >
static const char * StaticClassName ()
 
- Static Public Member Functions inherited from GListT< T >
static const char * StaticClassName ()
 
static GListIterT< T > Null ()
 
- Static Public Member Functions inherited from GCollectionT< T >
static const char * StaticClassName ()
 

Protected Member Functions

virtual GListIterT< T > __Add (T *item)
 
virtual GListIterT< T > __Insert (T *item)
 
virtual GListIterT< T > * __FindName (const string &obj_name, const char smod= 'f') const
 
- Protected Member Functions inherited from GSortListT< T >
virtual GListIterT< T > __AddSorted (T *item)
 
- Protected Member Functions inherited from GListT< T >
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

- Protected Attributes inherited from GListT< T >
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.
 
- Protected Attributes inherited from GCollectionT< T >
u_int options
 Collection option flags.
 
u_int count_item
 Number of objects in the collection.
 

Detailed Description

template<class T>
class GNamedListT< T >

Template class to define a sortable list (see GSortListT) of named objects, inheriting from the GNamed class (in order to define the required functions).

See GCpp template classes for more information about the template classes.

Constructor & Destructor Documentation

template<class T >
GNamedListT< T >::GNamedListT ( u_int  fl = 0)
inline

Default constructor of an empty sortable list.

Parameters
floption flags (the bit gcollection::gIsSortable is set anyway)

References GDebugConst.

template<class T>
GNamedListT< T >::GNamedListT ( const GNamedListT< T > &  list)
inline

Constructor copying the argument list.

Parameters
listlist to copy

References GDebugConst.

template<class T>
GNamedListT< T >::GNamedListT ( const GNamedListT< T > &  list,
u_int  fl 
)
inline

Constructor copying the argument list.

Parameters
listlist to copy
floption flags (the bit gcollection::gIsSortable is set anyway)

References GDebugConst.

template<class T >
GNamedListT< T >::~GNamedListT ( )
inlinevirtual

Destructor: does not more than the base class.

References GDebugDest.

Member Function Documentation

template<class T>
GListIterT< T > GNamedListT< T >::__Add ( T *  obj_ptr)
protectedvirtual

Function redefined from base class to check for existence of the object name.

Parameters
obj_ptrobject pointer

Reimplemented from GSortListT< T >.

Reimplemented in GTreeBranchT< T >.

References GSortListT< T >::__Add(), GClassWarning, GDebugClass, and GGetString().

template<class T >
GListIterT< T > * GNamedListT< T >::__FindName ( const string &  obj_name,
const char  smod = 'f' 
) const
protectedvirtual

Return a pointer to an iterator on an object with the argument name, or NULL if no ebject with this name is found.

Parameters
obj_nameobject name
smodsearch mod: 'f'=first, 'n'=next, 'p'=previous, "l"=last

References GNamed::Compare(), GNamed::CompareDict(), GDebugClass, GListIterT< T >::NextIterPtr(), GListIterT< T >::PreviousIterPtr(), and GNamed::SetName().

template<class T>
GListIterT< T > GNamedListT< T >::__Insert ( T *  obj_ptr)
protectedvirtual

Function redefined from base class to check for existence of the object name.

Parameters
obj_ptrobject pointer

Reimplemented from GSortListT< T >.

Reimplemented in GTreeBranchT< T >.

References GSortListT< T >::__Insert(), GClassWarning, GDebugClass, and GGetString().

template<class T>
int GNamedListT< T >::Compare ( const T &  obj1,
const T &  obj2 
) const
virtual

Function redefined from the base class, to compare 2 named objects, according to the comparison mode: case sensitive or not, dictionary or ascii code comparison.

Parameters
obj1first object
obj2second object

Reimplemented from GSortListT< T >.

References GString::Compare(), and GString::CompareDict().

template<class T >
string * GNamedListT< T >::CreateNamesTable ( ) const
virtual

Allocates an array of strings with names of the objects. The array must be deleted by the calling program.

template<class T >
bool GNamedListT< T >::ExistName ( const string &  obj_name) const
inlinevirtual

Return true if an object with the argument name is found in the list.

Parameters
obj_nameobject name
template<class T >
GListIterT< T > GNamedListT< T >::FindName ( const string &  obj_name,
const char  smod = 'f' 
) const
inlinevirtual

Return an iterator on an object with the argument name. If the object is found, the current element is set on the object.

Parameters
obj_nameobject name
smodsearch mod: 'f'=first, 'n'=next, 'p'=previous, "l"=last
template<class T >
GListIterT< T > GNamedListT< T >::FindNameFirst ( const string &  obj_name) const
inlinevirtual

Return an iterator on the first object with the argument name. If the object is found, the current element is set on the object.

Parameters
obj_nameobject name
template<class T >
GListIterT< T > GNamedListT< T >::FindNameLast ( const string &  obj_name) const
inlinevirtual

Return an iterator on the last object with the argument name. If the object is found, the current element is set on the object.

Parameters
obj_nameobject name
template<class T >
GListIterT< T > GNamedListT< T >::FindNameNext ( const string &  obj_name) const
inlinevirtual

Return an iterator on the next object with the argument name. If the object is found, the current element is set on the object.

Parameters
obj_nameobject name
template<class T >
GListIterT< T > GNamedListT< T >::FindNamePrevious ( const string &  obj_name) const
inlinevirtual

Return an iterator on the previous object with the argument name. If the object is found, the current element is set on the object.

Parameters
obj_nameobject name
template<class T>
template<class Q >
bool GNamedListT< T >::IsInstanceOf ( ) const
inline

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
template<class T>
GNamedListT< T > & GNamedListT< T >::operator= ( const GNamedListT< T > &  list)
inline

Affectation operator

Parameters
listlist to copy

References G_AFFECT_MOTHER, and GDebugClass.

template<class T >
void GNamedListT< T >::Print ( FILE *  fp = stdout,
const string &  prefix = "" 
) const
virtual

Print the list.

Parameters
fpfile pointer
prefixtext written before each line
template<class T >
void GNamedListT< T >::Print ( ostream &  os,
const string &  prefix = "" 
) const
virtual

Print the list.

Parameters
osoutput stream
prefixtext written before each line
template<class T >
void GNamedListT< T >::SetCaseSensitive ( bool  b = true)
virtual

Set the case sensitive mode.

Parameters
boption ON/OFF

References gcollection::gNoCaseSensitive.

template<class T >
void GNamedListT< T >::SetDictSort ( bool  b = true)
virtual

Set the sorting mode (dictionary or ascii code).

Parameters
boption ON/OFF

References gcollection::gDictSort.

template<class T >
void GNamedListT< T >::SetNamesTable ( string  table[]) const
virtual

Fills an array of strings with names of the objects. The array array size must large enough.


The documentation for this class was generated from the following files: