TinyXml is a compact library that implements XML Parsing and Manipulation.

Dependents:   tinyxml_test

Committer:
wvd_vegt
Date:
Mon Apr 18 18:54:09 2011 +0000
Revision:
0:3c1d63c20cfc
First Version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wvd_vegt 0:3c1d63c20cfc 1 /*
wvd_vegt 0:3c1d63c20cfc 2 www.sourceforge.net/projects/tinyxml
wvd_vegt 0:3c1d63c20cfc 3 Original file by Yves Berquin.
wvd_vegt 0:3c1d63c20cfc 4
wvd_vegt 0:3c1d63c20cfc 5 This software is provided 'as-is', without any express or implied
wvd_vegt 0:3c1d63c20cfc 6 warranty. In no event will the authors be held liable for any
wvd_vegt 0:3c1d63c20cfc 7 damages arising from the use of this software.
wvd_vegt 0:3c1d63c20cfc 8
wvd_vegt 0:3c1d63c20cfc 9 Permission is granted to anyone to use this software for any
wvd_vegt 0:3c1d63c20cfc 10 purpose, including commercial applications, and to alter it and
wvd_vegt 0:3c1d63c20cfc 11 redistribute it freely, subject to the following restrictions:
wvd_vegt 0:3c1d63c20cfc 12
wvd_vegt 0:3c1d63c20cfc 13 1. The origin of this software must not be misrepresented; you must
wvd_vegt 0:3c1d63c20cfc 14 not claim that you wrote the original software. If you use this
wvd_vegt 0:3c1d63c20cfc 15 software in a product, an acknowledgment in the product documentation
wvd_vegt 0:3c1d63c20cfc 16 would be appreciated but is not required.
wvd_vegt 0:3c1d63c20cfc 17
wvd_vegt 0:3c1d63c20cfc 18 2. Altered source versions must be plainly marked as such, and
wvd_vegt 0:3c1d63c20cfc 19 must not be misrepresented as being the original software.
wvd_vegt 0:3c1d63c20cfc 20
wvd_vegt 0:3c1d63c20cfc 21 3. This notice may not be removed or altered from any source
wvd_vegt 0:3c1d63c20cfc 22 distribution.
wvd_vegt 0:3c1d63c20cfc 23 */
wvd_vegt 0:3c1d63c20cfc 24
wvd_vegt 0:3c1d63c20cfc 25 /*
wvd_vegt 0:3c1d63c20cfc 26 * THIS FILE WAS ALTERED BY Tyge Lovset, 7. April 2005.
wvd_vegt 0:3c1d63c20cfc 27 *
wvd_vegt 0:3c1d63c20cfc 28 * - completely rewritten. compact, clean, and fast implementation.
wvd_vegt 0:3c1d63c20cfc 29 * - sizeof(TiXmlString) = pointer size (4 bytes on 32-bit systems)
wvd_vegt 0:3c1d63c20cfc 30 * - fixed reserve() to work as per specification.
wvd_vegt 0:3c1d63c20cfc 31 * - fixed buggy compares operator==(), operator<(), and operator>()
wvd_vegt 0:3c1d63c20cfc 32 * - fixed operator+=() to take a const ref argument, following spec.
wvd_vegt 0:3c1d63c20cfc 33 * - added "copy" constructor with length, and most compare operators.
wvd_vegt 0:3c1d63c20cfc 34 * - added swap(), clear(), size(), capacity(), operator+().
wvd_vegt 0:3c1d63c20cfc 35 */
wvd_vegt 0:3c1d63c20cfc 36
wvd_vegt 0:3c1d63c20cfc 37 #ifndef TIXML_USE_STL
wvd_vegt 0:3c1d63c20cfc 38
wvd_vegt 0:3c1d63c20cfc 39 #ifndef TIXML_STRING_INCLUDED
wvd_vegt 0:3c1d63c20cfc 40 #define TIXML_STRING_INCLUDED
wvd_vegt 0:3c1d63c20cfc 41
wvd_vegt 0:3c1d63c20cfc 42 #include <assert.h>
wvd_vegt 0:3c1d63c20cfc 43 #include <string.h>
wvd_vegt 0:3c1d63c20cfc 44
wvd_vegt 0:3c1d63c20cfc 45 /* The support for explicit isn't that universal, and it isn't really
wvd_vegt 0:3c1d63c20cfc 46 required - it is used to check that the TiXmlString class isn't incorrectly
wvd_vegt 0:3c1d63c20cfc 47 used. Be nice to old compilers and macro it here:
wvd_vegt 0:3c1d63c20cfc 48 */
wvd_vegt 0:3c1d63c20cfc 49 #if defined(_MSC_VER) && (_MSC_VER >= 1200 )
wvd_vegt 0:3c1d63c20cfc 50 // Microsoft visual studio, version 6 and higher.
wvd_vegt 0:3c1d63c20cfc 51 #define TIXML_EXPLICIT explicit
wvd_vegt 0:3c1d63c20cfc 52 #elif defined(__GNUC__) && (__GNUC__ >= 3 )
wvd_vegt 0:3c1d63c20cfc 53 // GCC version 3 and higher.s
wvd_vegt 0:3c1d63c20cfc 54 #define TIXML_EXPLICIT explicit
wvd_vegt 0:3c1d63c20cfc 55 #else
wvd_vegt 0:3c1d63c20cfc 56 #define TIXML_EXPLICIT
wvd_vegt 0:3c1d63c20cfc 57 #endif
wvd_vegt 0:3c1d63c20cfc 58
wvd_vegt 0:3c1d63c20cfc 59
wvd_vegt 0:3c1d63c20cfc 60 /*
wvd_vegt 0:3c1d63c20cfc 61 TiXmlString is an emulation of a subset of the std::string template.
wvd_vegt 0:3c1d63c20cfc 62 Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
wvd_vegt 0:3c1d63c20cfc 63 Only the member functions relevant to the TinyXML project have been implemented.
wvd_vegt 0:3c1d63c20cfc 64 The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
wvd_vegt 0:3c1d63c20cfc 65 a string and there's no more room, we allocate a buffer twice as big as we need.
wvd_vegt 0:3c1d63c20cfc 66 */
wvd_vegt 0:3c1d63c20cfc 67 class TiXmlString
wvd_vegt 0:3c1d63c20cfc 68 {
wvd_vegt 0:3c1d63c20cfc 69 public :
wvd_vegt 0:3c1d63c20cfc 70 // The size type used
wvd_vegt 0:3c1d63c20cfc 71 typedef size_t size_type;
wvd_vegt 0:3c1d63c20cfc 72
wvd_vegt 0:3c1d63c20cfc 73 // Error value for find primitive
wvd_vegt 0:3c1d63c20cfc 74 static const size_type npos; // = -1;
wvd_vegt 0:3c1d63c20cfc 75
wvd_vegt 0:3c1d63c20cfc 76
wvd_vegt 0:3c1d63c20cfc 77 // TiXmlString empty constructor
wvd_vegt 0:3c1d63c20cfc 78 TiXmlString () : rep_(&nullrep_)
wvd_vegt 0:3c1d63c20cfc 79 {
wvd_vegt 0:3c1d63c20cfc 80 }
wvd_vegt 0:3c1d63c20cfc 81
wvd_vegt 0:3c1d63c20cfc 82 // TiXmlString copy constructor
wvd_vegt 0:3c1d63c20cfc 83 TiXmlString ( const TiXmlString & copy) : rep_(0)
wvd_vegt 0:3c1d63c20cfc 84 {
wvd_vegt 0:3c1d63c20cfc 85 init(copy.length());
wvd_vegt 0:3c1d63c20cfc 86 memcpy(start(), copy.data(), length());
wvd_vegt 0:3c1d63c20cfc 87 }
wvd_vegt 0:3c1d63c20cfc 88
wvd_vegt 0:3c1d63c20cfc 89 // TiXmlString constructor, based on a string
wvd_vegt 0:3c1d63c20cfc 90 TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
wvd_vegt 0:3c1d63c20cfc 91 {
wvd_vegt 0:3c1d63c20cfc 92 init( static_cast<size_type>( strlen(copy) ));
wvd_vegt 0:3c1d63c20cfc 93 memcpy(start(), copy, length());
wvd_vegt 0:3c1d63c20cfc 94 }
wvd_vegt 0:3c1d63c20cfc 95
wvd_vegt 0:3c1d63c20cfc 96 // TiXmlString constructor, based on a string
wvd_vegt 0:3c1d63c20cfc 97 TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
wvd_vegt 0:3c1d63c20cfc 98 {
wvd_vegt 0:3c1d63c20cfc 99 init(len);
wvd_vegt 0:3c1d63c20cfc 100 memcpy(start(), str, len);
wvd_vegt 0:3c1d63c20cfc 101 }
wvd_vegt 0:3c1d63c20cfc 102
wvd_vegt 0:3c1d63c20cfc 103 // TiXmlString destructor
wvd_vegt 0:3c1d63c20cfc 104 ~TiXmlString ()
wvd_vegt 0:3c1d63c20cfc 105 {
wvd_vegt 0:3c1d63c20cfc 106 quit();
wvd_vegt 0:3c1d63c20cfc 107 }
wvd_vegt 0:3c1d63c20cfc 108
wvd_vegt 0:3c1d63c20cfc 109 // = operator
wvd_vegt 0:3c1d63c20cfc 110 TiXmlString& operator = (const char * copy)
wvd_vegt 0:3c1d63c20cfc 111 {
wvd_vegt 0:3c1d63c20cfc 112 return assign( copy, (size_type)strlen(copy));
wvd_vegt 0:3c1d63c20cfc 113 }
wvd_vegt 0:3c1d63c20cfc 114
wvd_vegt 0:3c1d63c20cfc 115 // = operator
wvd_vegt 0:3c1d63c20cfc 116 TiXmlString& operator = (const TiXmlString & copy)
wvd_vegt 0:3c1d63c20cfc 117 {
wvd_vegt 0:3c1d63c20cfc 118 return assign(copy.start(), copy.length());
wvd_vegt 0:3c1d63c20cfc 119 }
wvd_vegt 0:3c1d63c20cfc 120
wvd_vegt 0:3c1d63c20cfc 121
wvd_vegt 0:3c1d63c20cfc 122 // += operator. Maps to append
wvd_vegt 0:3c1d63c20cfc 123 TiXmlString& operator += (const char * suffix)
wvd_vegt 0:3c1d63c20cfc 124 {
wvd_vegt 0:3c1d63c20cfc 125 return append(suffix, static_cast<size_type>( strlen(suffix) ));
wvd_vegt 0:3c1d63c20cfc 126 }
wvd_vegt 0:3c1d63c20cfc 127
wvd_vegt 0:3c1d63c20cfc 128 // += operator. Maps to append
wvd_vegt 0:3c1d63c20cfc 129 TiXmlString& operator += (char single)
wvd_vegt 0:3c1d63c20cfc 130 {
wvd_vegt 0:3c1d63c20cfc 131 return append(&single, 1);
wvd_vegt 0:3c1d63c20cfc 132 }
wvd_vegt 0:3c1d63c20cfc 133
wvd_vegt 0:3c1d63c20cfc 134 // += operator. Maps to append
wvd_vegt 0:3c1d63c20cfc 135 TiXmlString& operator += (const TiXmlString & suffix)
wvd_vegt 0:3c1d63c20cfc 136 {
wvd_vegt 0:3c1d63c20cfc 137 return append(suffix.data(), suffix.length());
wvd_vegt 0:3c1d63c20cfc 138 }
wvd_vegt 0:3c1d63c20cfc 139
wvd_vegt 0:3c1d63c20cfc 140
wvd_vegt 0:3c1d63c20cfc 141 // Convert a TiXmlString into a null-terminated char *
wvd_vegt 0:3c1d63c20cfc 142 const char * c_str () const { return rep_->str; }
wvd_vegt 0:3c1d63c20cfc 143
wvd_vegt 0:3c1d63c20cfc 144 // Convert a TiXmlString into a char * (need not be null terminated).
wvd_vegt 0:3c1d63c20cfc 145 const char * data () const { return rep_->str; }
wvd_vegt 0:3c1d63c20cfc 146
wvd_vegt 0:3c1d63c20cfc 147 // Return the length of a TiXmlString
wvd_vegt 0:3c1d63c20cfc 148 size_type length () const { return rep_->size; }
wvd_vegt 0:3c1d63c20cfc 149
wvd_vegt 0:3c1d63c20cfc 150 // Alias for length()
wvd_vegt 0:3c1d63c20cfc 151 size_type size () const { return rep_->size; }
wvd_vegt 0:3c1d63c20cfc 152
wvd_vegt 0:3c1d63c20cfc 153 // Checks if a TiXmlString is empty
wvd_vegt 0:3c1d63c20cfc 154 bool empty () const { return rep_->size == 0; }
wvd_vegt 0:3c1d63c20cfc 155
wvd_vegt 0:3c1d63c20cfc 156 // Return capacity of string
wvd_vegt 0:3c1d63c20cfc 157 size_type capacity () const { return rep_->capacity; }
wvd_vegt 0:3c1d63c20cfc 158
wvd_vegt 0:3c1d63c20cfc 159
wvd_vegt 0:3c1d63c20cfc 160 // single char extraction
wvd_vegt 0:3c1d63c20cfc 161 const char& at (size_type index) const
wvd_vegt 0:3c1d63c20cfc 162 {
wvd_vegt 0:3c1d63c20cfc 163 assert( index < length() );
wvd_vegt 0:3c1d63c20cfc 164 return rep_->str[ index ];
wvd_vegt 0:3c1d63c20cfc 165 }
wvd_vegt 0:3c1d63c20cfc 166
wvd_vegt 0:3c1d63c20cfc 167 // [] operator
wvd_vegt 0:3c1d63c20cfc 168 char& operator [] (size_type index) const
wvd_vegt 0:3c1d63c20cfc 169 {
wvd_vegt 0:3c1d63c20cfc 170 assert( index < length() );
wvd_vegt 0:3c1d63c20cfc 171 return rep_->str[ index ];
wvd_vegt 0:3c1d63c20cfc 172 }
wvd_vegt 0:3c1d63c20cfc 173
wvd_vegt 0:3c1d63c20cfc 174 // find a char in a string. Return TiXmlString::npos if not found
wvd_vegt 0:3c1d63c20cfc 175 size_type find (char lookup) const
wvd_vegt 0:3c1d63c20cfc 176 {
wvd_vegt 0:3c1d63c20cfc 177 return find(lookup, 0);
wvd_vegt 0:3c1d63c20cfc 178 }
wvd_vegt 0:3c1d63c20cfc 179
wvd_vegt 0:3c1d63c20cfc 180 // find a char in a string from an offset. Return TiXmlString::npos if not found
wvd_vegt 0:3c1d63c20cfc 181 size_type find (char tofind, size_type offset) const
wvd_vegt 0:3c1d63c20cfc 182 {
wvd_vegt 0:3c1d63c20cfc 183 if (offset >= length()) return npos;
wvd_vegt 0:3c1d63c20cfc 184
wvd_vegt 0:3c1d63c20cfc 185 for (const char* p = c_str() + offset; *p != '\0'; ++p)
wvd_vegt 0:3c1d63c20cfc 186 {
wvd_vegt 0:3c1d63c20cfc 187 if (*p == tofind) return static_cast< size_type >( p - c_str() );
wvd_vegt 0:3c1d63c20cfc 188 }
wvd_vegt 0:3c1d63c20cfc 189 return npos;
wvd_vegt 0:3c1d63c20cfc 190 }
wvd_vegt 0:3c1d63c20cfc 191
wvd_vegt 0:3c1d63c20cfc 192 void clear ()
wvd_vegt 0:3c1d63c20cfc 193 {
wvd_vegt 0:3c1d63c20cfc 194 //Lee:
wvd_vegt 0:3c1d63c20cfc 195 //The original was just too strange, though correct:
wvd_vegt 0:3c1d63c20cfc 196 // TiXmlString().swap(*this);
wvd_vegt 0:3c1d63c20cfc 197 //Instead use the quit & re-init:
wvd_vegt 0:3c1d63c20cfc 198 quit();
wvd_vegt 0:3c1d63c20cfc 199 init(0,0);
wvd_vegt 0:3c1d63c20cfc 200 }
wvd_vegt 0:3c1d63c20cfc 201
wvd_vegt 0:3c1d63c20cfc 202 /* Function to reserve a big amount of data when we know we'll need it. Be aware that this
wvd_vegt 0:3c1d63c20cfc 203 function DOES NOT clear the content of the TiXmlString if any exists.
wvd_vegt 0:3c1d63c20cfc 204 */
wvd_vegt 0:3c1d63c20cfc 205 void reserve (size_type cap);
wvd_vegt 0:3c1d63c20cfc 206
wvd_vegt 0:3c1d63c20cfc 207 TiXmlString& assign (const char* str, size_type len);
wvd_vegt 0:3c1d63c20cfc 208
wvd_vegt 0:3c1d63c20cfc 209 TiXmlString& append (const char* str, size_type len);
wvd_vegt 0:3c1d63c20cfc 210
wvd_vegt 0:3c1d63c20cfc 211 void swap (TiXmlString& other)
wvd_vegt 0:3c1d63c20cfc 212 {
wvd_vegt 0:3c1d63c20cfc 213 Rep* r = rep_;
wvd_vegt 0:3c1d63c20cfc 214 rep_ = other.rep_;
wvd_vegt 0:3c1d63c20cfc 215 other.rep_ = r;
wvd_vegt 0:3c1d63c20cfc 216 }
wvd_vegt 0:3c1d63c20cfc 217
wvd_vegt 0:3c1d63c20cfc 218 private:
wvd_vegt 0:3c1d63c20cfc 219
wvd_vegt 0:3c1d63c20cfc 220 void init(size_type sz) { init(sz, sz); }
wvd_vegt 0:3c1d63c20cfc 221 void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
wvd_vegt 0:3c1d63c20cfc 222 char* start() const { return rep_->str; }
wvd_vegt 0:3c1d63c20cfc 223 char* finish() const { return rep_->str + rep_->size; }
wvd_vegt 0:3c1d63c20cfc 224
wvd_vegt 0:3c1d63c20cfc 225 struct Rep
wvd_vegt 0:3c1d63c20cfc 226 {
wvd_vegt 0:3c1d63c20cfc 227 size_type size, capacity;
wvd_vegt 0:3c1d63c20cfc 228 char str[1];
wvd_vegt 0:3c1d63c20cfc 229 };
wvd_vegt 0:3c1d63c20cfc 230
wvd_vegt 0:3c1d63c20cfc 231 void init(size_type sz, size_type cap)
wvd_vegt 0:3c1d63c20cfc 232 {
wvd_vegt 0:3c1d63c20cfc 233 if (cap)
wvd_vegt 0:3c1d63c20cfc 234 {
wvd_vegt 0:3c1d63c20cfc 235 // Lee: the original form:
wvd_vegt 0:3c1d63c20cfc 236 // rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
wvd_vegt 0:3c1d63c20cfc 237 // doesn't work in some cases of new being overloaded. Switching
wvd_vegt 0:3c1d63c20cfc 238 // to the normal allocation, although use an 'int' for systems
wvd_vegt 0:3c1d63c20cfc 239 // that are overly picky about structure alignment.
wvd_vegt 0:3c1d63c20cfc 240 const size_type bytesNeeded = sizeof(Rep) + cap;
wvd_vegt 0:3c1d63c20cfc 241 const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int );
wvd_vegt 0:3c1d63c20cfc 242 rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
wvd_vegt 0:3c1d63c20cfc 243
wvd_vegt 0:3c1d63c20cfc 244 rep_->str[ rep_->size = sz ] = '\0';
wvd_vegt 0:3c1d63c20cfc 245 rep_->capacity = cap;
wvd_vegt 0:3c1d63c20cfc 246 }
wvd_vegt 0:3c1d63c20cfc 247 else
wvd_vegt 0:3c1d63c20cfc 248 {
wvd_vegt 0:3c1d63c20cfc 249 rep_ = &nullrep_;
wvd_vegt 0:3c1d63c20cfc 250 }
wvd_vegt 0:3c1d63c20cfc 251 }
wvd_vegt 0:3c1d63c20cfc 252
wvd_vegt 0:3c1d63c20cfc 253 void quit()
wvd_vegt 0:3c1d63c20cfc 254 {
wvd_vegt 0:3c1d63c20cfc 255 if (rep_ != &nullrep_)
wvd_vegt 0:3c1d63c20cfc 256 {
wvd_vegt 0:3c1d63c20cfc 257 // The rep_ is really an array of ints. (see the allocator, above).
wvd_vegt 0:3c1d63c20cfc 258 // Cast it back before delete, so the compiler won't incorrectly call destructors.
wvd_vegt 0:3c1d63c20cfc 259 delete [] ( reinterpret_cast<int*>( rep_ ) );
wvd_vegt 0:3c1d63c20cfc 260 }
wvd_vegt 0:3c1d63c20cfc 261 }
wvd_vegt 0:3c1d63c20cfc 262
wvd_vegt 0:3c1d63c20cfc 263 Rep * rep_;
wvd_vegt 0:3c1d63c20cfc 264 static Rep nullrep_;
wvd_vegt 0:3c1d63c20cfc 265
wvd_vegt 0:3c1d63c20cfc 266 } ;
wvd_vegt 0:3c1d63c20cfc 267
wvd_vegt 0:3c1d63c20cfc 268
wvd_vegt 0:3c1d63c20cfc 269 inline bool operator == (const TiXmlString & a, const TiXmlString & b)
wvd_vegt 0:3c1d63c20cfc 270 {
wvd_vegt 0:3c1d63c20cfc 271 return ( a.length() == b.length() ) // optimization on some platforms
wvd_vegt 0:3c1d63c20cfc 272 && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare
wvd_vegt 0:3c1d63c20cfc 273 }
wvd_vegt 0:3c1d63c20cfc 274 inline bool operator < (const TiXmlString & a, const TiXmlString & b)
wvd_vegt 0:3c1d63c20cfc 275 {
wvd_vegt 0:3c1d63c20cfc 276 return strcmp(a.c_str(), b.c_str()) < 0;
wvd_vegt 0:3c1d63c20cfc 277 }
wvd_vegt 0:3c1d63c20cfc 278
wvd_vegt 0:3c1d63c20cfc 279 inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
wvd_vegt 0:3c1d63c20cfc 280 inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; }
wvd_vegt 0:3c1d63c20cfc 281 inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
wvd_vegt 0:3c1d63c20cfc 282 inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
wvd_vegt 0:3c1d63c20cfc 283
wvd_vegt 0:3c1d63c20cfc 284 inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
wvd_vegt 0:3c1d63c20cfc 285 inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
wvd_vegt 0:3c1d63c20cfc 286 inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
wvd_vegt 0:3c1d63c20cfc 287 inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
wvd_vegt 0:3c1d63c20cfc 288
wvd_vegt 0:3c1d63c20cfc 289 TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
wvd_vegt 0:3c1d63c20cfc 290 TiXmlString operator + (const TiXmlString & a, const char* b);
wvd_vegt 0:3c1d63c20cfc 291 TiXmlString operator + (const char* a, const TiXmlString & b);
wvd_vegt 0:3c1d63c20cfc 292
wvd_vegt 0:3c1d63c20cfc 293
wvd_vegt 0:3c1d63c20cfc 294 /*
wvd_vegt 0:3c1d63c20cfc 295 TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
wvd_vegt 0:3c1d63c20cfc 296 Only the operators that we need for TinyXML have been developped.
wvd_vegt 0:3c1d63c20cfc 297 */
wvd_vegt 0:3c1d63c20cfc 298 class TiXmlOutStream : public TiXmlString
wvd_vegt 0:3c1d63c20cfc 299 {
wvd_vegt 0:3c1d63c20cfc 300 public :
wvd_vegt 0:3c1d63c20cfc 301
wvd_vegt 0:3c1d63c20cfc 302 // TiXmlOutStream << operator.
wvd_vegt 0:3c1d63c20cfc 303 TiXmlOutStream & operator << (const TiXmlString & in)
wvd_vegt 0:3c1d63c20cfc 304 {
wvd_vegt 0:3c1d63c20cfc 305 *this += in;
wvd_vegt 0:3c1d63c20cfc 306 return *this;
wvd_vegt 0:3c1d63c20cfc 307 }
wvd_vegt 0:3c1d63c20cfc 308
wvd_vegt 0:3c1d63c20cfc 309 // TiXmlOutStream << operator.
wvd_vegt 0:3c1d63c20cfc 310 TiXmlOutStream & operator << (const char * in)
wvd_vegt 0:3c1d63c20cfc 311 {
wvd_vegt 0:3c1d63c20cfc 312 *this += in;
wvd_vegt 0:3c1d63c20cfc 313 return *this;
wvd_vegt 0:3c1d63c20cfc 314 }
wvd_vegt 0:3c1d63c20cfc 315
wvd_vegt 0:3c1d63c20cfc 316 } ;
wvd_vegt 0:3c1d63c20cfc 317
wvd_vegt 0:3c1d63c20cfc 318 #endif // TIXML_STRING_INCLUDED
wvd_vegt 0:3c1d63c20cfc 319 #endif // TIXML_USE_STL