summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_core/src/tinyxml2.cpp17
-rw-r--r--src/mir_core/src/tinyxml2.h19
2 files changed, 35 insertions, 1 deletions
diff --git a/src/mir_core/src/tinyxml2.cpp b/src/mir_core/src/tinyxml2.cpp
index c5c4870105..e4fa10d360 100644
--- a/src/mir_core/src/tinyxml2.cpp
+++ b/src/mir_core/src/tinyxml2.cpp
@@ -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__)
@@ -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;
}
@@ -1195,6 +1196,7 @@ char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr )
}
InsertEndChild( node );
}
+ _document->_bytesParsed = (int)(p-_document->_charBuffer);
return 0;
}
@@ -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];
@@ -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];
@@ -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 ) );
diff --git a/src/mir_core/src/tinyxml2.h b/src/mir_core/src/tinyxml2.h
index 7586f7b8d0..cd88152b7d 100644
--- a/src/mir_core/src/tinyxml2.h
+++ b/src/mir_core/src/tinyxml2.h
@@ -1225,6 +1225,8 @@ public:
/// 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.
@@ -1469,6 +1471,10 @@ public:
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 );
@@ -1585,6 +1591,7 @@ public:
@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.
@@ -1795,6 +1802,9 @@ public:
Whitespace WhitespaceMode() const {
return _whitespaceMode;
}
+ int BytesParsed() const {
+ return _bytesParsed;
+ }
/**
Returns true if this document has a leading Byte Order Mark of UTF8.
@@ -1943,6 +1953,7 @@ private:
int _errorLineNum;
char* _charBuffer;
int _parseCurLineNum;
+ int _bytesParsed;
int _parsingDepth;
// Memory tracking does add some overhead.
// However, the code assumes that you don't
@@ -2071,6 +2082,10 @@ public:
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 );
@@ -2149,6 +2164,10 @@ public:
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 );
}