00001 /* 00002 * File: re_node.hh 00003 * $Id: re_node.hh,v 1.3 2002/04/29 09:34:10 alec Exp $ 00004 * 00005 * Author: Alec Panoviciu (alecu@email.com) 00006 * 00007 * Comments: 00008 * 00009 * Revision history: 00010 * 00011 * $Log: re_node.hh,v $ 00012 * Revision 1.3 2002/04/29 09:34:10 alec 00013 * scanner ptree building compiles 00014 * 00015 */ 00016 00017 00018 /* 00019 Copyright (C) 2002 Alexandru Panoviciu (alecu@email.com) 00020 00021 This program is free software; you can redistribute it and/or modify 00022 it under the terms of the GNU General Public License as published by 00023 the Free Software Foundation; either version 2 of the License, or 00024 (at your option) any later version. 00025 00026 This program is distributed in the hope that it will be useful, 00027 but WITHOUT ANY WARRANTY; without even the implied warranty of 00028 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00029 GNU General Public License for more details. 00030 00031 You should have received a copy of the GNU General Public License 00032 along with this program; if not, write to the Free Software 00033 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00034 00035 */ 00036 00037 #ifndef __RE_NODE_HH__ 00038 #define __RE_NODE_HH__ 00039 00040 #include "debug.h" 00041 #include "parse_util.hh" 00042 00043 class ReNodeAlgo; 00044 00050 class ReNode 00051 { 00052 public: 00053 00054 ReNode (const Position &pos_) : 00055 pos(pos_) 00056 {} 00057 00058 virtual ~ReNode () {}; 00059 00063 virtual ReNode* clone () = 0; 00064 00068 virtual bool isLeaf () { return getChildCount() == 0; } 00069 00073 virtual int getChildCount () = 0; 00074 00075 00081 virtual ReNode& operator [] (int index) = 0; 00082 00088 virtual bool dfTraverse (ReNodeAlgo &algo); 00089 00090 const Position& getPos () const { return pos; } 00091 00092 #ifdef DEBUG 00093 00094 virtual void dump (ostream &os) const = 0; 00095 00096 #endif 00097 00098 private: 00099 00100 Position pos; 00101 00102 }; 00103 00104 #endif /* #ifndef __RE_NODE_HH__ */
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001