Back to Jetson Inference

Jetson Inference: jetson

docs/html/xml_8h_source.html

latest150.7 KB
Original Source

| | Jetson Inference

DNN Vision Library |

xml.h

Go to the documentation of this file.

1 /*

2 Original code by Lee Thomason (www.grinninglizard.com)

3

4 This software is provided 'as-is', without any express or implied

5 warranty. In no event will the authors be held liable for any

6 damages arising from the use of this software.

7

8 Permission is granted to anyone to use this software for any

9 purpose, including commercial applications, and to alter it and

10 redistribute it freely, subject to the following restrictions:

11

12 1. The origin of this software must not be misrepresented; you must

13 not claim that you wrote the original software. If you use this

14 software in a product, an acknowledgment in the product documentation

15 would be appreciated but is not required.

16

17 2. Altered source versions must be plainly marked as such, and

18 must not be misrepresented as being the original software.

19

20 3. This notice may not be removed or altered from any source

21 distribution.

22 */

23

24 #ifndef TINYXML2_INCLUDED

25 #define TINYXML2_INCLUDED

26

27 #if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)

28 # include <ctype.h>

29 # include <limits.h>

30 # include <stdio.h>

31 # include <stdlib.h>

32 # include <string.h>

33 # if defined(__PS3__)

34 # include <stddef.h>

35 # endif

36 #else

37 # include <cctype>

38 # include <climits>

39 # include <cstdio>

40 # include <cstdlib>

41 # include <cstring>

42 #endif

43 #include <stdint.h>

44

45 /*

46 TODO: intern strings instead of allocation.

47 */

48 /*

49 gcc:

50 g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe

51

52 Formatting, Artistic Style:

53 AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h

54 */

55

56 #if defined( _DEBUG ) || defined (__DEBUG__)

57 # ifndef TINYXML2_DEBUG

58 # define TINYXML2_DEBUG

59 # endif

60 #endif

61

62 #ifdef _MSC_VER

63 # pragma warning(push)

64 # pragma warning(disable: 4251)

65 #endif

66

67 #ifdef _WIN32

68 # ifdef TINYXML2_EXPORT

69 # define TINYXML2_LIB __declspec(dllexport)

70 # elif defined(TINYXML2_IMPORT)

71 # define TINYXML2_LIB __declspec(dllimport)

72 # else

73 # define TINYXML2_LIB

74 # endif

75 #elif __GNUC__ >= 4

76 # define TINYXML2_LIB __attribute__((visibility("default")))

77 #else

78 # define TINYXML2_LIB

79 #endif

80

81

82 #if defined(TINYXML2_DEBUG)

83 # if defined(_MSC_VER)

84 # // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like

85 # define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }

86 # elif defined (ANDROID_NDK)

87 # include <android/log.h>

88 # define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }

89 # else

90 # include <assert.h>

91 # define TIXMLASSERT assert

92 # endif

93 #else

94 # define TIXMLASSERT( x ) {}

95 #endif

96

97

98 /* Versioning, past 1.0.14:

99 http://semver.org/

100 */

101 static const int TIXML2_MAJOR_VERSION = 6;

102 static const int TIXML2_MINOR_VERSION = 2;

103 static const int TIXML2_PATCH_VERSION = 0;

104

105 #define TINYXML2_MAJOR_VERSION 6

106 #define TINYXML2_MINOR_VERSION 2

107 #define TINYXML2_PATCH_VERSION 0

108

109 // A fixed element depth limit is problematic. There needs to be a

110 // limit to avoid a stack overflow. However, that limit varies per

111 // system, and the capacity of the stack. On the other hand, it's a trivial

112 // attack that can result from ill, malicious, or even correctly formed XML,

113 // so there needs to be a limit in place.

114 static const int TINYXML2_MAX_ELEMENT_DEPTH = 100;

115

116 namespace tinyxml2

117 {

118 class XMLDocument;

119 class XMLElement;

120 class XMLAttribute;

121 class XMLComment;

122 class XMLText;

123 class XMLDeclaration;

124 class XMLUnknown;

125 class XMLPrinter;

126

127 /*

128 A class that wraps strings. Normally stores the start and end

129 pointers into the XML file itself, and will apply normalization

130 and entity translation if actually read. Can also store (and memory

131 manage) a traditional char[]

132 */

133 class StrPair

134 {

135 public:

136enum {

137NEEDS_ENTITY_PROCESSING = 0x01,

138NEEDS_NEWLINE_NORMALIZATION = 0x02,

139NEEDS_WHITESPACE_COLLAPSING = 0x04,

140

141TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,

142TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,

143ATTRIBUTE_NAME = 0,

144ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION,

145ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION,

146COMMENT = NEEDS_NEWLINE_NORMALIZATION

147 };

148

149StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {}

150~StrPair();

151

152void Set( char* start, char* end, int flags ) {

153TIXMLASSERT( start );

154TIXMLASSERT( end );

155Reset();

156 _start = start;

157 _end = end;

158 _flags = flags | NEEDS_FLUSH;

159 }

160

161const char* GetStr();

162

163bool Empty() const {

164return _start == _end;

165 }

166

167void SetInternedStr( const char* str ) {

168Reset();

169 _start = const_cast<char*>(str);

170 }

171

172void SetStr( const char* str, int flags=0 );

173

174char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr );

175char* ParseName( char* in );

176

177void TransferTo( StrPair* other );

178void Reset();

179

180 private:

181void CollapseWhitespace();

182

183enum {

184 NEEDS_FLUSH = 0x100,

185 NEEDS_DELETE = 0x200

186 };

187

188int _flags;

189char* _start;

190char* _end;

191

192StrPair( const StrPair& other ); // not supported

193void operator=( StrPair& other ); // not supported, use TransferTo()

194 };

195

196

197 /*

198 A dynamic array of Plain Old Data. Doesn't support constructors, etc.

199 Has a small initial memory pool, so that low or no usage will not

200 cause a call to new/delete

201 */

202 template <class T, int INITIAL_SIZE>

203 class DynArray

204 {

205 public:

206DynArray() :

207 _mem( _pool ),

208 _allocated( INITIAL_SIZE ),

209 _size( 0 )

210 {

211 }

212

213~DynArray() {

214if ( _mem != _pool ) {

215delete [] _mem;

216 }

217 }

218

219void Clear() {

220 _size = 0;

221 }

222

223void Push( T t ) {

224TIXMLASSERT( _size < INT_MAX );

225 EnsureCapacity( _size+1 );

226 _mem[_size] = t;

227 ++_size;

228 }

229

230 T* PushArr( int count ) {

231TIXMLASSERT( count >= 0 );

232TIXMLASSERT( _size <= INT_MAX - count );

233 EnsureCapacity( _size+count );

234 T* ret = &_mem[_size];

235 _size += count;

236return ret;

237 }

238

239 T Pop() {

240TIXMLASSERT( _size > 0 );

241 --_size;

242return _mem[_size];

243 }

244

245void PopArr( int count ) {

246TIXMLASSERT( _size >= count );

247 _size -= count;

248 }

249

250bool Empty() const {

251return _size == 0;

252 }

253

254 T& operator[](int i) {

255TIXMLASSERT( i>= 0 && i < _size );

256return _mem[i];

257 }

258

259const T& operator[](int i) const {

260TIXMLASSERT( i>= 0 && i < _size );

261return _mem[i];

262 }

263

264const T& PeekTop() const {

265TIXMLASSERT( _size > 0 );

266return _mem[_size - 1];

267 }

268

269int Size() const {

270TIXMLASSERT( _size >= 0 );

271return _size;

272 }

273

274int Capacity() const {

275TIXMLASSERT( _allocated >= INITIAL_SIZE );

276return _allocated;

277 }

278

279void SwapRemove(int i) {

280TIXMLASSERT(i >= 0 && i < _size);

281TIXMLASSERT(_size > 0);

282 _mem[i] = _mem[_size - 1];

283 --_size;

284 }

285

286const T* Mem() const {

287TIXMLASSERT( _mem );

288return _mem;

289 }

290

291 T* Mem() {

292TIXMLASSERT( _mem );

293return _mem;

294 }

295

296 private:

297DynArray( const DynArray& ); // not supported

298void operator=( const DynArray& ); // not supported

299

300void EnsureCapacity( int cap ) {

301TIXMLASSERT( cap > 0 );

302if ( cap > _allocated ) {

303TIXMLASSERT( cap <= INT_MAX / 2 );

304int newAllocated = cap * 2;

305 T* newMem = new T[newAllocated];

306TIXMLASSERT( newAllocated >= _size );

307 memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs

308if ( _mem != _pool ) {

309delete [] _mem;

310 }

311 _mem = newMem;

312 _allocated = newAllocated;

313 }

314 }

315

316 T* _mem;

317 T _pool[INITIAL_SIZE];

318int _allocated; // objects allocated

319int _size; // number objects in use

320 };

321

322

323 /*

324 Parent virtual class of a pool for fast allocation

325 and deallocation of objects.

326 */

327 class MemPool

328 {

329 public:

330MemPool() {}

331virtual ~MemPool() {}

332

333virtual int ItemSize() const = 0;

334virtual void* Alloc() = 0;

335virtual void Free( void* ) = 0;

336virtual void SetTracked() = 0;

337virtual void Clear() = 0;

338 };

339

340

341 /*

342 Template child class to create pools of the correct type.

343 */

344 template< int ITEM_SIZE >

345 class MemPoolT : public MemPool

