Replaced std::string with wxString
This commit is contained in:
parent
20c6d0ab19
commit
715dc32be7
|
@ -25,8 +25,8 @@
|
||||||
#include "xmlassociatedtd.h"
|
#include "xmlassociatedtd.h"
|
||||||
|
|
||||||
XmlAssociateDtd::XmlAssociateDtd (
|
XmlAssociateDtd::XmlAssociateDtd (
|
||||||
const std::string& path,
|
const wxString &path,
|
||||||
const std::string& publicIdentifier,
|
const wxString &publicID,
|
||||||
const char *encoding,
|
const char *encoding,
|
||||||
size_t size )
|
size_t size )
|
||||||
: WrapExpat ( encoding )
|
: WrapExpat ( encoding )
|
||||||
|
@ -34,7 +34,7 @@ XmlAssociateDtd::XmlAssociateDtd (
|
||||||
{
|
{
|
||||||
d->buffer.reserve ( size );
|
d->buffer.reserve ( size );
|
||||||
d->path = path;
|
d->path = path;
|
||||||
d->publicIdentifier = publicIdentifier;
|
d->publicID = publicID;
|
||||||
d->rootElementSeen = false;
|
d->rootElementSeen = false;
|
||||||
d->insideDtd = false;
|
d->insideDtd = false;
|
||||||
XML_SetUserData ( p, d.get() );
|
XML_SetUserData ( p, d.get() );
|
||||||
|
@ -66,12 +66,12 @@ void XMLCALL XmlAssociateDtd::start ( void *data,
|
||||||
|
|
||||||
if ( !d->rootElementSeen )
|
if ( !d->rootElementSeen )
|
||||||
{
|
{
|
||||||
if ( d->publicIdentifier.empty() )
|
if ( d->publicID.empty() )
|
||||||
{
|
{
|
||||||
d->buffer += "<!DOCTYPE ";
|
d->buffer += "<!DOCTYPE ";
|
||||||
d->buffer += el;
|
d->buffer += el;
|
||||||
d->buffer += " SYSTEM \"";
|
d->buffer += " SYSTEM \"";
|
||||||
d->buffer += d->path;
|
d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser
|
||||||
d->buffer += "\">\n";
|
d->buffer += "\">\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -79,9 +79,9 @@ void XMLCALL XmlAssociateDtd::start ( void *data,
|
||||||
d->buffer += "<!DOCTYPE ";
|
d->buffer += "<!DOCTYPE ";
|
||||||
d->buffer += el;
|
d->buffer += el;
|
||||||
d->buffer += " PUBLIC \"";
|
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->buffer += d->path;
|
d->buffer += d->path.utf8_str();
|
||||||
d->buffer += "\">\n";
|
d->buffer += "\">\n";
|
||||||
}
|
}
|
||||||
d->rootElementSeen = true;
|
d->rootElementSeen = true;
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
struct DtdData : public ParserData
|
struct DtdData : public ParserData
|
||||||
{
|
{
|
||||||
std::string buffer, path, publicIdentifier;
|
std::string buffer;
|
||||||
|
wxString path, publicID;
|
||||||
bool rootElementSeen, insideDtd;
|
bool rootElementSeen, insideDtd;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -36,8 +37,8 @@ class XmlAssociateDtd : public WrapExpat
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XmlAssociateDtd (
|
XmlAssociateDtd (
|
||||||
const std::string& path = "",
|
const wxString &path = wxEmptyString,
|
||||||
const std::string& publicIdentifier = "",
|
const wxString &publicID = wxEmptyString,
|
||||||
const char *encoding = NULL,
|
const char *encoding = NULL,
|
||||||
size_t size = BUFSIZ );
|
size_t size = BUFSIZ );
|
||||||
virtual ~XmlAssociateDtd();
|
virtual ~XmlAssociateDtd();
|
||||||
|
|
|
@ -35,7 +35,7 @@ XmlAssociateXsd::XmlAssociateXsd (
|
||||||
, d ( new AssociateXsdData() )
|
, d ( new AssociateXsdData() )
|
||||||
{
|
{
|
||||||
d->buffer.reserve ( size );
|
d->buffer.reserve ( size );
|
||||||
d->path = path.utf8_str(); // TODO: Using the specified "encoding";
|
d->path = path;
|
||||||
d->rootElementSeen = false;
|
d->rootElementSeen = false;
|
||||||
XML_SetElementHandler ( p, start, end );
|
XML_SetElementHandler ( p, start, end );
|
||||||
XML_SetDefaultHandlerExpand ( p, defaulthandler );
|
XML_SetDefaultHandlerExpand ( p, defaulthandler );
|
||||||
|
@ -140,7 +140,7 @@ void XMLCALL XmlAssociateXsd::start ( void *data,
|
||||||
d->buffer += d->namespaceMap["xmlns"];
|
d->buffer += d->namespaceMap["xmlns"];
|
||||||
d->buffer += " ";
|
d->buffer += " ";
|
||||||
}
|
}
|
||||||
d->buffer += d->path;
|
d->buffer += d->path.utf8_str(); // TODO: Apply the encoding of the parser
|
||||||
d->buffer += "\"";
|
d->buffer += "\"";
|
||||||
d->rootElementSeen = true;
|
d->rootElementSeen = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
struct AssociateXsdData : public ParserData
|
struct AssociateXsdData : public ParserData
|
||||||
{
|
{
|
||||||
std::string buffer, path, namespaceAttribute;
|
std::string buffer;//, namespaceAttribute;
|
||||||
|
wxString path;
|
||||||
bool rootElementSeen;
|
bool rootElementSeen;
|
||||||
std::map<std::string, std::string> namespaceMap;
|
std::map<std::string, std::string> namespaceMap;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include "xmlassociatexsl.h"
|
#include "xmlassociatexsl.h"
|
||||||
|
|
||||||
XmlAssociateXsl::XmlAssociateXsl (
|
XmlAssociateXsl::XmlAssociateXsl (
|
||||||
const std::string& path,
|
const wxString &path,
|
||||||
const char *encoding,
|
const char *encoding,
|
||||||
size_t size )
|
size_t size )
|
||||||
: WrapExpat ( encoding )
|
: WrapExpat ( encoding )
|
||||||
|
@ -63,7 +63,7 @@ void XMLCALL XmlAssociateXsl::start ( void *data,
|
||||||
if ( !d->rootElementSeen )
|
if ( !d->rootElementSeen )
|
||||||
{
|
{
|
||||||
d->buffer += "<?xml-stylesheet type=\"text/xsl\" href=\"";
|
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->buffer += "\"?>\n";
|
||||||
d->rootElementSeen = true;
|
d->rootElementSeen = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,8 @@
|
||||||
|
|
||||||
struct XslData : public ParserData
|
struct XslData : public ParserData
|
||||||
{
|
{
|
||||||
std::string buffer, path;
|
std::string buffer;
|
||||||
|
wxString path;
|
||||||
bool rootElementSeen;
|
bool rootElementSeen;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ class XmlAssociateXsl : public WrapExpat
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
XmlAssociateXsl (
|
XmlAssociateXsl (
|
||||||
const std::string& path = "",
|
const wxString &path = wxEmptyString,
|
||||||
const char *encoding = NULL,
|
const char *encoding = NULL,
|
||||||
size_t size = BUFSIZ );
|
size_t size = BUFSIZ );
|
||||||
virtual ~XmlAssociateXsl();
|
virtual ~XmlAssociateXsl();
|
||||||
|
|
|
@ -5804,8 +5804,6 @@ void MyFrame::OnAssociate ( wxCommandEvent& event )
|
||||||
aux = ad.getAux();
|
aux = ad.getAux();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string utf8Path = ( const char * ) path.mb_str ( wxConvUTF8 );
|
|
||||||
|
|
||||||
std::string modifiedBuffer;
|
std::string modifiedBuffer;
|
||||||
|
|
||||||
// remember choice
|
// remember choice
|
||||||
|
@ -5837,15 +5835,14 @@ void MyFrame::OnAssociate ( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
else if ( id == ID_ASSOCIATE_DTD_SYSTEM || id == ID_ASSOCIATE_DTD_PUBLIC )
|
else if ( id == ID_ASSOCIATE_DTD_SYSTEM || id == ID_ASSOCIATE_DTD_PUBLIC )
|
||||||
{
|
{
|
||||||
XmlAssociateDtd parser ( utf8Path,
|
XmlAssociateDtd parser ( path, aux, "UTF-8" );
|
||||||
( auxiliaryBox ) ? ( const char * ) aux.mb_str ( wxConvUTF8 ) : "", "UTF-8" );
|
|
||||||
if ( !parser.parse ( utf8Buffer ) )
|
if ( !parser.parse ( utf8Buffer ) )
|
||||||
return;
|
return;
|
||||||
modifiedBuffer = parser.getBuffer();
|
modifiedBuffer = parser.getBuffer();
|
||||||
}
|
}
|
||||||
else if ( id == ID_ASSOCIATE_XSL )
|
else if ( id == ID_ASSOCIATE_XSL )
|
||||||
{
|
{
|
||||||
XmlAssociateXsl parser( utf8Path, "UTF-8" );
|
XmlAssociateXsl parser( path, "UTF-8" );
|
||||||
if ( !parser.parse ( utf8Buffer ) )
|
if ( !parser.parse ( utf8Buffer ) )
|
||||||
return;
|
return;
|
||||||
modifiedBuffer = parser.getBuffer();
|
modifiedBuffer = parser.getBuffer();
|
||||||
|
|
Loading…
Reference in New Issue