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

tokenmap.cpp

Go to the documentation of this file.
00001 #include "xmltk.h"
00002 #include "tokenmap.h"
00003 
00004 bool operator==(const CXTOKEN& cxt1, const CXTOKEN& cxt2) 
00005 { 
00006     return cxt1() == cxt2(); 
00007 }
00008 bool operator<(const CXTOKEN& cxt1, const CXTOKEN& cxt2)
00009 { 
00010     return cxt1() < cxt2();
00011 }
00012 
00013 void CTokenMap::AddMapping(XTOKEN xtFrom, XTOKEN xtTo)
00014 {
00015     myassert(m_bExternalStream);
00016 
00017     int iFrom = _XTOKENToIndex(xtFrom);
00018     if (iFrom >= m_vxtMap.size())
00019     {
00020         m_vxtMap.resize((iFrom+1)*2);
00021     }
00022     m_vxtMap[iFrom] = xtTo;
00023 }
00024 
00025 XTOKEN CTokenMap::GetMapping(XTOKEN xtFrom)
00026 {
00027     int iIndex = _XTOKENToIndex(xtFrom);
00028     if (iIndex < m_vxtMap.size())
00029     {
00030         return m_vxtMap[iIndex]();
00031     }
00032     return XT_UNKNOWN;
00033 }
00034    
00035 int CTokenMap::_XTOKENToIndex(XTOKEN xt)
00036 {
00037     myassert(xt >= XT_FIRST);
00038     return xt - XT_FIRST;
00039 }
00040 
00041 XTOKEN CTokenMap::_IndexToXTOKEN(int iIndex)
00042 {
00043     myassert(iIndex >= 0);
00044     return iIndex + XT_FIRST;
00045 }
00046 

Generated on Sat Dec 22 16:01:52 2001 for XMILLforBinaryFormat by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001