00001 #include "xmltk.h" 00002 00003 #ifndef _TOKENMAP_H 00004 #define _TOKENMAP_H 00005 00006 class CXTOKEN 00007 { 00008 public: 00009 CXTOKEN() : m_xt(XT_UNKNOWN) {} 00010 CXTOKEN(XTOKEN xt) : m_xt(xt) {} 00011 CXTOKEN& operator= (const CXTOKEN& cxt) { m_xt = cxt.m_xt; return *this; } 00012 CXTOKEN& operator= (XTOKEN xt) { m_xt = xt; return *this; } 00013 ~CXTOKEN() {} 00014 00015 XTOKEN operator ()() const { return m_xt; } 00016 00017 private: 00018 XTOKEN m_xt; 00019 }; 00020 00021 class CTokenMap 00022 { 00023 public: 00024 void AddMapping(XTOKEN xtFrom, XTOKEN xtTo); 00025 XTOKEN GetMapping(XTOKEN xtFrom); 00026 00027 private: 00028 inline int _XTOKENToIndex(XTOKEN xt); 00029 inline XTOKEN _IndexToXTOKEN(int iIndex); 00030 00031 vector<CXTOKEN> m_vxtMap; 00032 }; 00033 00034 #endif // _TOKENMAP_H