| 2545 | } |
| 2546 | |
| 2547 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 2548 | _elementJustOpened( false ), |
| 2549 | _stack(), |
| 2550 | _firstElement( true ), |
| 2551 | _fp( file ), |
| 2552 | _depth( depth ), |
| 2553 | _textDepth( -1 ), |
| 2554 | _processEntities( true ), |
| 2555 | _compactMode( compact ), |
| 2556 | _buffer() |
| 2557 | { |
| 2558 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 2559 | _entityFlag[i] = false; |
| 2560 | _restrictedEntityFlag[i] = false; |
| 2561 | } |
| 2562 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 2563 | const char entityValue = entities[i].value; |
| 2564 | const unsigned char flagIndex = static_cast<unsigned char>(entityValue); |
| 2565 | TIXMLASSERT( flagIndex < ENTITY_RANGE ); |
| 2566 | _entityFlag[flagIndex] = true; |
| 2567 | } |
| 2568 | _restrictedEntityFlag[static_cast<unsigned char>('&')] = true; |
| 2569 | _restrictedEntityFlag[static_cast<unsigned char>('<')] = true; |
| 2570 | _restrictedEntityFlag[static_cast<unsigned char>('>')] = true; // not required, but consistency is nice |
| 2571 | _buffer.Push( 0 ); |
| 2572 | } |
| 2573 | |
| 2574 | |
| 2575 | void XMLPrinter::Print( const char* format, ... ) |