Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skTreeNodp.h

00001 /*
00002   Copyright 1996-2002
00003   Simon Whiteside
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Lesser General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Lesser General Public License for more details.
00014 
00015     You should have received a copy of the GNU Lesser General Public
00016     License along with this library; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 
00019   $Id: skTreeNodp.h,v 1.16 2002/12/13 17:21:54 sdw Exp $
00020 */
00021 #include "skAlist.h"
00022 
00023 const int       MAXBUFFER=20000;
00024 
00025 
00026 EXTERN_TEMPLATE template class CLASSEXPORT skTAList<skTreeNode>;
00027 
00031 class  CLASSEXPORT skTreeNodeList :  public skTAList<skTreeNode>
00032 {           
00033  public:
00035   skTreeNodeList();
00039   skTreeNodeList(const skTreeNodeList& list);
00041   virtual ~skTreeNodeList();
00046   skTreeNode *      findItem(const skString& label) const;
00052   skTreeNode *      findItem(const skString& label,const skString& data) const;
00057   skTreeNode *      nthElt(USize  i) const;
00061   skTreeNodeList&   operator=(const skTreeNodeList& list);
00062 };
00063 // switches on the optimization where a shared class buffer is used
00064 #define USECLASSBUFFER
00065 
00066 class P_TreeNodeReader 
00067 {
00068  public:
00069 #ifdef STREAMS_ENABLED
00070 
00071   P_TreeNodeReader(istream& in);
00072 #else
00073 
00074   P_TreeNodeReader(FILE * file);
00075 #endif
00076   enum Lexeme           { L_IDENT, L_TEXT, L_LBRACE, L_RBRACE, L_EOF, L_ERROR };
00078   void grabBuffer();
00080   void error(const skString& msg);
00082   bool eof();
00084   int get();
00086   int peek();
00089   Lexeme lex();
00091   void  unLex();
00096   skTreeNode *  parseTreeNode(skTreeNode * pparent);
00100   void parseTreeNodeList(skTreeNode * list);
00102   void addToLexText(Char c);
00104   skString m_FileName;
00106   bool m_UnLex;
00108   Lexeme m_LastLexeme;
00110   Char  * m_LexText;
00112   unsigned short m_Pos;
00114   unsigned short m_LineNum;
00115 #ifdef STREAMS_ENABLED
00116 
00117   istream& m_In;
00118 #else
00119 
00120   FILE * m_In;
00122   bool m_Peeked;
00124   int m_PeekedChar;
00125 #endif
00126 
00127   bool  m_Error;
00128 #ifdef USECLASSBUFFER
00129 
00130   bool  m_UsingClassLexText;
00132   static Char g_ClassLexText[MAXBUFFER];
00134   static bool g_LexTextUsed;
00135 #endif
00136 };
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 

Generated on Mon Dec 16 16:30:12 2002 for Simkin by doxygen1.3-rc1