From 2d7fd070323ab3a9623702c67bece350fce4ab68 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 14 Feb 2019 18:31:52 +0300 Subject: tinyxml2: two wchar_t wrappers added --- libs/win32/mir_core.lib | Bin 449112 -> 450166 bytes libs/win64/mir_core.lib | Bin 453918 -> 455008 bytes src/mir_core/src/mir_core.def | 3 +++ src/mir_core/src/mir_core64.def | 3 +++ src/mir_core/src/tinyxml2.cpp | 14 +++++++++++++- src/mir_core/src/tinyxml2.h | 19 +++++++++++++------ 6 files changed, 32 insertions(+), 7 deletions(-) diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 8034f4299d..c3d3e97184 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 32866cd94e..c47fb2787c 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 13f6a00b9e..5a39a144d7 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1410,3 +1410,6 @@ db_event_edit @1268 ?_errorNames@XMLDocument@tinyxml2@@0PAPBDA @1623 NONAME ?writeBoolFalse@XMLUtil@tinyxml2@@0PBDB @1624 NONAME ?writeBoolTrue@XMLUtil@tinyxml2@@0PBDB @1625 NONAME +?SetText@XMLElement@tinyxml2@@QAEXPB_W@Z @1626 NONAME +?SetAttribute@XMLAttribute@tinyxml2@@QAEXPB_W@Z @1627 NONAME +?SetAttribute@XMLElement@tinyxml2@@QAEXPBDPB_W@Z @1628 NONAME diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 5be8e219d5..8df59970ba 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1410,3 +1410,6 @@ db_event_edit @1268 ?_errorNames@XMLDocument@tinyxml2@@0PAPEBDA @1623 NONAME ?writeBoolFalse@XMLUtil@tinyxml2@@0PEBDEB @1624 NONAME ?writeBoolTrue@XMLUtil@tinyxml2@@0PEBDEB @1625 NONAME +?SetText@XMLElement@tinyxml2@@QEAAXPEB_W@Z @1626 NONAME +?SetAttribute@XMLAttribute@tinyxml2@@QEAAXPEB_W@Z @1627 NONAME +?SetAttribute@XMLElement@tinyxml2@@QEAAXPEBDPEB_W@Z @1628 NONAME diff --git a/src/mir_core/src/tinyxml2.cpp b/src/mir_core/src/tinyxml2.cpp index cfeec08827..a7f94a0153 100644 --- a/src/mir_core/src/tinyxml2.cpp +++ b/src/mir_core/src/tinyxml2.cpp @@ -763,7 +763,7 @@ XMLNode::~XMLNode() const char* XMLNode::Value() const { // Edge case: XMLDocuments don't have a Value. Return null. - if ( this->ToDocument() ) + if ( this == nullptr || this->ToDocument() ) return 0; return _value.GetStr(); } @@ -1447,6 +1447,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]; @@ -1597,6 +1603,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]; diff --git a/src/mir_core/src/tinyxml2.h b/src/mir_core/src/tinyxml2.h index 7cd3127363..7cdd917a2d 100644 --- a/src/mir_core/src/tinyxml2.h +++ b/src/mir_core/src/tinyxml2.h @@ -1205,9 +1205,11 @@ public: /// See QueryIntValue XMLError QueryFloatValue( float* value ) const; - /// Set the attribute to a string value. - void SetAttribute( const char* value ); - /// Set the attribute to value. + /// 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. void SetAttribute( unsigned value ); @@ -1430,7 +1432,11 @@ public: XMLAttribute* a = FindOrCreateAttribute( name ); a->SetAttribute( value ); } - /// Sets the named attribute to 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 ); a->SetAttribute( value ); @@ -1539,8 +1545,9 @@ public: Hullaballoo! @endverbatim */ - void SetText( const char* inText ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. + 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. void SetText( unsigned value ); -- cgit v1.2.3