KDevelop API Documentation

AST.hpp

Go to the documentation of this file.
00001 #ifndef INC_AST_hpp__
00002 #define INC_AST_hpp__
00003 
00004 /* ANTLR Translator Generator
00005  * Project led by Terence Parr at http://www.jGuru.com
00006  * Software rights: http://www.antlr.org/RIGHTS.html
00007  *
00008  * $Id: AST.hpp,v 1.2 2003/05/02 00:36:19 okellogg Exp $
00009  */
00010 
00011 #include <antlr/config.hpp>
00012 #include <antlr/ASTRefCount.hpp>
00013 #include <antlr/Token.hpp>
00014 #include <vector>
00015 #include <string>
00016 
00017 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00018 namespace antlr {
00019 #endif
00020 
00021 struct ASTRef;
00022 
00023 class ANTLR_API AST {
00024 public:
00025     AST() : ref(0) {}
00026     AST(const AST& other) : ref(other.ref->increment()) {}
00027     virtual ~AST() {}
00028 
00030     virtual const char* typeName( void ) const = 0;
00032     virtual RefAST clone( void ) const = 0;
00034     virtual bool equals(RefAST t) const = 0;
00038     virtual bool equalsList(RefAST t) const = 0;
00039 
00042     virtual bool equalsListPartial(RefAST t) const = 0;
00046     virtual bool equalsTree(RefAST t) const = 0;
00050     virtual bool equalsTreePartial(RefAST t) const = 0;
00051 
00056     virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAll(RefAST t) = 0;
00057 
00062     virtual ANTLR_USE_NAMESPACE(std)vector<RefAST> findAllPartial(RefAST t) = 0;
00063 
00065     virtual void addChild(RefAST c) = 0;
00067     virtual RefAST getFirstChild() const = 0;
00069     virtual RefAST getNextSibling() const = 0;
00070 
00072     virtual ANTLR_USE_NAMESPACE(std)string getText() const = 0;
00074     virtual int getType() const = 0;
00075 
00079     virtual void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) = 0;
00080     virtual void initialize(RefAST t) = 0;
00081     virtual void initialize(RefToken t) = 0;
00082 
00083 #ifdef ANTLR_SUPPORT_XML
00087     virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ) = 0;
00088 #endif
00089 
00091     virtual void setFirstChild(RefAST c) = 0;
00093     virtual void setNextSibling(RefAST n) = 0;
00094 
00096     virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) = 0;
00098     virtual void setType(int type) = 0;
00099 
00101     virtual ANTLR_USE_NAMESPACE(std)string toString() const = 0;
00102 
00104     virtual ANTLR_USE_NAMESPACE(std)string toStringList() const = 0;
00105     virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const = 0;
00106 
00107 #ifdef ANTLR_SUPPORT_XML
00113     virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const = 0;
00114 
00119     virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const = 0;
00120 
00127     friend ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast );
00128 #endif
00129 
00130 private:
00131     friend struct ASTRef;
00132     ASTRef* ref;
00133 
00134     AST(RefAST other);
00135     AST& operator=(const AST& other);
00136     AST& operator=(RefAST other);
00137 };
00138 
00139 #ifdef ANTLR_SUPPORT_XML
00140 inline ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast )
00141 {
00142     ast->toStream(output);
00143     return output;
00144 }
00145 #endif
00146 
00147 extern ANTLR_API RefAST nullAST;
00148 extern ANTLR_API AST* const nullASTptr;
00149 
00150 #ifdef NEEDS_OPERATOR_LESS_THAN
00151 inline operator<(RefAST l,RefAST r); // {return true;}
00152 #endif
00153 
00154 #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
00155 }
00156 #endif
00157 
00158 #endif //INC_AST_hpp__
KDE Logo
This file is part of the documentation for KDevelop Version 3.1.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Feb 22 09:22:34 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003