U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 1 | #ifndef TINYXML2_INCLUDED
|
| 2 | #define TINYXML2_INCLUDED
|
| 3 |
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 4 | #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\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 27 |
|
| 28 | namespace tinyxml2
|
| 29 | {
|
| 30 |
|
U-Lama\Lee | 560bd47 | 2011-12-28 19:42:49 -0800 | [diff] [blame] | 31 | // internal - move to separate namespace
|
| 32 | struct 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\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 42 | class XMLNode
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 43 | {
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 44 | friend class XMLDocument;
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 45 | public:
|
U-Lama\Lee | 560bd47 | 2011-12-28 19:42:49 -0800 | [diff] [blame] | 46 |
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 47 | static XMLNode* Identify( const char* p );
|
| 48 |
|
| 49 | protected:
|
| 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 |
|
| 64 | private:
|
| 65 |
|
| 66 | };
|
| 67 |
|
| 68 |
|
| 69 | class XMLComment : public XMLNode
|
| 70 | {
|
| 71 |
|
| 72 | };
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 73 |
|
| 74 |
|
| 75 | class XMLDocument
|
| 76 | {
|
| 77 | public:
|
| 78 | XMLDocument();
|
| 79 |
|
| 80 | bool Parse( const char* );
|
| 81 |
|
| 82 | private:
|
| 83 | XMLDocument( const XMLDocument& ); // not implemented
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 84 |
|
U-Lama\Lee | 560bd47 | 2011-12-28 19:42:49 -0800 | [diff] [blame] | 85 | CharBuffer* charBuffer;
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 86 | };
|
| 87 |
|
| 88 |
|
| 89 |
|
U-Lama\Lee | 4cee611 | 2011-12-31 14:58:18 -0800 | [diff] [blame^] | 90 |
|
| 91 |
|
| 92 |
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 93 | }; // tinyxml2
|
| 94 |
|
U-Lama\Lee | 560bd47 | 2011-12-28 19:42:49 -0800 | [diff] [blame] | 95 |
|
| 96 |
|
U-Lama\Lee | e13c3e6 | 2011-12-28 14:36:55 -0800 | [diff] [blame] | 97 | #endif // TINYXML2_INCLUDED |