Project stdui: "Simple Type Dialog User-Interface"

|
Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

stdui::stdobject Class Reference

Simple Text Dialog User Interface:
stdobject class is the root base class of the stdui framework classes library. Every stdui classes is based on and derivated from stdobject class. More...

#include <stdobject.h>

Inheritance diagram for stdui::stdobject:

Inheritance graph
[legend]
Collaboration diagram for stdui::stdobject:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::list< stdobject * > list
typedef stdobject::list::iterator iterator
typedef stdobject::list::const_iterator const_iterator

Public Member Functions

 stdobject ()
 default empty contructor. Initialize sensible data to default values.
 stdobject (stdobject *__parentobj, const std::string &nameid="undef", stdflags __flags=0)
 common contructor that initialize the object with provided values.
template<class T>
int parent_chain (std::list< T * > &l)
 returns all parent objects of type T into a std::list given as the argument l
template<class T>
T * parentof ()
 Returns the first occurence of this object's parent of type T from the object's parent chain.
template<class T>
int childrenof (std::list< T > &l)
 returns all children object of type T into a std::list given as the argument l
template<class T>
T * firstchildof ()
 Returns the first occurence of the object of type T into the object's children list.
template<class T>
T * nextchildof ()
 Returns the next occurence of the object of type T from the object's children list, since the last call of std::object::firstchildof().
template<class T>
T * lastchildof ()
 Returns the last occurence of the object of type T into the object children list.
virtual ~stdobject ()
int addchild (stdobject *_obj)
 Simply add ( or links ) a child opbject into the end of the children list.
stdobjectparent ()
 Returns the address of the immediate parent object as a stdobject class object.
int destroy_children ()
 Recusively destroy and delete the children objects.
int setparent (stdobject *_obj)
 Set this object's parent to _obj.
sigc::signal< bool, stdobject * > & destroy_signal ()
 return ( expose ) the instance of the stdobject's destroy signal to be used for connecting a client slot.
const std::string & classname () const
 return the classname.
const std::string & name () const
 return the object's name.
sigc::signal< bool, stdobject
* >::iterator 
destroy_delegate (const sigc::slot< bool, stdobject * > &_slot)
pthread_t threadid ()
 just returns the thread id ....
int postevent (stdmessage msg)

Protected Member Functions

void purgemessages ()
virtual evt::result messageevent (cmessageevent *mes)
virtual evt::result keyevent (ckeypressevent *kev)
virtual evt::result mouseevent (cmouseevent *mev)

Protected Attributes

stdobject_parent
 Pointer to the parent object.
sigc::signal< bool, stdobject * > destroy_
 sigc::signal object that holds slots to be iterated during deletion of this object.
stdobject::list _children
 std::list container for the immeditate children.
list _parents
 parents list built upon the creation of this object. -- not yet used.
std::string _clsname
 explicite class name of the object. ( avoiding using std::typeinfo for gcc which mangle the classnames...
std::string _name
 Object's name.

Private Member Functions

bool _destroy (stdobject *o)

Private Attributes

stdflag _flags
 Object's current states and flags.
list::iterator _tpl_it
 Persistent children iterator used to save current position into the childrfen list.
pthread_t _thid
std::stack< stdmessage_holdmsgqueu

Detailed Description

Simple Text Dialog User Interface:
stdobject class is the root base class of the stdui framework classes library. Every stdui classes is based on and derivated from stdobject class.

Author:
Serge Lussier,,,

Definition at line 41 of file stdobject.h.


Member Typedef Documentation

typedef stdobject::list::const_iterator stdui::stdobject::const_iterator
 

Reimplemented in stdui::stdwindow.

Definition at line 46 of file stdobject.h.

typedef stdobject::list::iterator stdui::stdobject::iterator
 

Reimplemented in stdui::stdwindow.

Definition at line 45 of file stdobject.h.

typedef std::list<stdobject*> stdui::stdobject::list
 

Reimplemented in stdui::stdwindow.

Definition at line 44 of file stdobject.h.


Constructor & Destructor Documentation

stdui::stdobject::stdobject  ) 
 

default empty contructor. Initialize sensible data to default values.

Definition at line 28 of file stdobject.cpp.

References _flags, _name, _parent, and _thid.

00028                     :sigc::trackable()
00029 {
00030   _flags = (stdflags)0;
00031   _name = "undef";
00032   _parent= (stdobject*)0;
00033   _thid = pthread_self();
00034 }

stdui::stdobject::stdobject stdobject __parentobj,
const std::string &  nameid = "undef",
stdflags  __flags = 0
 

common contructor that initialize the object with provided values.

Definition at line 41 of file stdobject.cpp.

References _flags, and _thid.

00041                                                                                      :
00042 sigc::trackable(),
00043 _parent(__parentobj),
00044 _name(nameid)
00045 {
00046    _flags = __flags;
00047    _thid = pthread_self();
00048 }

stdui::stdobject::~stdobject  )  [virtual]
 

Definition at line 51 of file stdobject.cpp.

References destroy_, and destroy_children().

