blob: a29739e2ca5c688d69e05e1659f02f4e09dab461 [file] [log] [blame]
U-Lama\Leee13c3e62011-12-28 14:36:55 -08001#ifndef TINYXML2_INCLUDED
2#define TINYXML2_INCLUDED
3
U-Lama\Lee4cee6112011-12-31 14:58:18 -08004#include <limits.h>
5
6#if defined( _DEBUG ) || defined( DEBUG ) || defined (__DEBUG__)
7 #ifndef DEBUG
8 #define DEBUG
9 #endif
10#endif
11
12
13#if defined(DEBUG)
14 #if defined(_MSC_VER)
15 #define TIXMLASSERT( x ) if ( !(x)) { _asm { int 3 } } //if ( !(x)) WinDebugBreak()
16 #elif defined (ANDROID_NDK)
17 #include <android/log.h>
18 #define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
19 #else
20 #include <assert.h>
21 #define TIXMLASSERT assert
22 #endif
23#else
24 #define TIXMLASSERT( x ) {}
25#endif
26
U-Lama\Leee13c3e62011-12-28 14:36:55 -080027
28namespace tinyxml2
29{
30
U-Lama\Lee560bd472011-12-28 19:42:49 -080031// internal - move to separate namespace
32struct CharBuffer
33{
34 size_t length;
35 char mem[1];
36
37 static CharBuffer* Construct( const char* in );
38 static void Free( CharBuffer* );
39};
40
41
U-Lama\Lee4cee6112011-12-31 14:58:18 -080042class XMLNode
U-Lama\Leee13c3e62011-12-28 14:36:55 -080043{
U-Lama\Lee4cee6112011-12-31 14:58:18 -080044 friend class XMLDocument;
U-Lama\Leee13c3e62011-12-28 14:36:55 -080045public:
U-Lama\Lee560bd472011-12-28 19:42:49 -080046
U-Lama\Lee4cee6112011-12-31 14:58:18 -080047 static XMLNode* Identify( const char* p );
48
49protected:
50 static const char* SkipWhiteSpace( const char* p );
51 static char* SkipWhiteSpace( char* p ) { return (char*) SkipWhiteSpace( (const char*)p ); }
52
53 inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {
54 int n = 0;
55 while( *p && *q && *p == *q && n<nChar ) {
56 ++p; ++q; ++n;
57 }
58 if ( (n == nChar) || ( *p == 0 && *q == 0 ) ) {
59 return true;
60 }
61 return false;
62 }
63
64private:
65
66};
67
68
69class XMLComment : public XMLNode
70{
71
72};
U-Lama\Leee13c3e62011-12-28 14:36:55 -080073
74
75class XMLDocument
76{
77public:
78 XMLDocument();
79
80 bool Parse( const char* );
81
82private:
83 XMLDocument( const XMLDocument& ); // not implemented
U-Lama\Lee4cee6112011-12-31 14:58:18 -080084
U-Lama\Lee560bd472011-12-28 19:42:49 -080085 CharBuffer* charBuffer;
U-Lama\Leee13c3e62011-12-28 14:36:55 -080086};
87
88
89
U-Lama\Lee4cee6112011-12-31 14:58:18 -080090
91
92
U-Lama\Leee13c3e62011-12-28 14:36:55 -080093}; // tinyxml2
94
U-Lama\Lee560bd472011-12-28 19:42:49 -080095
96
U-Lama\Leee13c3e62011-12-28 14:36:55 -080097#endif // TINYXML2_INCLUDED