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