00052 {
00053    // Informs all non-child object, which want to be notified about the destruction of this object.
00054    destroy_.emit(this); //this call returns when the last connected slot returns...
00055    destroy_children();
00056 }

Here is the call graph for this function:


Member Function Documentation

bool stdui::stdobject::_destroy stdobject o  )  [private]
 

int stdui::stdobject::addchild stdobject _obj  ) 
 

Simply add ( or links ) a child opbject into the end of the children list.

Returns:
integer the number of children into the children list.

Definition at line 67 of file stdobject.cpp.

References _children.

00068 {
00069     _children.push_back(_obj);
00070     _obj->setparent(this);
00071     return _children.size();
00072 }

template<class T>
int stdui::stdobject::childrenof std::list< T > &  l  ) 
 

returns all children object of type T into a std::list given as the argument l

Returns:
integer that holds the number of elements in the list.
Note:
This function does not recursesively search into the children's children list.

Definition at line 181 of file stdobject.h.

References _tpl_it.

00182 {
00183    T* obj=0l;
00184    iterator temp_it = _tpl_it;
00185    if( !l.empty() ) l.clear();
00186    if( ! ( obj = firstchildof<T>() ) ){
00187       _tpl_it = temp_it;
00188       return 0;
00189    }
00190    do l.push_back(obj); while( ( obj = nextchildof<T>() ) != 0l);
00191    _tpl_it = temp_it;
00192     return l.size();
00193 }

stdui::stdobject::classname  )  const [inline]
 

return the classname.

Definition at line 85 of file stdobject.h.

References _clsname.

00085 { return _clsname; }

int stdui::stdobject::destroy_children  ) 
 

Recusively destroy and delete the children objects.

Returns:
number of immediate children objects that was in the list.

Definition at line 83 of file stdobject.cpp.

References _children.

Referenced by ~stdobject().

00084 {
00085    int i = _children.size();
00086    if(!i) return 0;
00087    for( iterator it = _children.begin(); it != _children.end(); it++) delete (*it);
00088    return i;
00089 }

sigc::signal<bool, stdobject*>::iterator stdui::stdobject::destroy_delegate const sigc::slot< bool, stdobject * > &  _slot  )  [inline]
 

Definition at line 98 of file stdobject.h.

References destroy_.

Referenced by main().

00098                                                                                                   {
00099       return destroy_.connect(_slot);
00100     }

stdui::stdobject::destroy_signal  )  [inline]
 

return ( expose ) the instance of the stdobject's destroy signal to be used for connecting a client slot.

Author:
Serge Lussier

Definition at line 79 of file stdobject.h.

References destroy_.

00079 { return destroy_; }

template<class T>
T * stdui::stdobject::firstchildof  ) 
 

Returns the first occurence of the object of type T into the object's children list.

Returns:
The address of the child object or NULL if no object of type T is in the children list.
Note:
This function does not recursively search into the children's children list.

Definition at line 202 of file stdobject.h.

References _children, and _tpl_it.

00203 {
00204    T* pobj;
00205    if( _children.empty() ) return (T*)0l;
00206    _tpl_it = _children.begin();
00207    do{
00208       if( (pobj = dynamic_cast<T*>(_tpl_it)) != 0l ) return pobj;
00209       _tpl_it++;
00210    } while(_tpl_it != _children.end());
00211    return (T*)0l;
00212 }

stdui::stdobject::keyevent ckeypressevent kev  )  [inline, protected, virtual]
 

Definition at line 137 of file stdobject.h.

00137 { return evt::reject; }

template<class T>
T * stdui::stdobject::lastchildof  ) 
 

Returns the last occurence of the object of type T into the object children list.

Returns:
The address of the object, of NULL if no more object of type T into the children list.
Note:
This function does not recursively search into the chilfren's children list.

Definition at line 241 of file stdobject.h.

References _children, and _tpl_it.

00242 {
00243    T* pobj;
00244    iterator it = _children.end();
00245    it--;
00246    if(it == _children.end()) return (T*)0l;
00247    do{
00248       if( (pobj = dynamic_cast<T*>(*it)) ) return pobj;
00249       it--;
00250    }while(_tpl_it != _children.end());
00251    return it == _children.end() ? (T*)0l : *it;
00252 }

stdui::evt::result stdui::stdobject::messageevent cmessageevent mes  )  [protected, virtual]
 

Todo:
implement me

Definition at line 131 of file stdobject.cpp.

00132 {
00134 }

virtual evt::result stdui::stdobject::mouseevent cmouseevent mev  )  [inline, protected, virtual]
 

Definition at line 142 of file stdobject.h.

00142 { return evt::reject; }

stdui::stdobject::name  )  const [inline]
 

return the object's name.

Definition at line 91 of file stdobject.h.

References _name.

00091 { return _name; }

template<class T>
T * stdui::stdobject::nextchildof  ) 
 

Returns the next occurence of the object of type T from the object's children list, since the last call of std::object::firstchildof().

