AstNode.h

Go to the documentation of this file.
00001 /*------------------------------------------------------------------------------
00002     This file is part of PHP-AST Project by Romain Gaucher (http://rgaucher.info).
00003 
00004     PHP-AST is free software: you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation, either version 3 of the License, or
00007     (at your option) any later version.
00008 
00009     PHP-AST/ORACLE is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with PHP-AST.  If not, see <http://www.gnu.org/licenses/>.
00016 ------------------------------------------------------------------------------*/
00017 
00018 #ifndef __AST_NODE_H
00019 #define __AST_NODE_H
00020 
00021 #include <string>
00022 
00023 class AstNode
00024 {
00025     std::string type;
00026     std::string value;
00027   public:
00028     AstNode(const std::string& _type = "", const std::string& _value = "")
00029       : type(_type), value(_value) {}
00030     AstNode(const AstNode& n) {
00031         if (this != &n)
00032             *this = n;
00033     }
00034     ~AstNode() {}
00035     
00036     AstNode& operator=(const AstNode& n) {
00037         if (this != &n) {
00038             type = n.type;
00039             value= n.value;
00040         }
00041         return *this;
00042     }
00043     
00044     bool operator==(const AstNode& n) const {
00045         return this == &n;
00046     }
00047 
00048     inline void setValue(const std::string& v) { value = v; }
00049     inline void setType(const std::string& t)  { type  = t; }
00050     std::string getValue() const { return value; }
00051     std::string getType() const  { return type; }
00052     
00053     friend std::ostream& operator<<(std::ostream& stream, const AstNode& node);
00054 };
00055 
00056 std::ostream& operator<<(std::ostream& stream, const AstNode& node);
00057 
00058 #endif

Generated on Wed Feb 27 20:31:06 2008 for php.ast.svn.src. by  doxygen 1.5.3