From 715dc32be79b6cc5b5cadd3d8714791b0d7a0c0e Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Sun, 13 Apr 2014 23:27:39 +0800 Subject: [PATCH] Replaced std::string with wxString --- src/xmlassociatedtd.cpp | 14 +++++++------- src/xmlassociatedtd.h | 7 ++++--- src/xmlassociatexsd.cpp | 4 ++-- src/xmlassociatexsd.h | 3 ++- src/xmlassociatexsl.cpp | 4 ++-- src/xmlassociatexsl.h | 5 +++-- src/xmlcopyeditor.cpp | 7 ++----- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/xmlassociatedtd.cpp b/src/xmlassociatedtd.cpp index ffe22ec..8f29b34 100644 --- a/src/xmlassociatedtd.cpp +++ b/src/xmlassociatedtd.cpp @@ -25,8 +25,8 @@ #include "xmlassociatedtd.h" XmlAssociateDtd::XmlAssociateDtd ( - const std::string& path, - const std::string& publicIdentifier, + const wxString &path, + const wxString &publicID, const char *encoding, size_t size ) : WrapExpat ( encoding ) @@ -34,7 +34,7 @@ XmlAssociateDtd::XmlAssociateDtd ( { d->buffer.reserve ( size ); d->path = path; - d->publicIdentifier = publicIdentifier; + d->publicID = publicID; d->rootElementSeen = false; d->insideDtd = false; XML_SetUserData ( p, d.get() ); @@ -66,12 +66,12 @@ void XMLCALL XmlAssociateDtd::start ( void *data, if ( !d->rootElementSeen ) { - if ( d->publicIdentifier.empty() ) + if ( d->publicID.empty() ) { d->buffer += "buffer += el; d->buffer += " SYSTEM \""; - d->buffer += d->path; + d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser d->buffer += "\">\n"; } else @@ -79,9 +79,9 @@ void XMLCALL XmlAssociateDtd::start ( void *data, d->buffer += "buffer += el; d->buffer += " PUBLIC \""; - d->buffer += d->publicIdentifier; + d->buffer += d->publicID.utf8_str(); // TODO: Apply the encoding of the parser d->buffer += "\" \""; - d->buffer += d->path; + d->buffer += d->path.utf8_str(); d->buffer += "\">\n"; } d->rootElementSeen = true; diff --git a/src/xmlassociatedtd.h b/src/xmlassociatedtd.h index 2ce85fe..7667126 100644 --- a/src/xmlassociatedtd.h +++ b/src/xmlassociatedtd.h @@ -28,7 +28,8 @@ struct DtdData : public ParserData { - std::string buffer, path, publicIdentifier; + std::string buffer; + wxString path, publicID; bool rootElementSeen, insideDtd; }; @@ -36,8 +37,8 @@ class XmlAssociateDtd : public WrapExpat { public: XmlAssociateDtd ( - const std::string& path = "", - const std::string& publicIdentifier = "", + const wxString &path = wxEmptyString, + const wxString &publicID = wxEmptyString, const char *encoding = NULL, size_t size = BUFSIZ ); virtual ~XmlAssociateDtd(); diff --git a/src/xmlassociatexsd.cpp b/src/xmlassociatexsd.cpp index 77d19b4..a3ad4a5 100644 --- a/src/xmlassociatexsd.cpp +++ b/src/xmlassociatexsd.cpp @@ -35,7 +35,7 @@ XmlAssociateXsd::XmlAssociateXsd ( , d ( new AssociateXsdData() ) { d->buffer.reserve ( size ); - d->path = path.utf8_str(); // TODO: Using the specified "encoding"; + d->path = path; d->rootElementSeen = false; XML_SetElementHandler ( p, start, end ); XML_SetDefaultHandlerExpand ( p, defaulthandler ); @@ -140,7 +140,7 @@ void XMLCALL XmlAssociateXsd::start ( void *data, d->buffer += d->namespaceMap["xmlns"]; d->buffer += " "; } - d->buffer += d->path; + d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser d->buffer += "\""; d->rootElementSeen = true; } diff --git a/src/xmlassociatexsd.h b/src/xmlassociatexsd.h index 6b07fff..de5e14e 100644 --- a/src/xmlassociatexsd.h +++ b/src/xmlassociatexsd.h @@ -30,7 +30,8 @@ struct AssociateXsdData : public ParserData { - std::string buffer, path, namespaceAttribute; + std::string buffer;//, namespaceAttribute; + wxString path; bool rootElementSeen; std::map namespaceMap; }; diff --git a/src/xmlassociatexsl.cpp b/src/xmlassociatexsl.cpp index 3925d03..9ffc558 100644 --- a/src/xmlassociatexsl.cpp +++ b/src/xmlassociatexsl.cpp @@ -25,7 +25,7 @@ #include "xmlassociatexsl.h" XmlAssociateXsl::XmlAssociateXsl ( - const std::string& path, + const wxString &path, const char *encoding, size_t size ) : WrapExpat ( encoding ) @@ -63,7 +63,7 @@ void XMLCALL XmlAssociateXsl::start ( void *data, if ( !d->rootElementSeen ) { d->buffer += "buffer += d->path; + d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser d->buffer += "\"?>\n"; d->rootElementSeen = true; } diff --git a/src/xmlassociatexsl.h b/src/xmlassociatexsl.h index e6b5ea1..473bf04 100644 --- a/src/xmlassociatexsl.h +++ b/src/xmlassociatexsl.h @@ -29,7 +29,8 @@ struct XslData : public ParserData { - std::string buffer, path; + std::string buffer; + wxString path; bool rootElementSeen; }; @@ -37,7 +38,7 @@ class XmlAssociateXsl : public WrapExpat { public: XmlAssociateXsl ( - const std::string& path = "", + const wxString &path = wxEmptyString, const char *encoding = NULL, size_t size = BUFSIZ ); virtual ~XmlAssociateXsl(); diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 7a84f35..c6c18bd 100644 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -5804,8 +5804,6 @@ void MyFrame::OnAssociate ( wxCommandEvent& event ) aux = ad.getAux(); } - std::string utf8Path = ( const char * ) path.mb_str ( wxConvUTF8 ); - std::string modifiedBuffer; // remember choice @@ -5837,15 +5835,14 @@ void MyFrame::OnAssociate ( wxCommandEvent& event ) } else if ( id == ID_ASSOCIATE_DTD_SYSTEM || id == ID_ASSOCIATE_DTD_PUBLIC ) { - XmlAssociateDtd parser ( utf8Path, - ( auxiliaryBox ) ? ( const char * ) aux.mb_str ( wxConvUTF8 ) : "", "UTF-8" ); + XmlAssociateDtd parser ( path, aux, "UTF-8" ); if ( !parser.parse ( utf8Buffer ) ) return; modifiedBuffer = parser.getBuffer(); } else if ( id == ID_ASSOCIATE_XSL ) { - XmlAssociateXsl parser( utf8Path, "UTF-8" ); + XmlAssociateXsl parser( path, "UTF-8" ); if ( !parser.parse ( utf8Buffer ) ) return; modifiedBuffer = parser.getBuffer();