Returns:
The address of the object, of NULL if no more object of type T into the children list.
Note:
This function does not recursively search into the chilfren's children list.

Definition at line 222 of file stdobject.h.

References _children, and _tpl_it.

00223 {
00224    T* pobj;
00225    if(_tpl_it == _children.end() ) if( !(pobj = firstchildof<T>())) return (T*)0l;
00226    _tpl_it++;
00227    do{
00228       if( (pobj = dynamic_cast<T*>(_tpl_it)) != 0l ) return pobj;
00229       _tpl_it++;
00230    } while(_tpl_it != _children.end());
00231    return (T*)0l;
00232 }

stdui::stdobject::parent  )  [inline]
 

Returns the address of the immediate parent object as a stdobject class object.

Definition at line 70 of file stdobject.h.

References _parent.

Referenced by parentof().

00070 { return _parent; }

template<class T>
int stdui::stdobject::parent_chain std::list< T * > &  l  ) 
 

returns all parent objects of type T into a std::list given as the argument l

Returns:
integer that holds the number of elements in the list - 0 if there are no parent of type T into the object's parent chain.

Definition at line 146 of file stdobject.h.

References parentof().

00147 {
00148     T* pr = parentof<T>();
00149     while(pr){
00150         l.push_back(pr);
00151         pr = pr->parentof<T>();
00152     }
00153     return l.size();
00154 }

Here is the call graph for this function:

template<class T>
T * stdui::stdobject::parentof  ) 
 

Returns the first occurence of this object's parent of type T from the object's parent chain.

Returns:
Address of the object of type T, or NULL if no object of type T in the parent chain

Definition at line 162 of file stdobject.h.

References parent().

Referenced by parent_chain().

00163 {
00164     T* P=0l;
00165     stdobject* o = this;
00166     while(P == 0l){
00167         o = o->parent();
00168         if(!o) return 0l;
00169         if( ( P = dynamic_cast<T*>(o) ) != 0l) return P;
00170     }
00171     return (T*)0l;
00172 }

Here is the call graph for this function:

int stdui::stdobject::postevent stdmessage  msg  ) 
 

Definition at line 112 of file stdobject.cpp.

References _holdmsgqueu.

00113 {
00114     _holdmsgqueu.push( msg );
00115     return _holdmsgqueu.size();
00116 }

void stdui::stdobject::purgemessages  )  [protected]
 

Todo:
implement me

Definition at line 122 of file stdobject.cpp.

00123 {
00125 }

int stdui::stdobject::setparent stdobject _obj  ) 
 

Set this object's parent to _obj.

Definition at line 100 of file stdobject.cpp.

References _parent.

00101 {
00102     _parent = _obj;
00103     return 0;
00104 }

stdui::stdobject::threadid  )  [inline]
 

just returns the thread id ....

Definition at line 106 of file stdobject.h.

References _thid.

00106 { return _thid; }


Member Data Documentation

stdobject::list stdui::stdobject::_children [protected]
 

std::list container for the immeditate children.

Definition at line 122 of file stdobject.h.

Referenced by addchild(), destroy_children(), firstchildof(), lastchildof(), and nextchildof().

std::string stdui::stdobject::_clsname [protected]
 

explicite class name of the object. ( avoiding using std::typeinfo for gcc which mangle the classnames...

Definition at line 126 of file stdobject.h.

Referenced by classname().

stdflag stdui::stdobject::_flags [private]
 

Object's current states and flags.

Definition at line 110 of file stdobject.h.

Referenced by stdobject().

std::stack<stdmessage> stdui::stdobject::_holdmsgqueu [private]
 

Definition at line 114 of file stdobject.h.

Referenced by postevent().

std::string stdui::stdobject::_name [protected]
 

Object's name.

Definition at line 128 of file stdobject.h.

Referenced by name(), and stdobject().

stdobject* stdui::stdobject::_parent [protected]
 

Pointer to the parent object.

Definition at line 118 of file stdobject.h.

Referenced by parent(), setparent(), and stdobject().

list stdui::stdobject::_parents [protected]
 

parents list built upon the creation of this object. -- not yet used.

Definition at line 124 of file stdobject.h.

pthread_t stdui::stdobject::_thid [private]
 

Definition at line 113 of file stdobject.h.

Referenced by stdobject(), and threadid().

list::iterator stdui::stdobject::_tpl_it [private]
 

Persistent children iterator used to save current position into the childrfen list.

Definition at line 112 of file stdobject.h.

Referenced by childrenof(), firstchildof(), lastchildof(), and nextchildof().

sigc::signal<bool, stdobject*> stdui::stdobject::destroy_ [protected]
 

sigc::signal object that holds slots to be iterated during deletion of this object.

Definition at line 120 of file stdobject.h.

Referenced by destroy_delegate(), destroy_signal(), and ~stdobject().


The documentation for this class was generated from the following files:
API Documentation Generated by:  doxygen 1.4.0
About the author | Site started with trial version of DreamWeaver MX 2004 | Finalizing with  | Contact | ©2005, Serge Lussier ( Bretzel )