Base class
Base class.This class is the main class of the Base library. All the other classes of the library inherit (directly or undirectly) this class. It provides virtual methods to get the type of a derived object and some error methods. Each child class redefines the virtual method type. It permits to know the actual type of an object, even if we only know its NstTree part (or another ancestor of the class). Here is an example, with the NstStatementContinue class that is defined further:
NstStatementContinue test_object; NstTree* tree = (NstTree*)&test_object; int rt = tree->type();The variable rt will contain NST_STATEMENT_CONTINUE, because the object tree is in fact an instance of the class NstStatementContinue.The method dynamic_cast<T>(t) should be used to cast an object. Example:
if(NstStatement* st = dynamic_cast<NstStatement*>(t)) { // some operation on st }
Example: let t be a NstStatementDo object:
The first value of current is the index of the loop, the second the
range and the third the list of statements in the loop.
Example: let t be a NstStatementDo object:
The first value of current is the index of the loop, the second the
range and the third the list of statements in the loop.
unsigned long tree_id
virtual int type()
virtual const char* class_type()
virtual const char* class_name()
virtual int base_type()
virtual NstTree* create_default()
NstTree* cut_buffer()
void copy(const NstTree& s)
virtual NstTree* clone()
NstTree& operator= (const NstTree& s)
NstUserInfo user_info
virtual void error(const char* st)
virtual void warning(const char* st)
friend ostream& operator << (ostream& s, const NstTree& t)
virtual NstTree* init()
NstTree* current = t->init();
while (current)
{
cout << *current << endl;
current = t->next();
}
virtual NstTree* init(NstTrees::iterator &it)
NstTrees::iterator it;
NstTree* current = t->init(it);
while (current)
{
cout << *current << endl;
current = t->next(it);
}
virtual NstTree* next()
virtual NstTree* next(NstTrees::iterator &it)
void traversal(int (*action)(NstTree*, void*), void* extra = NULL)
NstTree* upsearch(int (*comptest)(NstTree*, void*), void* extra = NULL)
virtual NstTree* cut()
virtual NstDefinition* search(const NstIdentifier& i, int tp = -1)
virtual void replace(NstTree& n)
NstTree* in()
list <NstTree*> fathers()
string whoami()
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de