| 2399 | } |
| 2400 | |
| 2401 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 2402 | _elementJustOpened( false ), |
| 2403 | _stack(), |
| 2404 | _firstElement( true ), |
| 2405 | _fp( file ), |
| 2406 | _depth( depth ), |
| 2407 | _textDepth( -1 ), |
| 2408 | _processEntities( true ), |
| 2409 | _compactMode( compact ), |
| 2410 | _buffer() |
| 2411 | { |
| 2412 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 2413 | _entityFlag[i] = false; |
| 2414 | _restrictedEntityFlag[i] = false; |
| 2415 | } |
| 2416 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 2417 | const char entityValue = entities[i].value; |
| 2418 | const unsigned char flagIndex = (unsigned char)entityValue; |
| 2419 | TIXMLASSERT( flagIndex < ENTITY_RANGE ); |
| 2420 | _entityFlag[flagIndex] = true; |
| 2421 | } |
| 2422 | _restrictedEntityFlag[(unsigned char)'&'] = true; |
| 2423 | _restrictedEntityFlag[(unsigned char)'<'] = true; |
| 2424 | _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice |
| 2425 | _buffer.Push( 0 ); |
| 2426 | } |
| 2427 | |
| 2428 | |
| 2429 | void XMLPrinter::Print( const char* format, ... ) |