Skip to content

Commit

Permalink
tinyxml2: pick up Miranda-specific commits
Browse files Browse the repository at this point in the history
  • Loading branch information
dartraiden committed Jan 1, 2024
1 parent f472169 commit 10f7199
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/mir_core/src/tinyxml2.cpp
Expand Up @@ -21,7 +21,7 @@ must not be misrepresented as being the original software.
distribution.
*/

#include "tinyxml2.h"
#include "stdafx.h"

#include <new> // yes, this one new style header, is in the Android SDK.
#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__)
Expand Down Expand Up @@ -1168,6 +1168,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
}
node->_memPool->SetTracked(); // created and then immediately deleted.
DeleteNode( node );
_document->_bytesParsed = (int)(p-_document->_charBuffer);
return p;
}

Expand Down Expand Up @@ -1195,6 +1196,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
}
InsertEndChild( node );
}
_document->_bytesParsed = (int)(p-_document->_charBuffer);
return 0;
}

Expand Down Expand Up @@ -1555,6 +1557,12 @@ void XMLAttribute::SetAttribute( const char* v )
}


void XMLAttribute::SetAttribute( const wchar_t* v )
{
_value.SetStr( T2Utf(v).get() );
}


void XMLAttribute::SetAttribute( int v )
{
char buf[BUF_SIZE];
Expand Down Expand Up @@ -1728,6 +1736,12 @@ void XMLElement::SetText( const char* inText )
}


void XMLElement::SetText(const wchar_t* inText)
{
SetText( T2Utf(inText).get() );
}


void XMLElement::SetText( int v )
{
char buf[BUF_SIZE];
Expand Down Expand Up @@ -2565,6 +2579,7 @@ void XMLDocument::Parse()
TIXMLASSERT( _charBuffer );
_parseCurLineNum = 1;
_parseLineNum = 1;
_bytesParsed = 0;
char* p = _charBuffer;
p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum );
p = const_cast<char*>( XMLUtil::ReadBOM( p, &_writeBOM ) );
Expand Down
19 changes: 19 additions & 0 deletions src/mir_core/src/tinyxml2.h
Expand Up @@ -1225,6 +1225,8 @@ class TINYXML2_LIB XMLAttribute

/// Set the attribute to a string value.
void SetAttribute( const char* value );
/// Set the attribute to a wide string value.
void SetAttribute( const wchar_t* value );
/// Set the attribute to value.
void SetAttribute( int value );
/// Set the attribute to value.
Expand Down Expand Up @@ -1469,6 +1471,10 @@ class TINYXML2_LIB XMLElement : public XMLNode
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
}
void SetAttribute( const char* name, const wchar_t* value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
a->SetAttribute( value );
}
/// Sets the named attribute to value.
void SetAttribute( const char* name, int value ) {
XMLAttribute* a = FindOrCreateAttribute( name );
Expand Down Expand Up @@ -1585,6 +1591,7 @@ class TINYXML2_LIB XMLElement : public XMLNode
@endverbatim
*/
void SetText( const char* inText );
void SetText( const wchar_t* inText );
/// Convenience method for setting text inside an element. See SetText() for important limitations.
void SetText( int value );
/// Convenience method for setting text inside an element. See SetText() for important limitations.
Expand Down Expand Up @@ -1795,6 +1802,9 @@ class TINYXML2_LIB XMLDocument : public XMLNode
Whitespace WhitespaceMode() const {
return _whitespaceMode;
}
int BytesParsed() const {
return _bytesParsed;
}

/**
Returns true if this document has a leading Byte Order Mark of UTF8.
Expand Down Expand Up @@ -1943,6 +1953,7 @@ class TINYXML2_LIB XMLDocument : public XMLNode
int _errorLineNum;
char* _charBuffer;
int _parseCurLineNum;
int _bytesParsed;
int _parsingDepth;
// Memory tracking does add some overhead.
// However, the code assumes that you don't
Expand Down Expand Up @@ -2071,6 +2082,10 @@ class TINYXML2_LIB XMLHandle
return *this;
}

XMLHandle operator[]( const char* name ) {
return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 );
}

/// Get the first child of this handle.
XMLHandle FirstChild() {
return XMLHandle( _node ? _node->FirstChild() : 0 );
Expand Down Expand Up @@ -2149,6 +2164,10 @@ class TINYXML2_LIB XMLConstHandle
return *this;
}

const XMLConstHandle operator[]( const char* name ) const {
return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 );
}

const XMLConstHandle FirstChild() const {
return XMLConstHandle( _node ? _node->FirstChild() : 0 );
}
Expand Down

0 comments on commit 10f7199

Please sign in to comment.