Added SetForceCompactMode() for overriding the compact setting on a per-node level. All sub-nodes will be printed compact as well.

This commit is contained in:
Uli Kusterer
2014-02-01 12:48:51 +01:00
parent 5bb2d8079b
commit d5c9e8b81d
3 changed files with 34 additions and 7 deletions

View File

@@ -821,6 +821,9 @@ public:
// internal
virtual char* ParseDeep( char*, StrPair* );
bool GetForceCompactMode() const { if( _forceCompactMode || !Parent() ) return _forceCompactMode; return Parent()->GetForceCompactMode(); };
void SetForceCompactMode( bool b ) { _forceCompactMode = b; };
protected:
XMLNode( XMLDocument* );
@@ -837,6 +840,8 @@ protected:
XMLNode* _prev;
XMLNode* _next;
bool _forceCompactMode;
private:
MemPool* _memPool;
@@ -1463,7 +1468,7 @@ public:
char* ParseDeep( char* p, StrPair* endTag );
virtual XMLNode* ShallowClone( XMLDocument* document ) const;
virtual bool ShallowEqual( const XMLNode* compare ) const;
private:
XMLElement( XMLDocument* doc );
virtual ~XMLElement();
@@ -1961,7 +1966,7 @@ public:
/** If streaming, start writing an element.
The element must be closed with CloseElement()
*/
void OpenElement( const char* name );
void OpenElement( const char* name, bool compactMode );
/// If streaming, add an attribute to an open element.
void PushAttribute( const char* name, const char* value );
void PushAttribute( const char* name, int value );