346 {

347 public:

348MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {}

349~MemPoolT() {

350Clear();

351 }

352

353void Clear() {

354// Delete the blocks.

355while( !_blockPtrs.Empty()) {

356 Block* lastBlock = _blockPtrs.Pop();

357delete lastBlock;

358 }

359 _root = 0;

360 _currentAllocs = 0;

361 _nAllocs = 0;

362 _maxAllocs = 0;

363 _nUntracked = 0;

364 }

365

366virtual int ItemSize() const {

367return ITEM_SIZE;

368 }

369int CurrentAllocs() const {

370return _currentAllocs;

371 }

372

373virtual void* Alloc() {

374if ( !_root ) {

375// Need a new block.

376 Block* block = new Block();

377 _blockPtrs.Push( block );

378

379 Item* blockItems = block->items;

380for( int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) {

381 blockItems[i].next = &(blockItems[i + 1]);

382 }

383 blockItems[ITEMS_PER_BLOCK - 1].next = 0;

384 _root = blockItems;

385 }

386 Item* const result = _root;

387TIXMLASSERT( result != 0 );

388 _root = _root->next;

389

390 ++_currentAllocs;

391if ( _currentAllocs > _maxAllocs ) {

392 _maxAllocs = _currentAllocs;

393 }

394 ++_nAllocs;

395 ++_nUntracked;

396return result;

397 }

398

399virtual void Free( void* mem ) {

400if ( !mem ) {

401return;

402 }

403 --_currentAllocs;

404 Item* item = static_cast<Item*>( mem );

405 #ifdef TINYXML2_DEBUG

406 memset( item, 0xfe, sizeof( *item ) );

407 #endif

408 item->next = _root;

409 _root = item;

410 }

411void Trace( const char* name ) {

412 printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n",

413 name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs,

414 ITEM_SIZE, _nAllocs, _blockPtrs.Size() );

415 }

416

417void SetTracked() {

418 --_nUntracked;

419 }

420

421int Untracked() const {

422return _nUntracked;

423 }

424

425// This number is perf sensitive. 4k seems like a good tradeoff on my machine.

426// The test file is large, 170k.

427// Release: VS2010 gcc(no opt)

428// 1k: 4000

429// 2k: 4000

430// 4k: 3900 21000

431// 16k: 5200

432// 32k: 4300

433// 64k: 4000 21000

434// Declared public because some compilers do not accept to use ITEMS_PER_BLOCK

435// in private part if ITEMS_PER_BLOCK is private

436enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE };

437

438 private:

439MemPoolT( const MemPoolT& ); // not supported

440void operator=( const MemPoolT& ); // not supported

441

442union Item {

443 Item* next;

444char itemData[ITEM_SIZE];

445 };

446struct Block {

447 Item items[ITEMS_PER_BLOCK];

448 };

449 DynArray< Block*, 10 > _blockPtrs;

450 Item* _root;

451

452int _currentAllocs;

453int _nAllocs;

454int _maxAllocs;

455int _nUntracked;

456 };

457

458

459

479 class TINYXML2_LIB XMLVisitor

480 {

481 public:

482virtual ~XMLVisitor() {}

483

485virtual bool VisitEnter( const XMLDocument& /*doc*/ ) {

486return true;

487 }

489virtual bool VisitExit( const XMLDocument& /*doc*/ ) {

490return true;

491 }

492

494virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) {

495return true;

496 }

498virtual bool VisitExit( const XMLElement& /*element*/ ) {

499return true;

500 }

501

503virtual bool Visit( const XMLDeclaration& /*declaration*/ ) {

504return true;

505 }

507virtual bool Visit( const XMLText& /*text*/ ) {

508return true;

509 }

511virtual bool Visit( const XMLComment& /*comment*/ ) {

512return true;

513 }

515virtual bool Visit( const XMLUnknown& /*unknown*/ ) {

516return true;

517 }

518 };

519

520 // WARNING: must match XMLDocument::_errorNames[]

521 enum XMLError {

522XML_SUCCESS = 0,

523XML_NO_ATTRIBUTE,

524XML_WRONG_ATTRIBUTE_TYPE,

525XML_ERROR_FILE_NOT_FOUND,

526XML_ERROR_FILE_COULD_NOT_BE_OPENED,

527XML_ERROR_FILE_READ_ERROR,

528UNUSED_XML_ERROR_ELEMENT_MISMATCH, // remove at next major version

529XML_ERROR_PARSING_ELEMENT,

530XML_ERROR_PARSING_ATTRIBUTE,

531UNUSED_XML_ERROR_IDENTIFYING_TAG, // remove at next major version

532XML_ERROR_PARSING_TEXT,

533XML_ERROR_PARSING_CDATA,

534XML_ERROR_PARSING_COMMENT,

535XML_ERROR_PARSING_DECLARATION,

536XML_ERROR_PARSING_UNKNOWN,

537XML_ERROR_EMPTY_DOCUMENT,

538XML_ERROR_MISMATCHED_ELEMENT,

539XML_ERROR_PARSING,

540XML_CAN_NOT_CONVERT_TEXT,

541XML_NO_TEXT_NODE,

542XML_ELEMENT_DEPTH_EXCEEDED,

543

544XML_ERROR_COUNT

545 };

546

547

548 /*

549 Utility functionality.

550 */

551 class TINYXML2_LIB XMLUtil

552 {

553 public:

554static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) {

555TIXMLASSERT( p );

556

557while( IsWhiteSpace(*p) ) {

558if (curLineNumPtr && *p == '\n') {

559 ++(*curLineNumPtr);

560 }

561 ++p;

562 }

563TIXMLASSERT( p );

564return p;

565 }

566static char* SkipWhiteSpace( char* p, int* curLineNumPtr ) {

567return const_cast<char*>( SkipWhiteSpace( const_cast<const char*>(p), curLineNumPtr ) );

568 }

569

570// Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't

571// correct, but simple, and usually works.

572static bool IsWhiteSpace( char p ) {

573return !IsUTF8Continuation(p) && isspace( static_cast<unsigned char>(p) );

574 }

575

576inline static bool IsNameStartChar( unsigned char ch ) {

577if ( ch >= 128 ) {

578// This is a heuristic guess in attempt to not implement Unicode-aware isalpha()

579return true;

580 }

581if ( isalpha( ch ) ) {

582return true;

583 }

584return ch == ':' || ch == '_';

585 }

586

587inline static bool IsNameChar( unsigned char ch ) {

588return IsNameStartChar( ch )

589 || isdigit( ch )

590 || ch == '.'

591 || ch == '-';

592 }

593

594inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) {

595if ( p == q ) {

596return true;

597 }

598TIXMLASSERT( p );

599TIXMLASSERT( q );

600TIXMLASSERT( nChar >= 0 );

601return strncmp( p, q, nChar ) == 0;

602 }

603

604inline static bool IsUTF8Continuation( char p ) {

605return ( p & 0x80 ) != 0;

606 }

607

608static const char* ReadBOM( const char* p, bool* hasBOM );

609// p is the starting location,

610// the UTF-8 value of the entity will be placed in value, and length filled in.

611static const char* GetCharacterRef( const char* p, char* value, int* length );

612static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length );

613

614// converts primitive types to strings

615static void ToStr( int v, char* buffer, int bufferSize );

616static void ToStr( unsigned v, char* buffer, int bufferSize );

617static void ToStr( bool v, char* buffer, int bufferSize );

618static void ToStr( float v, char* buffer, int bufferSize );

619static void ToStr( double v, char* buffer, int bufferSize );

620static void ToStr(int64_t v, char* buffer, int bufferSize);

621

622// converts strings to primitive types

623static bool ToInt( const char* str, int* value );

624static bool ToUnsigned( const char* str, unsigned* value );

625static bool ToBool( const char* str, bool* value );

626static bool ToFloat( const char* str, float* value );

627static bool ToDouble( const char* str, double* value );

628static bool ToInt64(const char* str, int64_t* value);

629

630// Changes what is serialized for a boolean value.

631// Default to "true" and "false". Shouldn't be changed

632// unless you have a special testing or compatibility need.

633// Be careful: static, global, & not thread safe.

634// Be sure to set static const memory as parameters.

635static void SetBoolSerialization(const char* writeTrue, const char* writeFalse);

636

637 private:

638static const char* writeBoolTrue;

639static const char* writeBoolFalse;

640 };

641

642

668 class TINYXML2_LIB XMLNode

669 {

670friend class XMLDocument;

671friend class XMLElement;

672 public:

673

675const XMLDocument* GetDocument() const {

676TIXMLASSERT( _document );

677return _document;

678 }

680XMLDocument* GetDocument() {

681TIXMLASSERT( _document );

682return _document;

683 }

684

686virtual XMLElement* ToElement() {

687return 0;

688 }

690virtual XMLText* ToText() {

691return 0;

692 }

694virtual XMLComment* ToComment() {

695return 0;

696 }

698virtual XMLDocument* ToDocument() {

699return 0;

700 }

702virtual XMLDeclaration* ToDeclaration() {

703return 0;

704 }

706virtual XMLUnknown* ToUnknown() {

707return 0;

708 }

709

710virtual const XMLElement* ToElement() const {

711return 0;

712 }

713virtual const XMLText* ToText() const {

714return 0;

715 }

716virtual const XMLComment* ToComment() const {

717return 0;

718 }

719virtual const XMLDocument* ToDocument() const {

720return 0;

721 }

722virtual const XMLDeclaration* ToDeclaration() const {

723return 0;

724 }

725virtual const XMLUnknown* ToUnknown() const {

726return 0;

727 }

728

738const char* Value() const;

739

743void SetValue( const char* val, bool staticMem=false );

744

746int GetLineNum() const { return _parseLineNum; }

747

749const XMLNode* Parent() const {

750return _parent;

751 }

752

753XMLNode* Parent() {

754return _parent;

755 }

756

758bool NoChildren() const {

759return !_firstChild;

760 }

761

763const XMLNode* FirstChild() const {

764return _firstChild;

765 }

766

767XMLNode* FirstChild() {

768return _firstChild;

769 }

770

774const XMLElement* FirstChildElement( const char* name = 0 ) const;

775

776XMLElement* FirstChildElement( const char* name = 0 ) {

777return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->FirstChildElement( name ));

778 }

779

781const XMLNode* LastChild() const {

782return _lastChild;

783 }

784

785XMLNode* LastChild() {

786return _lastChild;

787 }

788

792const XMLElement* LastChildElement( const char* name = 0 ) const;

793

794XMLElement* LastChildElement( const char* name = 0 ) {

795return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->LastChildElement(name) );

796 }

797

799const XMLNode* PreviousSibling() const {

800return _prev;

801 }

802

803XMLNode* PreviousSibling() {

804return _prev;

805 }

806

808const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ;

809

810XMLElement* PreviousSiblingElement( const char* name = 0 ) {

811return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->PreviousSiblingElement( name ) );

812 }

813

815const XMLNode* NextSibling() const {

816return _next;

817 }

818

819XMLNode* NextSibling() {

820return _next;

821 }

822

824const XMLElement* NextSiblingElement( const char* name = 0 ) const;

825

826XMLElement* NextSiblingElement( const char* name = 0 ) {

827return const_cast<XMLElement*>(const_cast<const XMLNode*>(this)->NextSiblingElement( name ) );

828 }

829

837XMLNode* InsertEndChild( XMLNode* addThis );

838

839XMLNode* LinkEndChild( XMLNode* addThis ) {

840return InsertEndChild( addThis );

841 }

849XMLNode* InsertFirstChild( XMLNode* addThis );

858XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis );

859

863void DeleteChildren();

864

868void DeleteChild( XMLNode* node );

869

879virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0;

880

894XMLNode* DeepClone( XMLDocument* target ) const;

895

902virtual bool ShallowEqual( const XMLNode* compare ) const = 0;

903

926virtual bool Accept( XMLVisitor* visitor ) const = 0;

927

933void SetUserData(void* userData) { _userData = userData; }

934

940void* GetUserData() const { return _userData; }

941

942 protected:

943XMLNode( XMLDocument* );

944virtual ~XMLNode();

945

946virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr);

947

948XMLDocument* _document;

949XMLNode* _parent;

950mutable StrPair_value;

951int_parseLineNum;

952

953XMLNode* _firstChild;

954XMLNode* _lastChild;

955

956XMLNode* _prev;

957XMLNode* _next;

958

959void* _userData;

960

961 private:

962MemPool* _memPool;

963void Unlink( XMLNode* child );

964static void DeleteNode( XMLNode* node );

965void InsertChildPreamble( XMLNode* insertThis ) const;

966const XMLElement* ToElementWithName( const char* name ) const;

967

968XMLNode( const XMLNode& ); // not supported

969XMLNode& operator=( const XMLNode& ); // not supported

970 };

971

972

985 class TINYXML2_LIB XMLText : public XMLNode

986 {

987friend class XMLDocument;

988 public:

989virtual bool Accept( XMLVisitor* visitor ) const;

990

991virtual XMLText* ToText() {

992return this;

993 }

994virtual const XMLText* ToText() const {

995return this;

996 }

997

999void SetCData( bool isCData ) {

1000 _isCData = isCData;

1001 }

1003bool CData() const {

1004return _isCData;

1005 }

1006

1007virtual XMLNode* ShallowClone( XMLDocument* document ) const;

1008virtual bool ShallowEqual( const XMLNode* compare ) const;

1009

1010 protected:

1011XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {}

1012virtual ~XMLText() {}

1013

1014char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );

1015

1016 private:

1017bool _isCData;

1018

1019XMLText( const XMLText& ); // not supported

1020XMLText& operator=( const XMLText& ); // not supported

1021 };

1022

1023

1025 class TINYXML2_LIB XMLComment : public XMLNode

1026 {

1027friend class XMLDocument;

1028 public:

1029virtual XMLComment* ToComment() {

1030return this;

1031 }

1032virtual const XMLComment* ToComment() const {

1033return this;

1034 }

1035

1036virtual bool Accept( XMLVisitor* visitor ) const;

1037

1038virtual XMLNode* ShallowClone( XMLDocument* document ) const;

1039virtual bool ShallowEqual( const XMLNode* compare ) const;

1040

1041 protected:

1042XMLComment( XMLDocument* doc );

1043virtual ~XMLComment();

1044

1045char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr);

1046

1047 private:

1048XMLComment( const XMLComment& ); // not supported

1049XMLComment& operator=( const XMLComment& ); // not supported

1050 };

1051

1052

1064 class TINYXML2_LIB XMLDeclaration : public XMLNode

1065 {

1066friend class XMLDocument;

1067 public:

1068virtual XMLDeclaration* ToDeclaration() {

1069return this;

1070 }

1071virtual const XMLDeclaration* ToDeclaration() const {

1072return this;

1073 }

1074

1075virtual bool Accept( XMLVisitor* visitor ) const;

1076

1077virtual XMLNode* ShallowClone( XMLDocument* document ) const;

1078virtual bool ShallowEqual( const XMLNode* compare ) const;

1079

1080 protected:

1081XMLDeclaration( XMLDocument* doc );

1082virtual ~XMLDeclaration();

1083

1084char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );

1085

1086 private:

1087XMLDeclaration( const XMLDeclaration& ); // not supported

1088XMLDeclaration& operator=( const XMLDeclaration& ); // not supported

1089 };

1090

1091

1099 class TINYXML2_LIB XMLUnknown : public XMLNode

1100 {

1101friend class XMLDocument;

1102 public:

1103virtual XMLUnknown* ToUnknown() {

1104return this;

1105 }

1106virtual const XMLUnknown* ToUnknown() const {

1107return this;

1108 }

1109

1110virtual bool Accept( XMLVisitor* visitor ) const;

1111

1112virtual XMLNode* ShallowClone( XMLDocument* document ) const;

1113virtual bool ShallowEqual( const XMLNode* compare ) const;

1114

1115 protected:

1116XMLUnknown( XMLDocument* doc );

1117virtual ~XMLUnknown();

1118

1119char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );

1120

1121 private:

1122XMLUnknown( const XMLUnknown& ); // not supported

1123XMLUnknown& operator=( const XMLUnknown& ); // not supported

1124 };

1125

1126

1127

1134 class TINYXML2_LIB XMLAttribute

1135 {

1136friend class XMLElement;

1137 public:

1139const char* Name() const;

1140

1142const char* Value() const;

1143

1145int GetLineNum() const { return _parseLineNum; }

1146

1148const XMLAttribute* Next() const {

1149return _next;

1150 }

1151

1156intIntValue() const {

1157int i = 0;

1158 QueryIntValue(&i);

1159return i;

1160 }

1161

1162 int64_t Int64Value() const {

1163 int64_t i = 0;

1164 QueryInt64Value(&i);

1165return i;

1166 }

1167

1169unsigned UnsignedValue() const {

1170unsigned i=0;

1171 QueryUnsignedValue( &i );

1172return i;

1173 }

1175boolBoolValue() const {

1176bool b=false;

1177 QueryBoolValue( &b );

1178return b;

1179 }

1181doubleDoubleValue() const {

1182double d=0;

1183 QueryDoubleValue( &d );

1184return d;

1185 }

1187floatFloatValue() const {

1188float f=0;

1189 QueryFloatValue( &f );

1190return f;

1191 }

1192

1197XMLError QueryIntValue( int* value ) const;

1199XMLError QueryUnsignedValue( unsigned int* value ) const;

1201XMLError QueryInt64Value(int64_t* value) const;

1203XMLError QueryBoolValue( bool* value ) const;

1205XMLError QueryDoubleValue( double* value ) const;

1207XMLError QueryFloatValue( float* value ) const;

1208

1210void SetAttribute( const char* value );

1212void SetAttribute( int value );

1214void SetAttribute( unsigned value );

1216void SetAttribute(int64_t value);

1218void SetAttribute( bool value );

1220void SetAttribute( double value );

1222void SetAttribute( float value );

1223

1224 private:

1225enum { BUF_SIZE = 200 };

1226

1227 XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {}

1228virtual ~XMLAttribute() {}

1229

1230 XMLAttribute( const XMLAttribute& ); // not supported

1231void operator=( const XMLAttribute& ); // not supported

1232void SetName( const char* name );

1233

1234char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr );

1235

1236mutable StrPair _name;

1237mutable StrPair _value;

1238int _parseLineNum;

1239 XMLAttribute* _next;

1240 MemPool* _memPool;

1241 };

1242

1243

1248 class TINYXML2_LIB XMLElement : public XMLNode

