| 1819 | } |
| 1820 | |
| 1821 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 1822 | _elementJustOpened( false ), |
| 1823 | _firstElement( true ), |
| 1824 | _fp( file ), |
| 1825 | _depth( depth ), |
| 1826 | _textDepth( -1 ), |
| 1827 | _processEntities( true ), |
| 1828 | _compactMode( compact ) { |
| 1829 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 1830 | _entityFlag[i] = false; |
| 1831 | _restrictedEntityFlag[i] = false; |
| 1832 | } |
| 1833 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 1834 | const char entityValue = entities[i].value; |
| 1835 | TIXMLASSERT( 0 <= entityValue && entityValue < ENTITY_RANGE ); |
| 1836 | _entityFlag[ (unsigned char)entityValue ] = true; |
| 1837 | } |
| 1838 | _restrictedEntityFlag[(unsigned char)'&'] = true; |
| 1839 | _restrictedEntityFlag[(unsigned char)'<'] = true; |
| 1840 | _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice |
| 1841 | _buffer.Push( 0 ); |
| 1842 | } |
| 1843 | |
| 1844 | |
| 1845 | void XMLPrinter::Print( const char* format, ... ) { |