• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/xml/XmlParsingData.h

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef _xmlparsingdata_h
00018 #define _xmlparsingdata_h
00019 
00020 #include <spl/Debug.h>
00021 
00022 // Used by the parsing routines.
00023 enum XmlEncoding
00024 {
00025         TIXML_ENCODING_UNKNOWN,
00026         TIXML_ENCODING_UTF8,
00027         TIXML_ENCODING_LEGACY
00028 };
00029 
00030 const XmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN;
00031 
00032 /*      Internal structure for tracking location of items 
00033         in the XML file.
00034 */
00035 struct TiXmlCursor
00036 {
00037         TiXmlCursor()           { Clear(); }
00038         void Clear()            { row = col = -1; }
00039 
00040         int row;        // 0 based.
00041         int col;        // 0 based.
00042 };
00043 
00044 class XmlDocument;
00045 
00046 class XmlParsingData
00047 {
00048         friend class XmlDocument;
00049         
00050 public:
00051         void Stamp( const char* now, XmlEncoding encoding );
00052 
00053         const TiXmlCursor& Cursor()     { return cursor; }
00054 
00055         XmlParsingData( const char* start, int _tabsize, int row, int col, bool _condenseWs )
00056         {
00057                 assert( start );
00058                 stamp = start;
00059                 tabsize = _tabsize;
00060                 cursor.row = row;
00061                 cursor.col = col;
00062                 condenseWs = _condenseWs;
00063         }
00064 
00065 private:
00066         TiXmlCursor             cursor;
00067         const char*             stamp;
00068         int                             tabsize;
00069         bool                    condenseWs;
00070 };
00071 
00072 
00073 #endif