Replaced std::string with wxString

This commit is contained in:
Zane U. Ji 2014-04-13 23:27:39 +08:00
parent 20c6d0ab19
commit 715dc32be7
7 changed files with 22 additions and 22 deletions

View File

@ -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 += "<!DOCTYPE ";
d->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 += "<!DOCTYPE ";
d->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;

View File

@ -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();

View File

@ -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;
}

View File

@ -30,7 +30,8 @@
struct AssociateXsdData : public ParserData
{
std::string buffer, path, namespaceAttribute;
std::string buffer;//, namespaceAttribute;
wxString path;
bool rootElementSeen;
std::map<std::string, std::string> namespaceMap;
};

View File

@ -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 += "<?xml-stylesheet type=\"text/xsl\" href=\"";
d->buffer += d->path;
d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser
d->buffer += "\"?>\n";
d->rootElementSeen = true;
}

View File

@ -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();

View File

@ -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();