1249 {

1250friend class XMLDocument;

1251 public:

1253const char* Name() const {

1254return Value();

1255 }

1257void SetName( const char* str, bool staticMem=false ) {

1258 SetValue( str, staticMem );

1259 }

1260

1261virtual XMLElement* ToElement() {

1262return this;

1263 }

1264virtual const XMLElement* ToElement() const {

1265return this;

1266 }

1267virtual bool Accept( XMLVisitor* visitor ) const;

1268

1292const char* Attribute( const char* name, const char* value=0 ) const;

1293

1300int IntAttribute(const char* name, int defaultValue = 0) const;

1302unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const;

1304 int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const;

1306bool BoolAttribute(const char* name, bool defaultValue = false) const;

1308double DoubleAttribute(const char* name, double defaultValue = 0) const;

1310float FloatAttribute(const char* name, float defaultValue = 0) const;

1311

1325XMLError QueryIntAttribute( const char* name, int* value ) const {

1326const XMLAttribute* a = FindAttribute( name );

1327if ( !a ) {

1328return XML_NO_ATTRIBUTE;

1329 }

1330return a->QueryIntValue( value );

1331 }

1332

1334XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const {

1335const XMLAttribute* a = FindAttribute( name );

1336if ( !a ) {

1337return XML_NO_ATTRIBUTE;

1338 }

1339return a->QueryUnsignedValue( value );

1340 }

1341

1343XMLError QueryInt64Attribute(const char* name, int64_t* value) const {

1344const XMLAttribute* a = FindAttribute(name);

1345if (!a) {

1346return XML_NO_ATTRIBUTE;

1347 }

1348return a->QueryInt64Value(value);

1349 }

1350

1352XMLError QueryBoolAttribute( const char* name, bool* value ) const {

1353const XMLAttribute* a = FindAttribute( name );

1354if ( !a ) {

1355return XML_NO_ATTRIBUTE;

1356 }

1357return a->QueryBoolValue( value );

1358 }

1360XMLError QueryDoubleAttribute( const char* name, double* value ) const {

1361const XMLAttribute* a = FindAttribute( name );

1362if ( !a ) {

1363return XML_NO_ATTRIBUTE;

1364 }

1365return a->QueryDoubleValue( value );

1366 }

1368XMLError QueryFloatAttribute( const char* name, float* value ) const {

1369const XMLAttribute* a = FindAttribute( name );

1370if ( !a ) {

1371return XML_NO_ATTRIBUTE;

1372 }

1373return a->QueryFloatValue( value );

1374 }

1375

1377XMLError QueryStringAttribute(const char* name, const char** value) const {

1378const XMLAttribute* a = FindAttribute(name);

1379if (!a) {

1380return XML_NO_ATTRIBUTE;

1381 }

1382 *value = a->Value();

1383return XML_SUCCESS;

1384 }

1385

1386

1387

1405int QueryAttribute( const char* name, int* value ) const {

1406return QueryIntAttribute( name, value );

1407 }

1408

1409int QueryAttribute( const char* name, unsigned int* value ) const {

1410return QueryUnsignedAttribute( name, value );

1411 }

1412

1413int QueryAttribute(const char* name, int64_t* value) const {

1414return QueryInt64Attribute(name, value);

1415 }

1416

1417int QueryAttribute( const char* name, bool* value ) const {

1418return QueryBoolAttribute( name, value );

1419 }

1420

1421int QueryAttribute( const char* name, double* value ) const {

1422return QueryDoubleAttribute( name, value );

1423 }

1424

1425int QueryAttribute( const char* name, float* value ) const {

1426return QueryFloatAttribute( name, value );

1427 }

1428

1430void SetAttribute( const char* name, const char* value ) {

1431XMLAttribute* a = FindOrCreateAttribute( name );

1432 a->SetAttribute( value );

1433 }

1435void SetAttribute( const char* name, int value ) {

1436XMLAttribute* a = FindOrCreateAttribute( name );

1437 a->SetAttribute( value );

1438 }

1440void SetAttribute( const char* name, unsigned value ) {

1441XMLAttribute* a = FindOrCreateAttribute( name );

1442 a->SetAttribute( value );

1443 }

1444

1446void SetAttribute(const char* name, int64_t value) {

1447XMLAttribute* a = FindOrCreateAttribute(name);

1448 a->SetAttribute(value);

1449 }

1450

1452void SetAttribute( const char* name, bool value ) {

1453XMLAttribute* a = FindOrCreateAttribute( name );

1454 a->SetAttribute( value );

1455 }

1457void SetAttribute( const char* name, double value ) {

1458XMLAttribute* a = FindOrCreateAttribute( name );

1459 a->SetAttribute( value );

1460 }

1462void SetAttribute( const char* name, float value ) {

1463XMLAttribute* a = FindOrCreateAttribute( name );

1464 a->SetAttribute( value );

1465 }

1466

1470void DeleteAttribute( const char* name );

1471

1473const XMLAttribute* FirstAttribute() const {

1474return _rootAttribute;

1475 }

1477const XMLAttribute* FindAttribute( const char* name ) const;

1478

1507const char* GetText() const;

1508

1543void SetText( const char* inText );

1545void SetText( int value );

1547void SetText( unsigned value );

1549void SetText(int64_t value);

1551void SetText( bool value );

1553void SetText( double value );

1555void SetText( float value );

1556

1583XMLError QueryIntText( int* ival ) const;

1585XMLError QueryUnsignedText( unsigned* uval ) const;

1587XMLError QueryInt64Text(int64_t* uval) const;

1589XMLError QueryBoolText( bool* bval ) const;

1591XMLError QueryDoubleText( double* dval ) const;

1593XMLError QueryFloatText( float* fval ) const;

1594

1595int IntText(int defaultValue = 0) const;

1596

1598unsigned UnsignedText(unsigned defaultValue = 0) const;

1600 int64_t Int64Text(int64_t defaultValue = 0) const;

1602bool BoolText(bool defaultValue = false) const;

1604double DoubleText(double defaultValue = 0) const;

1606float FloatText(float defaultValue = 0) const;

1607

1608// internal:

1609enum ElementClosingType {

1610OPEN, // <foo>

1611CLOSED, // <foo/>

1612 CLOSING // </foo>

1613 };

1614ElementClosingType ClosingType() const {

1615return _closingType;

1616 }

1617virtual XMLNode* ShallowClone( XMLDocument* document ) const;

1618virtual bool ShallowEqual( const XMLNode* compare ) const;

1619

1620 protected:

1621char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr );

1622

1623 private:

1624XMLElement( XMLDocument* doc );

1625virtual ~XMLElement();

1626XMLElement( const XMLElement& ); // not supported

1627void operator=( const XMLElement& ); // not supported

1628

1629XMLAttribute* FindAttribute( const char* name ) {

1630return const_cast<XMLAttribute*>(const_cast<const XMLElement*>(this)->FindAttribute( name ));

1631 }

1632 XMLAttribute* FindOrCreateAttribute( const char* name );

1633//void LinkAttribute( XMLAttribute* attrib );

1634char* ParseAttributes( char* p, int* curLineNumPtr );

1635static void DeleteAttribute( XMLAttribute* attribute );

1636 XMLAttribute* CreateAttribute();

1637

1638enum { BUF_SIZE = 200 };

1639 ElementClosingType _closingType;

1640// The attribute list is ordered; there is no 'lastAttribute'

1641// because the list needs to be scanned for dupes before adding

1642// a new attribute.

1643 XMLAttribute* _rootAttribute;

1644 };

1645

1646

1647 enum Whitespace {

1648PRESERVE_WHITESPACE,

1649COLLAPSE_WHITESPACE

1650 };

1651

1652

1658 class TINYXML2_LIB XMLDocument : public XMLNode

1659 {

1660friend class XMLElement;

1661// Gives access to SetError and Push/PopDepth, but over-access for everything else.

1662// Wishing C++ had "internal" scope.

1663friend class XMLNode;

1664friend class XMLText;

1665friend class XMLComment;

1666friend class XMLDeclaration;

1667friend class XMLUnknown;

1668 public:

1670XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE );

1671 ~XMLDocument();

1672

1673virtual XMLDocument* ToDocument() {

1674TIXMLASSERT( this == _document );

1675return this;

1676 }

1677virtual const XMLDocument* ToDocument() const {

1678TIXMLASSERT( this == _document );

1679return this;

1680 }

1681

1692XMLError Parse( const char* xml, size_t nBytes=(size_t)(-1) );

1693

1699XMLError LoadFile( const char* filename );

1700

1712XMLError LoadFile( FILE* );

1713

1719XMLError SaveFile( const char* filename, bool compact = false );

1720

1728XMLError SaveFile( FILE* fp, bool compact = false );

1729

1730bool ProcessEntities() const {

1731return _processEntities;

1732 }

1733Whitespace WhitespaceMode() const {

1734return _whitespaceMode;

1735 }

1736

1740bool HasBOM() const {

1741return _writeBOM;

1742 }

1745void SetBOM( bool useBOM ) {

1746 _writeBOM = useBOM;

1747 }

1748

1752XMLElement* RootElement() {

1753return FirstChildElement();

1754 }

1755const XMLElement* RootElement() const {

1756return FirstChildElement();

1757 }

1758

1773void Print( XMLPrinter* streamer=0 ) const;

1774virtual bool Accept( XMLVisitor* visitor ) const;

1775

1781XMLElement* NewElement( const char* name );

1787XMLComment* NewComment( const char* comment );

1793XMLText* NewText( const char* text );

1805XMLDeclaration* NewDeclaration( const char* text=0 );

1811XMLUnknown* NewUnknown( const char* text );

1812

1817void DeleteNode( XMLNode* node );

1818

1819void ClearError() {

1820 SetError(XML_SUCCESS, 0, 0);

1821 }

1822

1824bool Error() const {

1825return _errorID != XML_SUCCESS;

1826 }

1828XMLErrorErrorID() const {

1829return _errorID;

1830 }

1831const char* ErrorName() const;

1832static const char* ErrorIDToName(XMLError errorID);

1833

1837const char* ErrorStr() const;

1838

1840void PrintError() const;

1841

1843int ErrorLineNum() const

1844 {

1845return _errorLineNum;

1846 }

1847

1849void Clear();

1850

1858void DeepCopy(XMLDocument* target) const;

1859

1860// internal

1861char* Identify( char* p, XMLNode** node );

1862

1863// internal

1864void MarkInUse(XMLNode*);

1865

1866virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const {

1867return 0;

1868 }

1869virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const {

1870return false;

1871 }

1872

1873 private:

1874XMLDocument( const XMLDocument& ); // not supported

1875void operator=( const XMLDocument& ); // not supported

1876

1877bool _writeBOM;

1878bool _processEntities;

1879XMLError _errorID;

1880Whitespace _whitespaceMode;

1881mutable StrPair _errorStr;

1882int _errorLineNum;

1883char* _charBuffer;

1884int _parseCurLineNum;

1885int _parsingDepth;

1886// Memory tracking does add some overhead.

1887// However, the code assumes that you don't

1888// have a bunch of unlinked nodes around.

1889// Therefore it takes less memory to track

1890// in the document vs. a linked list in the XMLNode,

1891// and the performance is the same.

1892DynArray<XMLNode*, 10> _unlinked;

1893

1894MemPoolT< sizeof(XMLElement) > _elementPool;

1895MemPoolT< sizeof(XMLAttribute) > _attributePool;

1896MemPoolT< sizeof(XMLText) > _textPool;

1897MemPoolT< sizeof(XMLComment) > _commentPool;

1898

1899static const char* _errorNames[XML_ERROR_COUNT];

1900

1901void Parse();

1902

1903void SetError( XMLError error, int lineNum, const char* format, ... );

1904

1905// Something of an obvious security hole, once it was discovered.

1906// Either an ill-formed XML or an excessively deep one can overflow

1907// the stack. Track stack depth, and error out if needed.

1908class DepthTracker {

1909public:

1910 DepthTracker(XMLDocument * document) {

1911 this->_document = document;

1912 document->PushDepth();

1913 }

1914 ~DepthTracker() {

1915 _document->PopDepth();

1916 }

1917private:

1918 XMLDocument * _document;

1919 };

1920void PushDepth();

1921void PopDepth();

1922

1923template<class NodeType, int PoolElementSize>

1924 NodeType* CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool );

1925 };

1926

1927 template<class NodeType, int PoolElementSize>

1928 inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT<PoolElementSize>& pool )

1929 {

1930TIXMLASSERT( sizeof( NodeType ) == PoolElementSize );

1931TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() );

1932 NodeType* returnNode = new (pool.Alloc()) NodeType( this );

1933TIXMLASSERT( returnNode );

1934 returnNode->_memPool = &pool;

1935

1936 _unlinked.Push(returnNode);

1937return returnNode;

1938 }

1939

1995 class TINYXML2_LIB XMLHandle

1996 {

1997 public:

1999XMLHandle( XMLNode* node ) : _node( node ) {

2000 }

2002XMLHandle( XMLNode& node ) : _node( &node ) {

2003 }

2005XMLHandle( const XMLHandle& ref ) : _node( ref._node ) {

2006 }

2008XMLHandle& operator=( const XMLHandle& ref ) {

2009 _node = ref._node;

2010return *this;

2011 }

2012

2014XMLHandle FirstChild() {

2015return XMLHandle( _node ? _node->FirstChild() : 0 );

2016 }

2018XMLHandle FirstChildElement( const char* name = 0 ) {

2019return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );

2020 }

2022XMLHandle LastChild() {

2023return XMLHandle( _node ? _node->LastChild() : 0 );

2024 }

2026XMLHandle LastChildElement( const char* name = 0 ) {

2027return XMLHandle( _node ? _node->LastChildElement( name ) : 0 );

2028 }

2030XMLHandle PreviousSibling() {

2031return XMLHandle( _node ? _node->PreviousSibling() : 0 );

2032 }

2034XMLHandle PreviousSiblingElement( const char* name = 0 ) {

2035return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );

2036 }

2038XMLHandle NextSibling() {

2039return XMLHandle( _node ? _node->NextSibling() : 0 );

2040 }

2042XMLHandle NextSiblingElement( const char* name = 0 ) {

2043return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 );

2044 }

2045

2047XMLNode* ToNode() {

2048return _node;

2049 }

2051XMLElement* ToElement() {

2052return ( _node ? _node->ToElement() : 0 );

2053 }

2055XMLText* ToText() {

2056return ( _node ? _node->ToText() : 0 );

2057 }

2059XMLUnknown* ToUnknown() {

2060return ( _node ? _node->ToUnknown() : 0 );

2061 }

2063XMLDeclaration* ToDeclaration() {

2064return ( _node ? _node->ToDeclaration() : 0 );

2065 }

2066

2067 private:

2068XMLNode* _node;

2069 };

2070

2071

2076 class TINYXML2_LIB XMLConstHandle

2077 {

2078 public:

2079XMLConstHandle( const XMLNode* node ) : _node( node ) {

2080 }

2081XMLConstHandle( const XMLNode& node ) : _node( &node ) {

2082 }

2083XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) {

2084 }

2085

2086XMLConstHandle& operator=( const XMLConstHandle& ref ) {

2087 _node = ref._node;

2088return *this;

2089 }

2090

2091const XMLConstHandle FirstChild() const {

2092return XMLConstHandle( _node ? _node->FirstChild() : 0 );

2093 }

2094const XMLConstHandle FirstChildElement( const char* name = 0 ) const {

2095return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );

2096 }

2097const XMLConstHandle LastChild() const {

2098return XMLConstHandle( _node ? _node->LastChild() : 0 );

2099 }

2100const XMLConstHandle LastChildElement( const char* name = 0 ) const {

2101return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 );

2102 }

2103const XMLConstHandle PreviousSibling() const {

2104return XMLConstHandle( _node ? _node->PreviousSibling() : 0 );

2105 }

2106const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const {

2107return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 );

2108 }

2109const XMLConstHandle NextSibling() const {

2110return XMLConstHandle( _node ? _node->NextSibling() : 0 );

2111 }

2112const XMLConstHandle NextSiblingElement( const char* name = 0 ) const {

2113return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 );

2114 }

2115

2116

2117const XMLNode* ToNode() const {

2118return _node;

2119 }

2120const XMLElement* ToElement() const {

2121return ( _node ? _node->ToElement() : 0 );

2122 }

2123const XMLText* ToText() const {

2124return ( _node ? _node->ToText() : 0 );

2125 }

2126const XMLUnknown* ToUnknown() const {

2127return ( _node ? _node->ToUnknown() : 0 );

2128 }

2129const XMLDeclaration* ToDeclaration() const {

2130return ( _node ? _node->ToDeclaration() : 0 );

2131 }

2132

2133 private:

2134const XMLNode* _node;

2135 };

2136

2137

2180 class TINYXML2_LIB XMLPrinter : public XMLVisitor

2181 {

2182 public:

2189XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 );

2190virtual ~XMLPrinter() {}

2191

2193void PushHeader( bool writeBOM, bool writeDeclaration );

2197void OpenElement( const char* name, bool compactMode=false );

2199void PushAttribute( const char* name, const char* value );

2200void PushAttribute( const char* name, int value );

2201void PushAttribute( const char* name, unsigned value );

2202void PushAttribute(const char* name, int64_t value);

2203void PushAttribute( const char* name, bool value );

2204void PushAttribute( const char* name, double value );

2206virtual void CloseElement( bool compactMode=false );

2207

2209void PushText( const char* text, bool cdata=false );

2211void PushText( int value );

2213void PushText( unsigned value );

2215void PushText(int64_t value);

2217void PushText( bool value );

2219void PushText( float value );

2221void PushText( double value );

2222

2224void PushComment( const char* comment );

2225

2226void PushDeclaration( const char* value );

2227void PushUnknown( const char* value );

2228

2229virtual bool VisitEnter( const XMLDocument& /*doc*/ );

2230virtual bool VisitExit( const XMLDocument& /*doc*/ ) {

2231return true;

2232 }

2233

2234virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute );

2235virtual bool VisitExit( const XMLElement& element );

2236

2237virtual bool Visit( const XMLText& text );

2238virtual bool Visit( const XMLComment& comment );

2239virtual bool Visit( const XMLDeclaration& declaration );

2240virtual bool Visit( const XMLUnknown& unknown );

2241

2246const char* CStr() const {

2247return _buffer.Mem();

2248 }

2254int CStrSize() const {

2255return _buffer.Size();

2256 }

2261void ClearBuffer() {

2262 _buffer.Clear();

2263 _buffer.Push(0);

2264 _firstElement = true;

2265 }

2266

2267 protected:

2268virtual bool CompactMode( const XMLElement& ) { return _compactMode; }

2269

2273virtual void PrintSpace( int depth );

2274void Print( const char* format, ... );

2275void Write( const char* data, size_t size );

2276inline void Write( const char* data ) { Write( data, strlen( data ) ); }

2277void Putc( char ch );

2278

2279void SealElementIfJustOpened();

2280bool _elementJustOpened;

2281DynArray< const char*, 10 > _stack;

2282

2283 private:

2284void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities.

2285

2286bool _firstElement;

2287 FILE* _fp;

2288int _depth;

2289int _textDepth;

2290bool _processEntities;

2291bool _compactMode;

2292

2293enum {

2294 ENTITY_RANGE = 64,

2295 BUF_SIZE = 200

2296 };

2297bool _entityFlag[ENTITY_RANGE];

2298bool _restrictedEntityFlag[ENTITY_RANGE];

2299

2300DynArray< char, 20 > _buffer;

2301

2302// Prohibit cloning, intentionally not implemented

2303XMLPrinter( const XMLPrinter& );

2304XMLPrinter& operator=( const XMLPrinter& );

2305 };

2306

2307

2308 } // tinyxml2

2309

2310 #if defined(_MSC_VER)

2311 # pragma warning(pop)

2312 #endif

2313

2314 #endif // TINYXML2_INCLUDED

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, int *value) const

Given an attribute name, QueryAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conver...

Definition: xml.h:1405

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, int64_t *value) const

Definition: xml.h:1413

tinyxml2::MemPool::SetTracked

virtual void SetTracked()=0

tinyxml2::XMLDocument::ToDocument

virtual const XMLDocument * ToDocument() const

Definition: xml.h:1677

tinyxml2::StrPair::TEXT_ELEMENT_LEAVE_ENTITIES

@ TEXT_ELEMENT_LEAVE_ENTITIES

Definition: xml.h:142

tinyxml2::XMLUtil::SkipWhiteSpace

static char * SkipWhiteSpace(char *p, int *curLineNumPtr)

Definition: xml.h:566

tinyxml2::XMLDocument::HasBOM

bool HasBOM() const

Returns true if this document has a leading Byte Order Mark of UTF8.

Definition: xml.h:1740

tinyxml2::XMLDocument::ClearError

void ClearError()

Definition: xml.h:1819

tinyxml2::XMLAttribute::UnsignedValue

unsigned UnsignedValue() const

Query as an unsigned integer. See IntValue()

Definition: xml.h:1169

tinyxml2::XMLConstHandle::ToText

const XMLText * ToText() const

Definition: xml.h:2123

tinyxml2::XMLNode::ToText

virtual const XMLText * ToText() const

Definition: xml.h:713

tinyxml2::XMLUtil::IsUTF8Continuation

static bool IsUTF8Continuation(char p)

Definition: xml.h:604

tinyxml2::StrPair::ATTRIBUTE_NAME

@ ATTRIBUTE_NAME

Definition: xml.h:143

tinyxml2::XMLDocument::Error

bool Error() const

Return true if there was an error parsing the document.

Definition: xml.h:1824

tinyxml2::XMLVisitor::Visit

virtual bool Visit(const XMLComment &)

Visit a comment node.

Definition: xml.h:511

tinyxml2::XML_NO_TEXT_NODE

@ XML_NO_TEXT_NODE

Definition: xml.h:541

tinyxml2::XMLUtil

Definition: xml.h:551

tinyxml2::StrPair::Empty

bool Empty() const

Definition: xml.h:163

tinyxml2::XMLDocument::ErrorLineNum

int ErrorLineNum() const

Return the line where the error occured, or zero if unknown.

Definition: xml.h:1843

tinyxml2::MemPoolT::ITEMS_PER_BLOCK

@ ITEMS_PER_BLOCK

Definition: xml.h:436

tinyxml2::DynArray::Mem

T * Mem()

Definition: xml.h:291

tinyxml2::XMLText::CData

bool CData() const

Returns true if this is a CDATA text element.

Definition: xml.h:1003

tinyxml2::XMLNode::_lastChild

XMLNode * _lastChild

Definition: xml.h:954

tinyxml2::XMLNode::ToDeclaration

virtual XMLDeclaration * ToDeclaration()

Safely cast to a Declaration, or null.

Definition: xml.h:702

tinyxml2::XMLElement::ToElement

virtual XMLElement * ToElement()

Safely cast to an Element, or null.

Definition: xml.h:1261

tinyxml2::DynArray::~DynArray

~DynArray()

Definition: xml.h:213

tinyxml2::COLLAPSE_WHITESPACE

@ COLLAPSE_WHITESPACE

Definition: xml.h:1649

tinyxml2::XMLPrinter::_stack

DynArray< const char *, 10 > _stack

Definition: xml.h:2281

