| 2382 | } |
| 2383 | |
| 2384 | XMLPrinter::XMLPrinter(FILE* file, bool compact, int depth) : |
| 2385 | _elementJustOpened(false), |
| 2386 | _stack(), |
| 2387 | _firstElement(true), |
| 2388 | _fp(file), |
| 2389 | _depth(depth), |
| 2390 | _textDepth(-1), |
| 2391 | _processEntities(true), |
| 2392 | _compactMode(compact), |
| 2393 | _buffer() |
| 2394 | { |
| 2395 | for (int i = 0; i<ENTITY_RANGE; ++i) { |
| 2396 | _entityFlag[i] = false; |
| 2397 | _restrictedEntityFlag[i] = false; |
| 2398 | } |
| 2399 | for (int i = 0; i<NUM_ENTITIES; ++i) { |
| 2400 | const char entityValue = entities[i].value; |
| 2401 | const unsigned char flagIndex = (unsigned char)entityValue; |
| 2402 | TIXMLASSERT(flagIndex < ENTITY_RANGE); |
| 2403 | _entityFlag[flagIndex] = true; |
| 2404 | } |
| 2405 | _restrictedEntityFlag[(unsigned char)'&'] = true; |
| 2406 | _restrictedEntityFlag[(unsigned char)'<'] = true; |
| 2407 | _restrictedEntityFlag[(unsigned char)'>'] = true; // not required, but consistency is nice |
| 2408 | _buffer.Push(0); |
| 2409 | } |
| 2410 | |
| 2411 | |
| 2412 | void XMLPrinter::Print(const char* format, ...) |