mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-30 08:38:15 +01:00
Updating to build with gcc 3.4.2
This commit is contained in:
parent
7d0d6d8cd5
commit
7fc5cea45e
23 changed files with 193 additions and 81 deletions
|
@ -18,6 +18,7 @@ template<class stringT> class Attr_impl;
|
|||
template<class stringT>
|
||||
class Attr : public Node<stringT>
|
||||
{
|
||||
using Node<stringT>::impl_;
|
||||
public:
|
||||
Attr() : Node<stringT>() { }
|
||||
explicit Attr(Attr_impl<stringT>* impl) : Node<stringT>(impl) { }
|
||||
|
|
|
@ -17,6 +17,8 @@ template<class stringT> class Entity_impl;
|
|||
template<class stringT>
|
||||
class Entity : public Node<stringT>
|
||||
{
|
||||
using Node<stringT>::impl;
|
||||
|
||||
public:
|
||||
Entity() : Node<stringT>() { }
|
||||
explicit Entity(Entity_impl<stringT>* impl) : Node<stringT>(impl) { }
|
||||
|
|
|
@ -18,6 +18,8 @@ template<class stringT> class Notation_impl;
|
|||
template<class stringT>
|
||||
class Notation : public Node<stringT>
|
||||
{
|
||||
using Node<stringT>::impl;
|
||||
|
||||
public:
|
||||
Notation() : Node<stringT>() { }
|
||||
explicit Notation(Notation_impl<stringT>* impl) : Node<stringT>(dynamic_cast<Node_impl<stringT>*>(impl)) { }
|
||||
|
|
|
@ -10,6 +10,10 @@ template<class stringT, class string_adaptorT>
|
|||
class DocumentType : public SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef SimpleDOM::DocumentTypeImpl<stringT, string_adaptorT> BaseDT;
|
||||
using BaseDT::ownerDoc_;
|
||||
using BaseDT::getElements;
|
||||
using BaseDT::addDefaultAttr;
|
||||
|
||||
public:
|
||||
DocumentType(const stringT& qualifiedName,
|
||||
const stringT& publicId,
|
||||
|
|
|
@ -15,6 +15,14 @@ template<class stringT, class string_adaptorT>
|
|||
class AttrImpl : public DOM::Attr_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Attr_impl<stringT> AttrT;
|
||||
using AttrT::ownerDoc_;
|
||||
using AttrT::getNodeValue;
|
||||
using AttrT::setNodeValue;
|
||||
using AttrT::getFirstChild;
|
||||
using AttrT::throwIfReadOnly;
|
||||
using AttrT::setOwnerElement;
|
||||
|
||||
public:
|
||||
AttrImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& name) :
|
||||
DOM::Attr_impl<stringT>(),
|
||||
|
|
|
@ -11,6 +11,12 @@ namespace SimpleDOM
|
|||
template<class stringT, class string_adaptorT>
|
||||
class AttrMap : public NamedNodeMapImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef NamedNodeMapImpl<stringT, string_adaptorT> MapT;
|
||||
using MapT::setAttribute;
|
||||
using MapT::setAttributeNS;
|
||||
using MapT::getDefaultAttrs;
|
||||
using MapT::ownerDoc_;
|
||||
|
||||
public:
|
||||
AttrMap(DocumentImpl<stringT, string_adaptorT>* ownerDoc) :
|
||||
NamedNodeMapImpl<stringT, string_adaptorT>(ownerDoc),
|
||||
|
|
|
@ -10,7 +10,15 @@ namespace SimpleDOM
|
|||
template<class stringT, class string_adaptorT>
|
||||
class AttrNSImpl : public AttrImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef typename stringT::size_type size_type;
|
||||
typedef typename stringT::size_type size_type;
|
||||
typedef AttrImpl<stringT, string_adaptorT> AttrT;
|
||||
using AttrT::cloneNode;
|
||||
using AttrT::ownerDoc_;
|
||||
using AttrT::name_;
|
||||
using AttrT::getSpecified;
|
||||
using AttrT::getPrefix;
|
||||
using AttrT::setPrefix;
|
||||
using AttrT::hasPrefix;
|
||||
|
||||
public:
|
||||
AttrNSImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
|
||||
|
|
|
@ -10,6 +10,17 @@ template<class stringT, class string_adaptorT>
|
|||
class CDATASectionImpl : public DOM::CDATASection_impl<stringT>,
|
||||
public CharacterDataImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::CDATASection_impl<stringT> CDATASectionT;
|
||||
using CDATASectionT::splitText;
|
||||
using CDATASectionT::throwIfReadOnly;
|
||||
using CDATASectionT::getLength;
|
||||
using CDATASectionT::getOwnerDoc;
|
||||
using CDATASectionT::getParentNode;
|
||||
using CDATASectionT::getNextSibling;
|
||||
using CDATASectionT::cloneNode;
|
||||
using CDATASectionT::ownerDoc_;
|
||||
using CDATASectionT::getData;
|
||||
|
||||
public:
|
||||
CDATASectionImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& data) :
|
||||
CharacterDataImpl<stringT, string_adaptorT>(ownerDoc, data)
|
||||
|
|
|
@ -11,6 +11,14 @@ template<class stringT, class string_adaptorT>
|
|||
class CharacterDataImpl : virtual public DOM::CharacterData_impl<stringT>,
|
||||
public ChildlessNodeImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::CharacterData_impl<stringT> CharDataT;
|
||||
using CharDataT::appendData;
|
||||
using CharDataT::throwIfReadOnly;
|
||||
using CharDataT::insertData;
|
||||
using CharDataT::deleteData;
|
||||
using CharDataT::replaceData;
|
||||
using CharDataT::setNodeValue;
|
||||
|
||||
public:
|
||||
CharacterDataImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& data) :
|
||||
ChildlessNodeImpl<stringT, string_adaptorT>(ownerDoc),
|
||||
|
|
|
@ -11,6 +11,11 @@ template<class stringT, class string_adaptorT>
|
|||
class CommentImpl : public DOM::Comment_impl<stringT>,
|
||||
public CharacterDataImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Comment_impl<stringT> CommentT;
|
||||
using CommentT::ownerDoc_;
|
||||
using CommentT::cloneNode;
|
||||
using CommentT::getData;
|
||||
|
||||
public:
|
||||
CommentImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& data) :
|
||||
CharacterDataImpl<stringT, string_adaptorT>(ownerDoc, data)
|
||||
|
|
|
@ -10,6 +10,10 @@ template<class stringT, class string_adaptorT>
|
|||
class DocumentFragmentImpl : public DOM::DocumentFragment_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::DocumentFragment_impl<stringT> DocumentFragmentT;
|
||||
using DocumentFragmentT::ownerDoc_;
|
||||
using DocumentFragmentT::getFirstChild;
|
||||
|
||||
public:
|
||||
DocumentFragmentImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc) :
|
||||
DOM::DocumentFragment_impl<stringT>(),
|
||||
|
|
|
@ -41,6 +41,10 @@ class DocumentImpl : public DOM::Document_impl<stringT>,
|
|||
{
|
||||
typedef NodeImpl<stringT, string_adaptorT> NodeImplT;
|
||||
typedef AttrImpl<stringT, string_adaptorT> AttrImplT;
|
||||
typedef DOM::Document_impl<stringT> DocumentImplT;
|
||||
|
||||
using DocumentImplT::node;
|
||||
using DocumentImplT::getFirstChild;
|
||||
|
||||
public:
|
||||
DocumentImpl() :
|
||||
|
|
|
@ -15,6 +15,10 @@ template<class stringT, class string_adaptorT>
|
|||
class DocumentTypeImpl : public DOM::DocumentType_impl<stringT>,
|
||||
public ChildlessNodeImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::DocumentType_impl<stringT> DocumentTypeT;
|
||||
using DocumentTypeT::addRef;
|
||||
using DocumentTypeT::releaseRef;
|
||||
using DocumentTypeT::ownerDoc_;
|
||||
public:
|
||||
DocumentTypeImpl(const stringT& qualifiedName,
|
||||
const stringT& publicId,
|
||||
|
|
|
@ -13,6 +13,12 @@ template<class stringT, class string_adaptorT>
|
|||
class ElementImpl : public DOM::Element_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Element_impl<stringT> ElementT;
|
||||
using ElementT::getElementsByTagName;
|
||||
using ElementT::ownerDoc_;
|
||||
using ElementT::cloneNode;
|
||||
using ElementT::getFirstChild;
|
||||
|
||||
public:
|
||||
ElementImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& tagName) :
|
||||
DOM::Element_impl<stringT>(),
|
||||
|
|
|
@ -10,7 +10,16 @@ namespace SimpleDOM
|
|||
template<class stringT, class string_adaptorT>
|
||||
class ElementNSImpl : public ElementImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef typename stringT::size_type size_type;
|
||||
typedef typename stringT::size_type size_type;
|
||||
typedef ElementImpl<stringT, string_adaptorT> ElementImplT;
|
||||
using ElementImplT::cloneNode;
|
||||
using ElementImplT::ownerDoc_;
|
||||
using ElementImplT::tagName_;
|
||||
using ElementImplT::getPrefix;
|
||||
using ElementImplT::setPrefix;
|
||||
using ElementImplT::hasPrefix;
|
||||
using ElementImplT::throwIfReadOnly;
|
||||
|
||||
public:
|
||||
ElementNSImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
|
||||
const stringT& namespaceURI,
|
||||
|
|
|
@ -11,6 +11,11 @@ template<class stringT, class string_adaptorT>
|
|||
class EntityImpl : public DOM::Entity_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Entity_impl<stringT> EntityT;
|
||||
using EntityT::ownerDoc_;
|
||||
using EntityT::getFirstChild;
|
||||
using EntityT::cloneNode;
|
||||
|
||||
public:
|
||||
EntityImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
|
||||
stringT name,
|
||||
|
|
|
@ -10,6 +10,10 @@ template<class stringT, class string_adaptorT>
|
|||
class EntityReferenceImpl : public DOM::EntityReference_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::EntityReference_impl<stringT> EntityReferenceT;
|
||||
using EntityReferenceT::ownerDoc_;
|
||||
using EntityReferenceT::readOnly_;
|
||||
|
||||
public:
|
||||
EntityReferenceImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT name) :
|
||||
DOM::EntityReference_impl<stringT>(),
|
||||
|
|
|
@ -11,6 +11,9 @@ template<class stringT, class string_adaptorT>
|
|||
class NotationImpl : public DOM::Notation_impl<stringT>,
|
||||
public NodeImplWithChildren<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Notation_impl<stringT> NotationT;
|
||||
using NotationT::ownerDoc_;
|
||||
|
||||
public:
|
||||
NotationImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
|
||||
stringT name,
|
||||
|
|
|
@ -11,6 +11,11 @@ template<class stringT, class string_adaptorT>
|
|||
class ProcessingInstructionImpl : public DOM::ProcessingInstruction_impl<stringT>,
|
||||
public ChildlessNodeImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::ProcessingInstruction_impl<stringT> ProcessingInstructionT;
|
||||
using ProcessingInstructionT::setNodeValue;
|
||||
using ProcessingInstructionT::throwIfReadOnly;
|
||||
using ProcessingInstructionT::ownerDoc_;
|
||||
|
||||
public:
|
||||
ProcessingInstructionImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc,
|
||||
stringT target,
|
||||
|
|
|
@ -11,6 +11,17 @@ template<class stringT, class string_adaptorT>
|
|||
class TextImpl : public DOM::Text_impl<stringT>,
|
||||
public CharacterDataImpl<stringT, string_adaptorT>
|
||||
{
|
||||
typedef DOM::Text_impl<stringT> TextT;
|
||||
using TextT::splitText;
|
||||
using TextT::throwIfReadOnly;
|
||||
using TextT::getLength;
|
||||
using TextT::getOwnerDoc;
|
||||
using TextT::getParentNode;
|
||||
using TextT::getNextSibling;
|
||||
using TextT::cloneNode;
|
||||
using TextT::ownerDoc_;
|
||||
using TextT::getData;
|
||||
|
||||
public:
|
||||
TextImpl(DocumentImpl<stringT, string_adaptorT>* ownerDoc, const stringT& data) :
|
||||
DOM::Text_impl<stringT>(),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
####################################
|
||||
# ARABICA CONFIG
|
||||
# edit for your parser choice - may include more than one USE_*
|
||||
PARSER_CONFIG = -DUSE_LIBXML2
|
||||
PARSER_CONFIG = -DUSE_EXPAT -DARABICA_NO_WCHAR_T
|
||||
#PARSER_CONFIG = -DUSE_EXPAT -DUSE_LIBXML2 -DUSE_XERCES -DUSE_GARDEN
|
||||
|
||||
####################################
|
||||
|
@ -9,13 +9,13 @@ PARSER_CONFIG = -DUSE_LIBXML2
|
|||
#####
|
||||
MAKE = make
|
||||
# C++ compiler
|
||||
CXX = gcc
|
||||
CXX = /home/jez/gcc-3.4.2/bin/gcc
|
||||
# preprocessor
|
||||
CPP = gcc -E
|
||||
CPP = /home/jez/gcc-3.4.2/bin/gcc -E
|
||||
# linker
|
||||
LD = gcc
|
||||
LD = /home/jez/gcc-3.4.2/bin/gcc
|
||||
# archiver
|
||||
AR = ar r
|
||||
AR = /home/jez/gcc-3.4.2/bin/ar r
|
||||
|
||||
###########
|
||||
# Utilities
|
||||
|
@ -33,18 +33,17 @@ CXXFLAGS = -Wall
|
|||
LDFLAGS =
|
||||
|
||||
# Includes and library directories
|
||||
INCS_DIRS = -I.. -I/usr/include/libxml2
|
||||
LIBS_DIRS =
|
||||
INCS_DIRS = -I.. -I/home/jez/gcc-3.4.2/include
|
||||
LIBS_DIRS = -I/home/jez/gcc-3.4.2/lib
|
||||
|
||||
# OSX includes libxml2
|
||||
STATIC_LIBS =
|
||||
DYNAMIC_LIBS = -lxml2 -lstdc++
|
||||
DYNAMIC_LIBS = -lexpat -lstdc++
|
||||
|
||||
# link flag to create a shared library
|
||||
LINK_SHARED = -dynamiclib
|
||||
LINK_SHARED = -shared
|
||||
|
||||
EXESUFFIX =
|
||||
LIBSUFFIX = .dylib
|
||||
EXESUFFIX = .exe
|
||||
LIBSUFFIX = .dll
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,14 +26,20 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>,
|
|||
typedef std::basic_ostream<charT, traitsT> ostreamT;
|
||||
typedef basic_XMLReader<stringT> XMLReaderT;
|
||||
typedef basic_XMLFilterImpl<stringT> XMLFilterT;
|
||||
typedef SAX::basic_DeclHandler<stringT> declHandlerT;
|
||||
typedef SAX::basic_LexicalHandler<stringT> lexicalHandlerT;
|
||||
typedef typename basic_XMLFilterImpl<stringT>::AttributesT AttributesT;
|
||||
typedef Arabica::Unicode<charT> UnicodeT;
|
||||
private:
|
||||
typedef basic_LexicalHandler<stringT> LexicalHandlerT;
|
||||
typedef basic_DeclHandler<stringT> DeclHandlerT;
|
||||
typedef typename XMLReaderT::InputSourceT InputSourceT;
|
||||
typedef typename XMLReaderT::PropertyBase PropertyBase;
|
||||
|
||||
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
||||
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
||||
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
||||
typedef typename XMLReaderT::template Property<declHandlerT*> getDeclHandlerT;
|
||||
typedef typename XMLReaderT::template Property<declHandlerT&> setDeclHandlerT;
|
||||
using XMLFilterT::getParent;
|
||||
public:
|
||||
basic_Writer(ostreamT& stream, unsigned int indent = 2) :
|
||||
inCDATA_(false),
|
||||
|
@ -66,8 +72,8 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>,
|
|||
|
||||
protected:
|
||||
// Parser
|
||||
virtual std::auto_ptr<PropertyBase> doGetProperty(const stringT& name);
|
||||
virtual void doSetProperty(const stringT& name, std::auto_ptr<PropertyBase> value);
|
||||
virtual std::auto_ptr<PropertyBaseT> doGetProperty(const stringT& name);
|
||||
virtual void doSetProperty(const stringT& name, std::auto_ptr<PropertyBaseT> value);
|
||||
|
||||
// ContentHandler
|
||||
virtual void startDocument();
|
||||
|
@ -352,23 +358,21 @@ bool basic_Writer<string_type>::isDtd(const string_type& name)
|
|||
|
||||
#ifndef ARABICA_VS6_WORKAROUND
|
||||
template<class string_type>
|
||||
std::auto_ptr<typename basic_Writer<string_type>::PropertyBase> basic_Writer<string_type>::doGetProperty(const string_type& name)
|
||||
std::auto_ptr<typename basic_Writer<string_type>::PropertyBaseT> basic_Writer<string_type>::doGetProperty(const string_type& name)
|
||||
#else
|
||||
template<class string_type>
|
||||
std::auto_ptr<basic_Writer<string_type>::PropertyBase> basic_Writer<string_type>::doGetProperty(const string_type& name)
|
||||
std::auto_ptr<basic_Writer<string_type>::PropertyBaseT> basic_Writer<string_type>::doGetProperty(const string_type& name)
|
||||
#endif
|
||||
{
|
||||
if(name == properties_.lexicalHandler)
|
||||
{
|
||||
XMLReaderT::Property<LexicalHandlerT*>* prop =
|
||||
new XMLReaderT::Property<LexicalHandlerT*>(lexicalHandler_);
|
||||
return std::auto_ptr<PropertyBase>(prop);
|
||||
getLexicalHandlerT* prop = new getLexicalHandlerT(lexicalHandler_);
|
||||
return std::auto_ptr<PropertyBaseT>(prop);
|
||||
}
|
||||
if(name == properties_.declHandler)
|
||||
{
|
||||
XMLReaderT::Property<DeclHandlerT*>* prop =
|
||||
new XMLReaderT::Property<DeclHandlerT*>(declHandler_);
|
||||
return std::auto_ptr<PropertyBase>(prop);
|
||||
getDeclHandlerT* prop = new getDeclHandlerT(declHandler_);
|
||||
return std::auto_ptr<PropertyBaseT>(prop);
|
||||
}
|
||||
|
||||
return XMLFilterT::doGetProperty(name);
|
||||
|
@ -376,26 +380,24 @@ std::auto_ptr<basic_Writer<string_type>::PropertyBase> basic_Writer<string_type>
|
|||
|
||||
#ifndef ARABICA_VS6_WORKAROUND
|
||||
template<class string_type>
|
||||
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<typename basic_Writer<string_type>::PropertyBase> value)
|
||||
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<typename basic_Writer<string_type>::PropertyBaseT> value)
|
||||
#else
|
||||
template<class string_type>
|
||||
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<basic_Writer<string_type>::PropertyBase> value)
|
||||
void basic_Writer<string_type>::doSetProperty(const string_type& name, std::auto_ptr<basic_Writer<string_type>::PropertyBaseT> value)
|
||||
#endif
|
||||
{
|
||||
if(name == properties_.lexicalHandler)
|
||||
{
|
||||
XMLReaderT::Property<LexicalHandlerT&>* prop =
|
||||
dynamic_cast<XMLReaderT::Property<LexicalHandlerT&>*>(value.get());
|
||||
setLexicalHandlerT* prop = dynamic_cast<setLexicalHandlerT*>(value.get());
|
||||
|
||||
if(!prop)
|
||||
throw std::bad_cast();
|
||||
|
||||
lexicalHandler_ = &(prop->get());
|
||||
}
|
||||
if(name == properties_.declHandler)
|
||||
else if(name == properties_.declHandler)
|
||||
{
|
||||
XMLReaderT::Property<DeclHandlerT&>* prop =
|
||||
dynamic_cast<XMLReaderT::Property<DeclHandlerT&>*>(value.get());
|
||||
setDeclHandlerT* prop = dynamic_cast<setDeclHandlerT*>(value.get());
|
||||
|
||||
if(!prop)
|
||||
throw std::bad_cast();
|
||||
|
|
|
@ -94,7 +94,7 @@ private:
|
|||
const XML_Char* attname,
|
||||
const XML_Char* att_type,
|
||||
const XML_Char* dflt,
|
||||
int isrequired) = 0;
|
||||
int isrequired) = 0;
|
||||
virtual void entityDeclaration(const XML_Char* entityName,
|
||||
int is_parameter_entity,
|
||||
const XML_Char* value,
|
||||
|
@ -127,7 +127,7 @@ private:
|
|||
friend void ewim_endElement(void*, const char*);
|
||||
friend void ewim_processingInstruction(void*, const char*, const char*);
|
||||
friend void ewim_elementDeclaration(void*, const XML_Char*, XML_Content*);
|
||||
friend void ewim_attListDeclaration(void*, const XML_Char*, const XML_Char*, const XML_Char*, const XML_Char*, int);
|
||||
friend void ewim_attListDeclaration(void*, const XML_Char*, const XML_Char*, const XML_Char*, const XML_Char*, int);
|
||||
friend void ewim_entityDeclaration(void*, const XML_Char*, int, const XML_Char*, int, const XML_Char*, const XML_Char*, const XML_Char*, const XML_Char*);
|
||||
friend void ewim_notationDeclaration(void*, const XML_Char*, const XML_Char*, const XML_Char*, const XML_Char*);
|
||||
friend void ewim_startDoctypeDecl(void*, const XML_Char*, const XML_Char*, const XML_Char*, int);
|
||||
|
@ -198,7 +198,7 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
|||
public SAX::basic_Locator<string_type>,
|
||||
public expat_wrapper_impl_mumbojumbo::expat2base
|
||||
{
|
||||
public:
|
||||
public:
|
||||
typedef string_type stringT;
|
||||
typedef string_adaptor_type string_adaptorT;
|
||||
typedef SAX::basic_EntityResolver<stringT> entityResolverT;
|
||||
|
@ -211,10 +211,15 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
|||
typedef SAX::basic_NamespaceSupport<stringT, string_adaptorT> namespaceSupportT;
|
||||
typedef SAX::basic_ErrorHandler<stringT> errorHandlerT;
|
||||
typedef SAX::basic_SAXParseException<stringT> SAXParseExceptionT;
|
||||
typedef typename SAX::basic_XMLReader<stringT>::PropertyBase PropertyBaseT;
|
||||
typedef SAX::basic_XMLReader<stringT> XMLReaderT;
|
||||
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
||||
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
||||
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
||||
typedef typename XMLReaderT::template Property<declHandlerT*> getDeclHandlerT;
|
||||
typedef typename XMLReaderT::template Property<declHandlerT&> setDeclHandlerT;
|
||||
|
||||
expat_wrapper();
|
||||
virtual ~expat_wrapper();
|
||||
expat_wrapper();
|
||||
virtual ~expat_wrapper();
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Configuration
|
||||
|
@ -251,7 +256,7 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
|||
protected:
|
||||
virtual std::auto_ptr<PropertyBaseT> doGetProperty(const stringT& name);
|
||||
virtual void doSetProperty(const stringT& name, std::auto_ptr<PropertyBaseT> value);
|
||||
private:
|
||||
private:
|
||||
typename namespaceSupportT::Parts processName(const stringT& qName, bool isAttribute);
|
||||
void reportError(const std::string& message, bool fatal = false);
|
||||
void checkNotParsing(const stringT& type, const stringT& name) const;
|
||||
|
@ -267,7 +272,7 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
|||
const XML_Char* attname,
|
||||
const XML_Char* att_type,
|
||||
const XML_Char* dflt,
|
||||
int isrequired);
|
||||
int isrequired);
|
||||
virtual void entityDeclaration(const XML_Char* entityName,
|
||||
int is_parameter_entity,
|
||||
const XML_Char* value,
|
||||
|
@ -333,10 +338,10 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
|||
// expat wrapper definition
|
||||
template<class stringT, class string_adaptorT>
|
||||
expat_wrapper<stringT, string_adaptorT>::expat_wrapper() :
|
||||
entityResolver_(0),
|
||||
dtdHandler_(0),
|
||||
contentHandler_(0),
|
||||
errorHandler_(0),
|
||||
entityResolver_(0),
|
||||
dtdHandler_(0),
|
||||
contentHandler_(0),
|
||||
errorHandler_(0),
|
||||
declHandler_(0),
|
||||
lexicalHandler_(0),
|
||||
parser_(XML_ParserCreate(0)),
|
||||
|
@ -437,14 +442,14 @@ void expat_wrapper<stringT, string_adaptorT>::parse(inputSourceT& source)
|
|||
parsing_ = true;
|
||||
|
||||
if(contentHandler_)
|
||||
contentHandler_->startDocument();
|
||||
contentHandler_->startDocument();
|
||||
|
||||
XML_SetParamEntityParsing(parser_, externalResolving_ ? XML_PARAM_ENTITY_PARSING_ALWAYS : XML_PARAM_ENTITY_PARSING_NEVER);
|
||||
|
||||
do_parse(source, parser_);
|
||||
|
||||
if(contentHandler_)
|
||||
contentHandler_->endDocument();
|
||||
contentHandler_->endDocument();
|
||||
|
||||
parsing_ = false;
|
||||
} // parse
|
||||
|
@ -453,10 +458,10 @@ template<class stringT, class string_adaptorT>
|
|||
bool expat_wrapper<stringT, string_adaptorT>::do_parse(inputSourceT& source, XML_Parser parser)
|
||||
{
|
||||
InputSourceResolver is(source, SA_);
|
||||
if(is.resolve() == 0)
|
||||
if(is.resolve() == 0)
|
||||
{
|
||||
reportError("Could not resolve XML document", true);
|
||||
return false;
|
||||
return false;
|
||||
} // if(is.resolver() == 0)
|
||||
|
||||
const int BUFF_SIZE = 10*1024;
|
||||
|
@ -490,18 +495,16 @@ std::auto_ptr<expat_wrapper<stringT, string_adaptorT>::PropertyBaseT> expat_wrap
|
|||
{
|
||||
if(name == properties_.lexicalHandler)
|
||||
{
|
||||
SAX::basic_XMLReader<stringT>::Property<lexicalHandlerT*>* prop =
|
||||
new SAX::basic_XMLReader<stringT>::Property<lexicalHandlerT*>(lexicalHandler_);
|
||||
getLexicalHandlerT* prop = new getLexicalHandlerT(lexicalHandler_);
|
||||
return std::auto_ptr<PropertyBaseT>(prop);
|
||||
}
|
||||
else if(name == properties_.declHandler)
|
||||
if(name == properties_.declHandler)
|
||||
{
|
||||
SAX::basic_XMLReader<stringT>::Property<declHandlerT*>* prop =
|
||||
new SAX::basic_XMLReader<stringT>::Property<declHandlerT*>(declHandler_);
|
||||
getDeclHandlerT* prop = new getDeclHandlerT(declHandler_);
|
||||
return std::auto_ptr<PropertyBaseT>(prop);
|
||||
}
|
||||
else
|
||||
throw SAX::SAXNotRecognizedException(std::string("Property not recognized ") + SA_.asStdString(name));
|
||||
|
||||
throw SAX::SAXNotRecognizedException(std::string("Property not recognized ") + SA_.asStdString(name));
|
||||
} // doGetProperty
|
||||
|
||||
template<class stringT, class string_adaptorT>
|
||||
|
@ -509,8 +512,7 @@ void expat_wrapper<stringT, string_adaptorT>::doSetProperty(const stringT& name,
|
|||
{
|
||||
if(name == properties_.lexicalHandler)
|
||||
{
|
||||
SAX::basic_XMLReader<stringT>::Property<lexicalHandlerT&>* prop =
|
||||
dynamic_cast<SAX::basic_XMLReader<stringT>::Property<lexicalHandlerT&>*>(value.get());
|
||||
setLexicalHandlerT* prop = dynamic_cast<setLexicalHandlerT*>(value.get());
|
||||
|
||||
if(!prop)
|
||||
throw std::bad_cast();
|
||||
|
@ -519,8 +521,7 @@ void expat_wrapper<stringT, string_adaptorT>::doSetProperty(const stringT& name,
|
|||
}
|
||||
else if(name == properties_.declHandler)
|
||||
{
|
||||
SAX::basic_XMLReader<stringT>::Property<declHandlerT&>* prop =
|
||||
dynamic_cast<SAX::basic_XMLReader<stringT>::Property<declHandlerT&>*>(value.get());
|
||||
setDeclHandlerT* prop = dynamic_cast<setDeclHandlerT*>(value.get());
|
||||
|
||||
if(!prop)
|
||||
throw std::bad_cast();
|
||||
|
@ -577,9 +578,9 @@ void expat_wrapper<stringT, string_adaptorT>::reportError(const std::string& mes
|
|||
|
||||
SAXParseExceptionT e(message,
|
||||
publicId_,
|
||||
systemId_,
|
||||
XML_GetCurrentLineNumber(parser_),
|
||||
XML_GetCurrentColumnNumber(parser_));
|
||||
systemId_,
|
||||
XML_GetCurrentLineNumber(parser_),
|
||||
XML_GetCurrentColumnNumber(parser_));
|
||||
if(fatal)
|
||||
errorHandler_->fatalError(e);
|
||||
else
|
||||
|
@ -782,11 +783,11 @@ enum XML_Content_Quant {
|
|||
typedef struct XML_cp XML_Content;
|
||||
|
||||
struct XML_cp {
|
||||
enum XML_Content_Type type;
|
||||
enum XML_Content_Quant quant;
|
||||
const XML_Char * name;
|
||||
unsigned int numchildren;
|
||||
XML_Content * children;
|
||||
enum XML_Content_Type type;
|
||||
enum XML_Content_Quant quant;
|
||||
const XML_Char * name;
|
||||
unsigned int numchildren;
|
||||
XML_Content * children;
|
||||
};
|
||||
*/
|
||||
char concatenator = ' ';
|
||||
|
@ -881,13 +882,13 @@ void expat_wrapper<stringT, string_adaptorT>::attListDeclaration(const XML_Char*
|
|||
|
||||
template<class stringT, class string_adaptorT>
|
||||
void expat_wrapper<stringT, string_adaptorT>::entityDeclaration(const XML_Char* entityName,
|
||||
int is_parameter_entity,
|
||||
const XML_Char* value,
|
||||
int value_length,
|
||||
const XML_Char* base,
|
||||
const XML_Char* systemId,
|
||||
const XML_Char* publicId,
|
||||
const XML_Char* notationName)
|
||||
int is_parameter_entity,
|
||||
const XML_Char* value,
|
||||
int value_length,
|
||||
const XML_Char* base,
|
||||
const XML_Char* systemId,
|
||||
const XML_Char* publicId,
|
||||
const XML_Char* notationName)
|
||||
{
|
||||
/* For internal entities (<!ENTITY foo "bar">), value will
|
||||
be non-null and systemId, publicID, and notationName will be null.
|
||||
|
@ -927,9 +928,9 @@ void expat_wrapper<stringT, string_adaptorT>::entityDeclaration(const XML_Char*
|
|||
|
||||
template<class stringT, class string_adaptorT>
|
||||
void expat_wrapper<stringT, string_adaptorT>::notationDeclaration(const XML_Char* notationName,
|
||||
const XML_Char* base,
|
||||
const XML_Char* systemId,
|
||||
const XML_Char* publicId)
|
||||
const XML_Char* base,
|
||||
const XML_Char* systemId,
|
||||
const XML_Char* publicId)
|
||||
{
|
||||
if(!dtdHandler_)
|
||||
return;
|
||||
|
@ -940,9 +941,9 @@ void expat_wrapper<stringT, string_adaptorT>::notationDeclaration(const XML_Char
|
|||
|
||||
template<class stringT, class string_adaptorT>
|
||||
void expat_wrapper<stringT, string_adaptorT>::startDoctypeDecl(const XML_Char *doctypeName,
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
int has_internal_subset)
|
||||
const XML_Char *systemId,
|
||||
const XML_Char *publicId,
|
||||
int has_internal_subset)
|
||||
{
|
||||
if(!lexicalHandler_)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue