| 2478 | } |
| 2479 | |
| 2480 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 2481 | _elementJustOpened( false ), |
| 2482 | _stack(), |
| 2483 | _firstElement( true ), |
| 2484 | _fp( file ), |
| 2485 | _depth( depth ), |
| 2486 | _textDepth( -1 ), |
| 2487 | _processEntities( true ), |
| 2488 | _compactMode( compact ), |
| 2489 | _buffer() |
| 2490 | { |
| 2491 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 2492 | _entityFlag[i] = false; |
| 2493 | _restrictedEntityFlag[i] = false; |
| 2494 | } |
| 2495 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 2496 | const char entityValue = entities[i].value; |
| 2497 | const unsigned char flagIndex = static_cast<unsigned char>(entityValue); |
| 2498 | TIXMLASSERT( flagIndex < ENTITY_RANGE ); |
| 2499 | _entityFlag[flagIndex] = true; |
| 2500 | } |
| 2501 | _restrictedEntityFlag[static_cast<unsigned char>('&')] = true; |
| 2502 | _restrictedEntityFlag[static_cast<unsigned char>('<')] = true; |
| 2503 | _restrictedEntityFlag[static_cast<unsigned char>('>')] = true; // not required, but consistency is nice |
| 2504 | _buffer.Push( 0 ); |
| 2505 | } |
| 2506 | |
| 2507 | |
| 2508 | void XMLPrinter::Print( const char* format, ... ) |