| 2578 | } |
| 2579 | |
| 2580 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 2581 | _elementJustOpened( false ), |
| 2582 | _stack(), |
| 2583 | _firstElement( true ), |
| 2584 | _fp( file ), |
| 2585 | _depth( depth ), |
| 2586 | _textDepth( -1 ), |
| 2587 | _processEntities( true ), |
| 2588 | _compactMode( compact ), |
| 2589 | _buffer() |
| 2590 | { |
| 2591 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 2592 | _entityFlag[i] = false; |
| 2593 | _restrictedEntityFlag[i] = false; |
| 2594 | } |
| 2595 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 2596 | const char entityValue = entities[i].value; |
| 2597 | const unsigned char flagIndex = static_cast<unsigned char>(entityValue); |
| 2598 | TIXMLASSERT( flagIndex < ENTITY_RANGE ); |
| 2599 | _entityFlag[flagIndex] = true; |
| 2600 | } |
| 2601 | _restrictedEntityFlag[static_cast<unsigned char>('&')] = true; |
| 2602 | _restrictedEntityFlag[static_cast<unsigned char>('<')] = true; |
| 2603 | _restrictedEntityFlag[static_cast<unsigned char>('>')] = true; // not required, but consistency is nice |
| 2604 | _buffer.Push( 0 ); |
| 2605 | } |
| 2606 | |
| 2607 | |
| 2608 | void XMLPrinter::Print( const char* format, ... ) |