| 1869 | |
| 1870 | |
| 1871 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 1872 | _elementJustOpened( false ), |
| 1873 | _firstElement( true ), |
| 1874 | _fp( file ), |
| 1875 | _depth( depth ), |
| 1876 | _textDepth( -1 ), |
| 1877 | _processEntities( true ), |
| 1878 | _compactMode( compact ) |
| 1879 | { |
| 1880 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 1881 | _entityFlag[i] = false; |
| 1882 | _restrictedEntityFlag[i] = false; |
| 1883 | } |
| 1884 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 1885 | TIXMLASSERT( entities[i].value < ENTITY_RANGE ); |
| 1886 | if ( entities[i].value < ENTITY_RANGE ) { |
| 1887 | _entityFlag[ (int)entities[i].value ] = true; |
| 1888 | } |
| 1889 | } |
| 1890 | _restrictedEntityFlag[(int)'&'] = true; |
| 1891 | _restrictedEntityFlag[(int)'<'] = true; |
| 1892 | _restrictedEntityFlag[(int)'>'] = true; // not required, but consistency is nice |
| 1893 | _buffer.Push( 0 ); |
| 1894 | } |
| 1895 | |
| 1896 | |
| 1897 | void XMLPrinter::Print( const char* format, ... ) |