| 1972 | } |
| 1973 | |
| 1974 | XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : |
| 1975 | _elementJustOpened( false ), |
| 1976 | _firstElement( true ), |
| 1977 | _fp( file ), |
| 1978 | _depth( depth ), |
| 1979 | _textDepth( -1 ), |
| 1980 | _processEntities( true ), |
| 1981 | _compactMode( compact ) |
| 1982 | { |
| 1983 | for( int i=0; i<ENTITY_RANGE; ++i ) { |
| 1984 | _entityFlag[i] = false; |
| 1985 | _restrictedEntityFlag[i] = false; |
| 1986 | } |
| 1987 | for( int i=0; i<NUM_ENTITIES; ++i ) { |
| 1988 | const char entityValue = entities[i].value; |
| 1989 | TIXMLASSERT( 0 <= entityValue && entityValue < ENTITY_RANGE ); |
| 1990 | _entityFlag[ (unsigned char)entityValue ] = true; |
| 1991 | } |
| 1992 | _restrictedEntityFlag[(unsigned char)'&'] = true; |
| 1993 | _restrictedEntityFlag[(unsigned char)'<'] = true; |
| 1994 | _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice |
| 1995 | _buffer.Push( 0 ); |
| 1996 | } |
| 1997 | |
| 1998 | |
| 1999 | void XMLPrinter::Print( const char* format, ... ) |