GCpp general purpose C++ library  version 1.0
GNamedListT.hh
Go to the documentation of this file.
1 //======================================================================
2 /*! \file GNamedListT.hh
3  *
4  * Include file for GNamedListT template class.
5  */
6 //======================================================================
7 
8 #ifndef G_NAMED_LIST_T_HH
9 #define G_NAMED_LIST_T_HH
10 
11 #include "GSortListT.hh"
12 #include "GNamed.hh"
13 
14 //======================================================================
15 /*! \class GNamedListT
16  *
17  * Template class to define a sortable list (see GSortListT) of
18  * \b named objects, inheriting from the GNamed class (in order
19  * to define the required functions).
20  *
21  * See \ref gcpp_templates for more information about the template classes.
22  */
23 template <class T> class GNamedListT : public GSortListT<T>
24 {
25  //------------------------------------------------------------
26  /*! \object_doc */
28  //------------------------------------------------------------
29 
30  using GCollectionT<T>::options;
31  using GListT<T>::current_item;
32  using GListT<T>::first_item;
33  using GListT<T>::last_item;
34  using GListT<T>::Null;
35  using GListT<T>::Begin;
36  using GListT<T>::End;
37 
38  public:
39  //------------------------------------------------------------
40  // Constructor / Destructor / Affectation
41  GNamedListT ( u_int fl = 0 );
42  GNamedListT ( const GNamedListT<T> & list );
43  GNamedListT ( const GNamedListT<T> & list, u_int fl );
44  GNamedListT<T> & operator = ( const GNamedListT<T> & list );
45  virtual ~GNamedListT ( );
46 
47  //------------------------------------------------------------
48  virtual void SetCaseSensitive ( bool b = true );
49  virtual void SetDictSort ( bool b = true );
50 
51  virtual int Compare ( const T & obj1, const T & obj2 ) const;
52  virtual bool ExistName ( const string &obj_name ) const;
53  virtual GListIterT<T> FindName ( const string &obj_name, const char smod = 'f' ) const;
54  virtual GListIterT<T> FindNameFirst ( const string &obj_name ) const;
55  virtual GListIterT<T> FindNameLast ( const string &obj_name ) const;
56  virtual GListIterT<T> FindNameNext ( const string &obj_name ) const;
57  virtual GListIterT<T> FindNamePrevious ( const string &obj_name ) const;
58 
59  virtual string * CreateNamesTable ( ) const;
60  virtual void SetNamesTable ( string table[] ) const;
61 
62  //------------------------------------------------------------
63  virtual void Print ( FILE * fp = stdout, const string & prefix = "" ) const;
64  virtual void Print ( ostream & os, const string & prefix = "" ) const;
65 
66  //------------------------------------------------------------
67  // internal functions
68  protected:
69  virtual GListIterT<T> __Add ( T * item ); // redefined from GSortListT
70  virtual GListIterT<T> __Insert ( T * item ); // redefined from GSortListT
71  virtual GListIterT<T> * __FindName ( const string &obj_name, const char smod = 'f' ) const;
72 };
73 
74 //----------------------------------------------------------------------
75 // Inline and template functions
76 #include "icc/GNamedListT.icc"
77 
78 //======================================================================
79 #endif
virtual void SetCaseSensitive(bool b=true)
Definition: GNamedListT.icc:53
virtual void Print(FILE *fp=stdout, const string &prefix="") const
Definition: GNamedListT.icc:187
GListIterT< T > ** last_item
Iterator on last object in the list.
Definition: GListT.hh:75
virtual GListIterT< T > End() const
Definition: GListT.icc:112
Definition: GListIterT.hh:21
Definition: GListIterT.hh:13
Definition: GSortListT.hh:28
Definition: GNamedListT.hh:23
virtual void SetNamesTable(string table[]) const
Definition: GNamedListT.icc:166
virtual GListIterT< T > Begin() const
Definition: GListT.icc:104
virtual int Compare(const T &obj1, const T &obj2) const
Definition: GNamedListT.icc:83
Definition: GCollectionT.hh:115
u_int options
Collection option flags.
Definition: GCollectionT.hh:123
#define GObject(T)
Definition: GClassDefine.hh:65
GListIterT< T > ** current_item
Iterator on current object in the list.
Definition: GListT.hh:76
virtual GListIterT< T > __Add(T *item)
Definition: GNamedListT.icc:214
virtual GListIterT< T > FindNameLast(const string &obj_name) const
Definition: GNamedListT.icc:133
virtual GListIterT< T > FindNameFirst(const string &obj_name) const
Definition: GNamedListT.icc:127
virtual void SetDictSort(bool b=true)
Definition: GNamedListT.icc:65
virtual string * CreateNamesTable() const
Definition: GNamedListT.icc:152
virtual GListIterT< T > FindNamePrevious(const string &obj_name) const
Definition: GNamedListT.icc:145
GListIterT< T > ** first_item
Iterator on first object in the list.
Definition: GListT.hh:74
virtual GListIterT< T > FindName(const string &obj_name, const char smod= 'f') const
Definition: GNamedListT.icc:117
static GListIterT< T > Null()
Definition: GListT.icc:119
virtual GListIterT< T > * __FindName(const string &obj_name, const char smod= 'f') const
Definition: GNamedListT.icc:271
virtual GListIterT< T > FindNameNext(const string &obj_name) const
Definition: GNamedListT.icc:139
unsigned int u_int
Definition: GTypes.hh:38
virtual GListIterT< T > __Insert(T *item)
Definition: GNamedListT.icc:241
virtual bool ExistName(const string &obj_name) const
Definition: GNamedListT.icc:109