tinyxml2::XMLNode::NextSibling

XMLNode * NextSibling()

Definition: xml.h:819

TINYXML2_LIB

#define TINYXML2_LIB

Definition: xml.h:78

tinyxml2::XMLConstHandle::ToNode

const XMLNode * ToNode() const

Definition: xml.h:2117

tinyxml2::XMLAttribute::SetAttribute

void SetAttribute(const char *value)

Set the attribute to a string value.

tinyxml2::XMLHandle::XMLHandle

XMLHandle(const XMLHandle &ref)

Copy constructor.

Definition: xml.h:2005

tinyxml2::XMLComment

An XML Comment.

Definition: xml.h:1025

tinyxml2::XMLVisitor::VisitExit

virtual bool VisitExit(const XMLDocument &)

Visit a document.

Definition: xml.h:489

tinyxml2::MemPool

Definition: xml.h:327

tinyxml2::DynArray::DynArray

DynArray()

Definition: xml.h:206

tinyxml2::MemPoolT::Trace

void Trace(const char *name)

Definition: xml.h:411

tinyxml2::XMLHandle::PreviousSiblingElement

XMLHandle PreviousSiblingElement(const char *name=0)

Get the previous sibling element of this handle.

Definition: xml.h:2034

tinyxml2::XML_ERROR_PARSING_UNKNOWN

@ XML_ERROR_PARSING_UNKNOWN

Definition: xml.h:536

tinyxml2::StrPair::Reset

void Reset()

tinyxml2::MemPoolT::Free

virtual void Free(void *mem)

Definition: xml.h:399

tinyxml2::XMLError

XMLError

Definition: xml.h:521

tinyxml2::XMLElement::QueryBoolAttribute

XMLError QueryBoolAttribute(const char *name, bool *value) const

See QueryIntAttribute()

Definition: xml.h:1352

tinyxml2::XMLVisitor::~XMLVisitor

virtual ~XMLVisitor()

Definition: xml.h:482

tinyxml2::XMLNode::_parent

XMLNode * _parent

Definition: xml.h:949

tinyxml2::XMLNode::NoChildren

bool NoChildren() const

Returns true if this node has no children.

Definition: xml.h:758

tinyxml2::MemPoolT::~MemPoolT

~MemPoolT()

Definition: xml.h:349

tinyxml2::XMLElement::QueryStringAttribute

XMLError QueryStringAttribute(const char *name, const char **value) const

See QueryIntAttribute()

Definition: xml.h:1377

tinyxml2::XMLElement::SetName

void SetName(const char *str, bool staticMem=false)

Set the name of the element.

Definition: xml.h:1257

tinyxml2::XML_ERROR_FILE_NOT_FOUND

@ XML_ERROR_FILE_NOT_FOUND

Definition: xml.h:525

tinyxml2::XMLDocument::ShallowClone

virtual XMLNode * ShallowClone(XMLDocument *) const

Make a copy of this node, but not its children.

Definition: xml.h:1866

tinyxml2::XMLNode::ToElement

virtual const XMLElement * ToElement() const

Definition: xml.h:710

tinyxml2::XMLPrinter

Printing functionality.

Definition: xml.h:2180

tinyxml2::XML_ERROR_FILE_COULD_NOT_BE_OPENED

@ XML_ERROR_FILE_COULD_NOT_BE_OPENED

Definition: xml.h:526

tinyxml2::XML_WRONG_ATTRIBUTE_TYPE

@ XML_WRONG_ATTRIBUTE_TYPE

Definition: xml.h:524

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, const char *value)

Sets the named attribute to value.

Definition: xml.h:1430

tinyxml2::DynArray::Mem

const T * Mem() const

Definition: xml.h:286

tinyxml2::MemPool::ItemSize

virtual int ItemSize() const =0

tinyxml2::XMLHandle

A XMLHandle is a class that wraps a node pointer with null checks; this is an incredibly useful thing...

Definition: xml.h:1995

tinyxml2::StrPair::NEEDS_WHITESPACE_COLLAPSING

@ NEEDS_WHITESPACE_COLLAPSING

Definition: xml.h:139

tinyxml2::DynArray::PeekTop

const T & PeekTop() const

Definition: xml.h:264

tinyxml2::XMLVisitor::Visit

virtual bool Visit(const XMLUnknown &)

Visit an unknown node.

Definition: xml.h:515

tinyxml2::XMLAttribute::Value

const char * Value() const

The value of the attribute.

tinyxml2::XMLAttribute::DoubleValue

double DoubleValue() const

Query as a double. See IntValue()

Definition: xml.h:1181

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, unsigned int *value) const

Definition: xml.h:1409

tinyxml2::XML_ERROR_PARSING_DECLARATION

@ XML_ERROR_PARSING_DECLARATION

Definition: xml.h:535

tinyxml2::XML_ERROR_FILE_READ_ERROR

@ XML_ERROR_FILE_READ_ERROR

Definition: xml.h:527

tinyxml2::XMLNode::_prev

XMLNode * _prev

Definition: xml.h:956

tinyxml2::StrPair::TEXT_ELEMENT

@ TEXT_ELEMENT

Definition: xml.h:141

tinyxml2::XMLUnknown::ToUnknown

virtual const XMLUnknown * ToUnknown() const

Definition: xml.h:1106

tinyxml2::XML_ERROR_PARSING_ELEMENT

@ XML_ERROR_PARSING_ELEMENT

Definition: xml.h:529

tinyxml2::XMLDocument::ErrorID

XMLError ErrorID() const

Return the errorID.

Definition: xml.h:1828

TIXMLASSERT

#define TIXMLASSERT(x)

Definition: xml.h:94

tinyxml2::XMLHandle::XMLHandle

XMLHandle(XMLNode &node)

Create a handle from a node.

Definition: xml.h:2002

tinyxml2::XMLVisitor::VisitEnter

virtual bool VisitEnter(const XMLElement &, const XMLAttribute *)

Visit an element.

Definition: xml.h:494

tinyxml2::StrPair::GetStr

const char * GetStr()

tinyxml2::DynArray::PopArr

void PopArr(int count)

Definition: xml.h:245

tinyxml2::XMLVisitor

Implements the interface to the "Visitor pattern" (see the Accept() method.) If you call the Accept()...

Definition: xml.h:479

tinyxml2::XMLNode::FirstChildElement

XMLElement * FirstChildElement(const char *name=0)

Definition: xml.h:776

tinyxml2::XMLElement::QueryInt64Attribute

XMLError QueryInt64Attribute(const char *name, int64_t *value) const

See QueryIntAttribute()

Definition: xml.h:1343

tinyxml2::XMLConstHandle::ToDeclaration

const XMLDeclaration * ToDeclaration() const

Definition: xml.h:2129

tinyxml2::XML_ERROR_PARSING_TEXT

@ XML_ERROR_PARSING_TEXT

Definition: xml.h:532

tinyxml2::StrPair::ParseText

char * ParseText(char *in, const char *endTag, int strFlags, int *curLineNumPtr)

tinyxml2::XMLDocument::WhitespaceMode

Whitespace WhitespaceMode() const

Definition: xml.h:1733

tinyxml2::XMLPrinter::VisitExit

virtual bool VisitExit(const XMLDocument &)

Visit a document.

Definition: xml.h:2230

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, double value)

Sets the named attribute to value.

Definition: xml.h:1457

tinyxml2::StrPair::ParseName

char * ParseName(char *in)

tinyxml2::XMLUnknown::ToUnknown

virtual XMLUnknown * ToUnknown()

Safely cast to an Unknown, or null.

Definition: xml.h:1103

tinyxml2::XMLNode::ToComment

virtual const XMLComment * ToComment() const

Definition: xml.h:716

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, bool *value) const

Definition: xml.h:1417

tinyxml2::XMLVisitor::VisitExit

virtual bool VisitExit(const XMLElement &)

Visit an element.

Definition: xml.h:498

tinyxml2::XMLNode::NextSibling

const XMLNode * NextSibling() const

Get the next (right) sibling node of this node.

Definition: xml.h:815

tinyxml2::XMLConstHandle::ToElement

const XMLElement * ToElement() const

Definition: xml.h:2120

tinyxml2::XMLText::~XMLText

virtual ~XMLText()

Definition: xml.h:1012

tinyxml2::UNUSED_XML_ERROR_ELEMENT_MISMATCH

@ UNUSED_XML_ERROR_ELEMENT_MISMATCH

Definition: xml.h:528

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, double *value) const

Definition: xml.h:1421

tinyxml2::XMLNode::GetDocument

const XMLDocument * GetDocument() const

Get the XMLDocument that owns this XMLNode.

Definition: xml.h:675

tinyxml2::XML_ERROR_PARSING_COMMENT

@ XML_ERROR_PARSING_COMMENT

Definition: xml.h:534

tinyxml2::XMLHandle::operator=

XMLHandle & operator=(const XMLHandle &ref)

Assignment.

Definition: xml.h:2008

tinyxml2::StrPair::Set

void Set(char *start, char *end, int flags)

Definition: xml.h:152

tinyxml2::XMLConstHandle::XMLConstHandle

XMLConstHandle(const XMLNode *node)

Definition: xml.h:2079

tinyxml2::XMLAttribute

An attribute is a name-value pair.

Definition: xml.h:1134

tinyxml2::XMLHandle::ToElement

XMLElement * ToElement()

Safe cast to XMLElement. This can return null.

Definition: xml.h:2051

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, bool value)

Sets the named attribute to value.

Definition: xml.h:1452

tinyxml2::XMLConstHandle::NextSibling

const XMLConstHandle NextSibling() const

Definition: xml.h:2109

tinyxml2::XMLDocument::ProcessEntities

bool ProcessEntities() const

Definition: xml.h:1730

tinyxml2::XMLDocument::RootElement

const XMLElement * RootElement() const

Definition: xml.h:1755

tinyxml2::XMLPrinter::CStr

const char * CStr() const

If in print to memory mode, return a pointer to the XML file in memory.

Definition: xml.h:2246

tinyxml2::XMLText

XML text.

Definition: xml.h:985

tinyxml2::Whitespace

Whitespace

Definition: xml.h:1647

tinyxml2::XMLConstHandle::LastChildElement

const XMLConstHandle LastChildElement(const char *name=0) const

Definition: xml.h:2100

