Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBxmlLexer.hxx

Go to the documentation of this file.
00001 #ifndef _CTBxmlLexer_HXX
00002 #define _CTBxmlLexer_HXX 1
00003 
00008 /*----------------------------------------------------------------------------*/
00009 /* C Tool Box: Designed and implemented by:                                   */
00010 /*    Walter F.J. Mueller   Gesellschaft fuer Schwerionenforschung (GSI)      */
00011 /*                          Planckstrasse 1, D-64291 Darmstadt, Germany       */
00012 /*                  Email:  W.F.J.Mueller@gsi.de                              */
00013 /*                  WWW:    http://www-kp3.gsi.de/www/kp3/people/mueller.html */
00014 /*----------------------------------------------------------------------------*/
00015 
00016 #include "CTBstring.hxx"
00017 
00018 class CTBxmlLexerToken;
00019 
00020 class CTBxmlLexer {
00021   public:
00022     enum mode { tagordata,                  
00023                 tagattr,                    
00024                 attrval,                    
00025                 valsquote,                  
00026                 valdquote                   
00027     };
00028 
00029                     CTBxmlLexer();
00030 
00031     void            Get(istream& is, CTBxmlLexerToken& lt);
00032 
00033     void            Clear();
00034     int             NLine() const;
00035     int             NColumn() const;
00036 
00037     void            Mode(int i_mode);
00038     int             Mode() const;
00039 
00040     void            Dump(int i_indent=0, ostream& os=cout,
00041                          const char* p_text=0) const;
00042 
00043   private:
00044     int             GetChar(istream& is);
00045     void            GetEntity(istream& is, CTBxmlLexerToken& lt);
00046     void            GetWhite(istream& is, CTBxmlLexerToken& lt);
00047     void            GetName(istream& is, CTBxmlLexerToken& lt);
00048   
00049   private:
00050     int             mi_mode;                
00051     int             mi_nline_t;             
00052     int             mi_ncolumn_t;           
00053     int             mi_nline_s;             
00054     int             mi_ncolumn_s;           
00055 };
00056 
00057 //##############################################################################
00058 
00059 class CTBxmlLexerToken {
00060   public:
00061     enum type { invalid = -1,               
00062                 fail,                       
00063                 eof,                        
00064                 tagopen,                    
00065                 etagopen,                   
00066                 tagclose,                   
00067                 etagclose,                  
00068                 comment,                    
00069                 defopen,                    
00070                 piopen,                     
00071                 piclose,                    
00072                 charref,                    
00073                 entref,                     
00074                 equal,                      
00075                 squote,                     
00076                 dquote,                     
00077                 name,                       
00078                 white,                      
00079                 data                        
00080     };
00081   
00082                     CTBxmlLexerToken();
00083 
00084     int             Type() const;
00085     void            Type(int i_type);
00086 
00087     const CTBstring& Text() const;
00088 
00089     void            Clear();
00090 
00091     void            ToStream(ostream& os) const;
00092 
00093     void            Dump(int i_indent=0, ostream& os=cout,
00094                          const char* p_text=0) const;
00095 
00096     bool            operator!() const;
00097 
00098                     operator const char* () const;
00099                     operator CTBstring() const;
00100 
00101     CTBxmlLexerToken& operator=(const char* c_text);
00102     CTBxmlLexerToken& operator+=(char c);
00103     CTBxmlLexerToken& operator+=(const char* c_text);
00104 
00105   private:
00106 
00107     int             mi_type;                
00108     CTBstring       m_text;                 
00109 };
00110 
00111  ostream& operator<<(ostream& os, const CTBxmlLexerToken& obj);
00112 
00113 #include "CTBxmlLexer.icc"
00114 
00115 #endif

Generated at Fri Oct 24 18:11:31 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001