00001 #if !defined(AFX_TOKENIZER_H__ADD073B4_5613_4A48_86C6_871FB8D2946F__INCLUDED_) 00002 #define AFX_TOKENIZER_H__ADD073B4_5613_4A48_86C6_871FB8D2946F__INCLUDED_ 00003 00004 #if _MSC_VER > 1000 00005 #pragma once 00006 #endif // _MSC_VER > 1000 00007 00008 /* 00009 * The Finite State Machine (FSM) Library 00010 * Copyright (C) 2002 Siemens C-LAB Paderborn 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify it 00014 * under the terms of the GNU Lesser General Public License as published by 00015 * the Free Software Foundation; either version 2.1 of the License, or (at 00016 * your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, but 00019 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00020 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00021 * License for more details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program; if not, write to the Free Software Foundation, 00025 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00026 */ 00027 00028 // $Log: Tokenizer.h,v $ 00029 // Revision 1.2 2002/08/20 14:48:41 vofka 00030 // FiniteStateMachine-config.h removed from installing. Loading exported to the loader class. Saver introduced. Error codes exported to FSMErrorCodes. 00031 // 00032 // Revision 1.1 2002/06/28 11:10:36 vofka 00033 // first time on sourceforge.net cvs 00034 // 00035 // Revision 1.7 2002/06/20 12:22:11 bobka 00036 // LGPL license 00037 // 00038 // Revision 1.6 2001/12/21 12:01:21 bobka 00039 // laeuft auf linux 00040 // 00041 // Revision 1.5 2001/12/07 13:50:59 bobka 00042 // clean up improved (delete tokenizer) 00043 // CTokenizer exported 00044 // LoadFSM public 00045 // 00046 // Revision 1.4 2001/12/06 16:30:37 bobka 00047 // comments <!-- ... --> support added 00048 // closed tag < .. /> support added 00049 // 00050 // Revision 1.3 2001/11/28 15:42:01 bobka 00051 // a lot of changes 00052 // 00053 // Revision 1.2 2001/11/23 09:27:58 bobka 00054 // Load/Save funktioniert. 00055 // FSM* im Fileformat entfernt. 00056 // streams entfernt. 00057 // Laeuft unter Win32 und unter WinCE (WinCE_STL Modul auschecken) 00058 // static library unter WinCE funktioniert nicht, nur DLL. 00059 // 00060 // Revision 1.1 2001/11/15 10:37:33 bobka 00061 // initial checkin 00062 // not tested on linux! 00063 // 00064 00065 #include <map> 00066 #include <string> 00067 #include <cstdio> 00068 #include <fstream> 00069 00071 namespace FSM { 00072 using std::map; 00073 using std::string; 00074 using std::less; 00075 #ifndef __SGI_STL_STRING 00076 using std::ifstream; 00077 #endif 00078 00079 typedef map< string, string > Attrib_Map; 00080 typedef Attrib_Map::value_type TAM_VT; 00081 00082 // externals 00083 class CFiniteStateMachine; 00084 class CFSMState; 00085 00086 class CTokenizer 00087 { 00088 public: 00089 friend class CTOKActionSetTag; 00090 friend class CTOKActionSetAttribute; 00091 00092 CTokenizer(FILE *inFile); 00093 virtual ~CTokenizer(); 00094 00095 bool GetTag(); 00096 const char* GetTagName(); 00097 00098 bool GetAttribute(char *AttribName, char *retValue, int len); 00099 bool IsTagClosed(); 00100 00101 protected: 00102 Attrib_Map Attributes; 00103 string tag; 00104 00105 private: 00106 FILE *inFile; 00107 char name[255]; 00108 char* name_p; 00109 char value[255]; 00110 char* value_p; 00111 char tagname[255]; 00112 char* tagname_p; 00113 CFiniteStateMachine *fsm; 00114 CFSMState *state; 00115 bool tagClosed; 00116 }; 00117 00118 }; // namespace FSM 00119 00120 #endif // !defined(AFX_TOKENIZER_H__ADD073B4_5613_4A48_86C6_871FB8D2946F__INCLUDED_)