tinyxml2::XMLNode::ToUnknown

virtual XMLUnknown * ToUnknown()

Safely cast to an Unknown, or null.

Definition: xml.h:706

tinyxml2::XMLElement::FirstAttribute

const XMLAttribute * FirstAttribute() const

Return the first attribute in the list.

Definition: xml.h:1473

tinyxml2::XMLAttribute::QueryUnsignedValue

XMLError QueryUnsignedValue(unsigned int *value) const

See QueryIntValue.

tinyxml2::XMLAttribute::QueryInt64Value

XMLError QueryInt64Value(int64_t *value) const

See QueryIntValue.

tinyxml2::XMLUtil::IsNameStartChar

static bool IsNameStartChar(unsigned char ch)

Definition: xml.h:576

tinyxml2::XML_SUCCESS

@ XML_SUCCESS

Definition: xml.h:522

tinyxml2::XMLPrinter::CStrSize

int CStrSize() const

If in print to memory mode, return the size of the XML file in memory.

Definition: xml.h:2254

tinyxml2::XMLAttribute::QueryDoubleValue

XMLError QueryDoubleValue(double *value) const

See QueryIntValue.

tinyxml2::XMLComment::ToComment

virtual XMLComment * ToComment()

Safely cast to a Comment, or null.

Definition: xml.h:1029

tinyxml2::StrPair::COMMENT

@ COMMENT

Definition: xml.h:146

tinyxml2::XMLNode::FirstChild

XMLNode * FirstChild()

Definition: xml.h:767

tinyxml2::XMLAttribute::QueryBoolValue

XMLError QueryBoolValue(bool *value) const

See QueryIntValue.

tinyxml2::XMLNode::FirstChild

const XMLNode * FirstChild() const

Get the first child node, or null if none exists.

Definition: xml.h:763

tinyxml2::DynArray::Pop

T Pop()

Definition: xml.h:239

tinyxml2::XMLNode::GetLineNum

int GetLineNum() const

Gets the line number the node is in, if the document was parsed from a file.

Definition: xml.h:746

tinyxml2::DynArray::Size

int Size() const

Definition: xml.h:269

tinyxml2::XMLNode::_firstChild

XMLNode * _firstChild

Definition: xml.h:953

tinyxml2::XMLComment::ToComment

virtual const XMLComment * ToComment() const

Definition: xml.h:1032

tinyxml2::StrPair::NEEDS_ENTITY_PROCESSING

@ NEEDS_ENTITY_PROCESSING

Definition: xml.h:137

tinyxml2::StrPair::SetInternedStr

void SetInternedStr(const char *str)

Definition: xml.h:167

tinyxml2::XMLNode::LinkEndChild

XMLNode * LinkEndChild(XMLNode *addThis)

Definition: xml.h:839

tinyxml2::XMLText::XMLText

XMLText(XMLDocument *doc)

Definition: xml.h:1011

tinyxml2::XMLDeclaration

In correct XML the declaration is the first entry in the file.

Definition: xml.h:1064

tinyxml2::DynArray::Empty

bool Empty() const

Definition: xml.h:250

tinyxml2::XMLConstHandle::FirstChild

const XMLConstHandle FirstChild() const

Definition: xml.h:2091

tinyxml2::XMLUnknown

Any tag that TinyXML-2 doesn't recognize is saved as an unknown.

Definition: xml.h:1099

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, unsigned value)

Sets the named attribute to value.

Definition: xml.h:1440

tinyxml2::UNUSED_XML_ERROR_IDENTIFYING_TAG

@ UNUSED_XML_ERROR_IDENTIFYING_TAG

Definition: xml.h:531

tinyxml2::XMLText::SetCData

void SetCData(bool isCData)

Declare whether this should be CDATA or standard text.

Definition: xml.h:999

tinyxml2::XMLConstHandle::ToUnknown

const XMLUnknown * ToUnknown() const

Definition: xml.h:2126

tinyxml2::XMLHandle::ToText

XMLText * ToText()

Safe cast to XMLText. This can return null.

Definition: xml.h:2055

tinyxml2::XMLElement::ElementClosingType

ElementClosingType

Definition: xml.h:1609

tinyxml2::XMLElement

The element is a container class.

Definition: xml.h:1248

tinyxml2::MemPoolT::CurrentAllocs

int CurrentAllocs() const

Definition: xml.h:369

tinyxml2::XMLHandle::LastChild

XMLHandle LastChild()

Get the last child of this handle.

Definition: xml.h:2022

tinyxml2::XMLElement::ClosingType

ElementClosingType ClosingType() const

Definition: xml.h:1614

tinyxml2::XMLNode::ToDocument

virtual const XMLDocument * ToDocument() const

Definition: xml.h:719

tinyxml2::StrPair::TransferTo

void TransferTo(StrPair *other)

tinyxml2::XMLDocument::ToDocument

virtual XMLDocument * ToDocument()

Safely cast to a Document, or null.

Definition: xml.h:1673

tinyxml2::XMLNode::Parent

const XMLNode * Parent() const

Get the parent of this node on the DOM.

Definition: xml.h:749

tinyxml2::XMLPrinter::ClearBuffer

void ClearBuffer()

If in print to memory mode, reset the buffer to the beginning.

Definition: xml.h:2261

tinyxml2::XMLNode::_value

StrPair _value

Definition: xml.h:950

tinyxml2::XML_ERROR_PARSING_CDATA

@ XML_ERROR_PARSING_CDATA

Definition: xml.h:533

tinyxml2::XMLPrinter::CompactMode

virtual bool CompactMode(const XMLElement &)

Definition: xml.h:2268

tinyxml2::XMLDocument::RootElement

XMLElement * RootElement()

Return the root element of DOM.

Definition: xml.h:1752

tinyxml2::XMLAttribute::QueryFloatValue

XMLError QueryFloatValue(float *value) const

See QueryIntValue.

tinyxml2::XMLNode::SetUserData

void SetUserData(void *userData)

Set user data into the XMLNode.

Definition: xml.h:933

tinyxml2::XMLElement::QueryDoubleAttribute

XMLError QueryDoubleAttribute(const char *name, double *value) const

See QueryIntAttribute()

Definition: xml.h:1360

tinyxml2::MemPoolT

Definition: xml.h:345

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, float value)

Sets the named attribute to value.

Definition: xml.h:1462

tinyxml2::DynArray::Clear

void Clear()

Definition: xml.h:219

tinyxml2::XMLNode::ToElement

virtual XMLElement * ToElement()

Safely cast to an Element, or null.

Definition: xml.h:686

tinyxml2::MemPool::~MemPool

virtual ~MemPool()

Definition: xml.h:331

tinyxml2::DynArray::PushArr

T * PushArr(int count)

Definition: xml.h:230

tinyxml2::XMLElement::CLOSED

@ CLOSED

Definition: xml.h:1611

tinyxml2::StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES

@ ATTRIBUTE_VALUE_LEAVE_ENTITIES

Definition: xml.h:145

tinyxml2::StrPair::SetStr

void SetStr(const char *str, int flags=0)

tinyxml2::XMLNode::GetUserData

void * GetUserData() const

Get user data set into the XMLNode.

Definition: xml.h:940

tinyxml2::XMLHandle::XMLHandle

XMLHandle(XMLNode *node)

Create a handle from any node (at any depth of the tree.) This can be a null pointer.

Definition: xml.h:1999

tinyxml2::MemPoolT::Alloc

virtual void * Alloc()

Definition: xml.h:373

tinyxml2::MemPoolT::ItemSize

virtual int ItemSize() const

Definition: xml.h:366

tinyxml2::XMLNode::_parseLineNum

int _parseLineNum

Definition: xml.h:951

tinyxml2::XMLElement::ToElement

virtual const XMLElement * ToElement() const

Definition: xml.h:1264

tinyxml2::XMLConstHandle::LastChild

const XMLConstHandle LastChild() const

Definition: xml.h:2097

tinyxml2::XMLElement::QueryUnsignedAttribute

XMLError QueryUnsignedAttribute(const char *name, unsigned int *value) const

See QueryIntAttribute()

Definition: xml.h:1334

tinyxml2::MemPool::MemPool

MemPool()

Definition: xml.h:330

tinyxml2::XML_ERROR_PARSING_ATTRIBUTE

@ XML_ERROR_PARSING_ATTRIBUTE

Definition: xml.h:530

tinyxml2::DynArray::operator[]

T & operator[](int i)

Definition: xml.h:254

tinyxml2::MemPoolT::SetTracked

void SetTracked()

Definition: xml.h:417

tinyxml2::XMLPrinter::~XMLPrinter

virtual ~XMLPrinter()

Definition: xml.h:2190

tinyxml2::MemPoolT::MemPoolT

MemPoolT()

Definition: xml.h:348

tinyxml2::XMLNode::LastChild

const XMLNode * LastChild() const

Get the last child node, or null if none exists.

Definition: xml.h:781

tinyxml2::XMLHandle::ToDeclaration

XMLDeclaration * ToDeclaration()

Safe cast to XMLDeclaration. This can return null.

Definition: xml.h:2063

tinyxml2::XMLHandle::FirstChildElement

XMLHandle FirstChildElement(const char *name=0)

Get the first child element of this handle.

Definition: xml.h:2018

tinyxml2::DynArray::operator[]

const T & operator[](int i) const

Definition: xml.h:259

tinyxml2::XMLConstHandle::NextSiblingElement

const XMLConstHandle NextSiblingElement(const char *name=0) const

Definition: xml.h:2112

tinyxml2::PRESERVE_WHITESPACE

@ PRESERVE_WHITESPACE

Definition: xml.h:1648

tinyxml2::XMLNode::_next

XMLNode * _next

Definition: xml.h:957

tinyxml2::StrPair::StrPair

StrPair()

Definition: xml.h:149

length

__host__ __device__ float length(float2 v)

Definition: cudaMath.h:1563

tinyxml2::XMLNode::_userData

void * _userData

Definition: xml.h:959

tinyxml2::XMLHandle::PreviousSibling

XMLHandle PreviousSibling()

Get the previous sibling of this handle.

Definition: xml.h:2030

tinyxml2::XMLAttribute::BoolValue

bool BoolValue() const

Query as a boolean. See IntValue()

Definition: xml.h:1175

tinyxml2::XMLNode

XMLNode is a base class for every object that is in the XML Document Object Model (DOM),...

Definition: xml.h:668

tinyxml2::XMLVisitor::Visit

virtual bool Visit(const XMLText &)

Visit a text node.

Definition: xml.h:507

tinyxml2::MemPool::Free

virtual void Free(void *)=0

tinyxml2::XMLConstHandle::operator=

XMLConstHandle & operator=(const XMLConstHandle &ref)

Definition: xml.h:2086

tinyxml2::XMLNode::PreviousSiblingElement

XMLElement * PreviousSiblingElement(const char *name=0)

Definition: xml.h:810

tinyxml2::XMLDeclaration::ToDeclaration

virtual const XMLDeclaration * ToDeclaration() const

Definition: xml.h:1071

tinyxml2::XMLNode::NextSiblingElement

XMLElement * NextSiblingElement(const char *name=0)

Definition: xml.h:826

tinyxml2::XMLHandle::ToNode

XMLNode * ToNode()

Safe cast to XMLNode. This can return null.

Definition: xml.h:2047

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, int value)

Sets the named attribute to value.

Definition: xml.h:1435

tinyxml2::XMLElement::QueryAttribute

int QueryAttribute(const char *name, float *value) const

Definition: xml.h:1425

tinyxml2::DynArray::Push

void Push(T t)

Definition: xml.h:223

tinyxml2::XMLUtil::IsWhiteSpace

static bool IsWhiteSpace(char p)

Definition: xml.h:572

tinyxml2::XMLConstHandle::PreviousSiblingElement

const XMLConstHandle PreviousSiblingElement(const char *name=0) const

Definition: xml.h:2106

tinyxml2::XMLDeclaration::ToDeclaration

virtual XMLDeclaration * ToDeclaration()

Safely cast to a Declaration, or null.

Definition: xml.h:1068

tinyxml2::XMLNode::LastChildElement

XMLElement * LastChildElement(const char *name=0)

Definition: xml.h:794

tinyxml2::XMLPrinter::Write

void Write(const char *data)

Definition: xml.h:2276

tinyxml2::XMLNode::ToText

virtual XMLText * ToText()

Safely cast to Text, or null.

Definition: xml.h:690

tinyxml2::XMLDocument::SetBOM

void SetBOM(bool useBOM)

Sets whether to write the BOM when writing the file.

Definition: xml.h:1745

tinyxml2::XMLConstHandle::XMLConstHandle

XMLConstHandle(const XMLConstHandle &ref)

Definition: xml.h:2083

tinyxml2::XMLElement::QueryIntAttribute

XMLError QueryIntAttribute(const char *name, int *value) const

Given an attribute name, QueryIntAttribute() returns XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the con...

Definition: xml.h:1325

tinyxml2::XMLUtil::StringEqual

static bool StringEqual(const char *p, const char *q, int nChar=INT_MAX)

Definition: xml.h:594

tinyxml2::DynArray::SwapRemove

void SwapRemove(int i)

Definition: xml.h:279

tinyxml2::XML_CAN_NOT_CONVERT_TEXT

@ XML_CAN_NOT_CONVERT_TEXT

Definition: xml.h:540

tinyxml2::XMLHandle::ToUnknown

XMLUnknown * ToUnknown()

Safe cast to XMLUnknown. This can return null.

Definition: xml.h:2059

tinyxml2::XMLDocument

A Document binds together all the functionality.

Definition: xml.h:1658

tinyxml2::XMLAttribute::GetLineNum

int GetLineNum() const

Gets the line number the attribute is in, if the document was parsed from a file.

Definition: xml.h:1145

tinyxml2::StrPair::~StrPair

~StrPair()

tinyxml2::XMLNode::Parent

XMLNode * Parent()

Definition: xml.h:753

tinyxml2::XML_ELEMENT_DEPTH_EXCEEDED

@ XML_ELEMENT_DEPTH_EXCEEDED

Definition: xml.h:542

tinyxml2

Definition: xml.h:116

tinyxml2::XMLText::ToText

virtual XMLText * ToText()

Safely cast to Text, or null.

Definition: xml.h:991

tinyxml2::XMLNode::ToComment

virtual XMLComment * ToComment()

Safely cast to a Comment, or null.

Definition: xml.h:694

tinyxml2::MemPool::Alloc

virtual void * Alloc()=0

tinyxml2::XMLVisitor::VisitEnter

virtual bool VisitEnter(const XMLDocument &)

Visit a document.

Definition: xml.h:485

tinyxml2::XMLAttribute::FloatValue

float FloatValue() const

Query as a float. See IntValue()

Definition: xml.h:1187

tinyxml2::XMLAttribute::Int64Value

int64_t Int64Value() const

Definition: xml.h:1162

tinyxml2::XMLNode::_document

XMLDocument * _document

Definition: xml.h:948

tinyxml2::XMLAttribute::IntValue

int IntValue() const

IntValue interprets the attribute as an integer, and returns the value.

Definition: xml.h:1156

tinyxml2::MemPoolT::Untracked

int Untracked() const

Definition: xml.h:421

tinyxml2::StrPair::ATTRIBUTE_VALUE

@ ATTRIBUTE_VALUE

Definition: xml.h:144

tinyxml2::StrPair::NEEDS_NEWLINE_NORMALIZATION

@ NEEDS_NEWLINE_NORMALIZATION

Definition: xml.h:138

tinyxml2::XMLText::ToText

virtual const XMLText * ToText() const

Definition: xml.h:994

tinyxml2::XMLNode::ToDocument

virtual XMLDocument * ToDocument()

Safely cast to a Document, or null.

Definition: xml.h:698

tinyxml2::XMLHandle::NextSiblingElement

XMLHandle NextSiblingElement(const char *name=0)

Get the next sibling element of this handle.

Definition: xml.h:2042

tinyxml2::XMLUtil::SkipWhiteSpace

static const char * SkipWhiteSpace(const char *p, int *curLineNumPtr)

Definition: xml.h:554

tinyxml2::XMLElement::SetAttribute

void SetAttribute(const char *name, int64_t value)

Sets the named attribute to value.

Definition: xml.h:1446

tinyxml2::DynArray

Definition: xml.h:203

tinyxml2::XML_ERROR_MISMATCHED_ELEMENT

@ XML_ERROR_MISMATCHED_ELEMENT

Definition: xml.h:538

tinyxml2::XMLUtil::IsNameChar

static bool IsNameChar(unsigned char ch)

Definition: xml.h:587

tinyxml2::XMLConstHandle::FirstChildElement

const XMLConstHandle FirstChildElement(const char *name=0) const

Definition: xml.h:2094

tinyxml2::XML_ERROR_COUNT

@ XML_ERROR_COUNT

Definition: xml.h:544

tinyxml2::XMLNode::PreviousSibling

const XMLNode * PreviousSibling() const

Get the previous (left) sibling node of this node.

Definition: xml.h:799

tinyxml2::XMLDocument::ShallowEqual

virtual bool ShallowEqual(const XMLNode *) const

Test if 2 nodes are the same, but don't test children.

Definition: xml.h:1869

tinyxml2::XML_NO_ATTRIBUTE

@ XML_NO_ATTRIBUTE

Definition: xml.h:523

tinyxml2::MemPoolT::Clear

void Clear()

Definition: xml.h:353

tinyxml2::XMLNode::ToUnknown

virtual const XMLUnknown * ToUnknown() const

Definition: xml.h:725

tinyxml2::XMLVisitor::Visit

virtual bool Visit(const XMLDeclaration &)

Visit a declaration.

Definition: xml.h:503

tinyxml2::XMLNode::ToDeclaration

virtual const XMLDeclaration * ToDeclaration() const

Definition: xml.h:722

tinyxml2::XMLNode::GetDocument

XMLDocument * GetDocument()

Get the XMLDocument that owns this XMLNode.

Definition: xml.h:680

tinyxml2::XMLElement::QueryFloatAttribute

XMLError QueryFloatAttribute(const char *name, float *value) const

See QueryIntAttribute()

Definition: xml.h:1368

tinyxml2::XML_ERROR_PARSING

@ XML_ERROR_PARSING

Definition: xml.h:539

tinyxml2::XMLNode::PreviousSibling

XMLNode * PreviousSibling()

Definition: xml.h:803

tinyxml2::XMLConstHandle::XMLConstHandle

XMLConstHandle(const XMLNode &node)

Definition: xml.h:2081

tinyxml2::XML_ERROR_EMPTY_DOCUMENT

@ XML_ERROR_EMPTY_DOCUMENT

Definition: xml.h:537

tinyxml2::MemPool::Clear

virtual void Clear()=0

tinyxml2::XMLHandle::NextSibling

XMLHandle NextSibling()

Get the next sibling of this handle.

Definition: xml.h:2038

tinyxml2::XMLConstHandle

A variant of the XMLHandle class for working with const XMLNodes and Documents.

Definition: xml.h:2076

tinyxml2::DynArray::Capacity

int Capacity() const

Definition: xml.h:274

tinyxml2::XMLHandle::FirstChild

XMLHandle FirstChild()

Get the first child of this handle.

Definition: xml.h:2014

tinyxml2::XMLHandle::LastChildElement

XMLHandle LastChildElement(const char *name=0)

Get the last child element of this handle.

Definition: xml.h:2026

tinyxml2::XMLAttribute::QueryIntValue

XMLError QueryIntValue(int *value) const

QueryIntValue interprets the attribute as an integer, and returns the value in the provided parameter...

tinyxml2::XMLAttribute::Next

const XMLAttribute * Next() const

The next attribute in the list.

Definition: xml.h:1148

tinyxml2::XMLElement::OPEN

@ OPEN

Definition: xml.h:1610

tinyxml2::XMLPrinter::_elementJustOpened

bool _elementJustOpened

Definition: xml.h:2280

tinyxml2::XMLNode::LastChild

XMLNode * LastChild()

Definition: xml.h:785

tinyxml2::XMLConstHandle::PreviousSibling

const XMLConstHandle PreviousSibling() const

Definition: xml.h:2103

tinyxml2::StrPair

Definition: xml.h:133

tinyxml2::XMLElement::Name

const char * Name() const

Get the name of an element (which is the Value() of the node.)

Definition: xml.h:1253

  • jetson-utils
  • xml.h
  • Generated on Tue Mar 28 2023 14:27:58 for Jetson Inference by 1.8.17