From f4453c647dfbcefe46b55c8294034ec4289e6926 Mon Sep 17 00:00:00 2001 From: jez <> Date: Wed, 20 Sep 2006 13:57:50 +0000 Subject: [PATCH] had inadvertantly broken the MSXML build --- include/SAX/wrappers/saxmsxml2.h | 333 ++++++++++++++++--------------- 1 file changed, 168 insertions(+), 165 deletions(-) diff --git a/include/SAX/wrappers/saxmsxml2.h b/include/SAX/wrappers/saxmsxml2.h index 3b557cb4..a9b69c09 100644 --- a/include/SAX/wrappers/saxmsxml2.h +++ b/include/SAX/wrappers/saxmsxml2.h @@ -62,7 +62,7 @@ class COMExternalInitializer : public COMInitializer_tag class COMSingleThreadInitializer : public COMInitializer_tag { public: - COMSingleThreadInitializer() { ::CoInitialize(NULL); } + COMSingleThreadInitializer() { ::CoInitialize(NULL); } ~COMSingleThreadInitializer() { ::CoUninitialize(); } }; // COMSingleThreadInitializer @@ -80,79 +80,82 @@ template class msxml2_wrapper : public SAX::basic_XMLReader { - typedef typename Arabica::get_param::type COMInitializer_type; - typedef typename Arabica::get_param, T0, T1>::type string_adaptor_type; + typedef typename Arabica::get_param, + T0, + T1>::type string_adaptor_type; + typedef typename Arabica::get_param::type COMInitializer_type; public: - typedef string_type stringT; - typedef string_adaptor_type string_adaptorT; - typedef SAX::basic_EntityResolver entityResolverT; - typedef SAX::basic_DTDHandler dtdHandlerT; - typedef SAX::basic_ContentHandler contentHandlerT; - typedef SAX::basic_DeclHandler declHandlerT; - typedef SAX::basic_LexicalHandler lexicalHandlerT; - typedef SAX::basic_InputSource inputSourceT; - typedef SAX::basic_Locator locatorT; - typedef SAX::basic_ErrorHandler errorHandlerT; - typedef COMInitializer_type COMInitializerT; + typedef SAX::basic_EntityResolver entityResolverT; + typedef SAX::basic_DTDHandler dtdHandlerT; + typedef SAX::basic_ContentHandler contentHandlerT; + typedef SAX::basic_DeclHandler declHandlerT; + typedef SAX::basic_LexicalHandler lexicalHandlerT; + typedef SAX::basic_InputSource inputSourceT; + typedef SAX::basic_Locator locatorT; + typedef SAX::basic_ErrorHandler errorHandlerT; msxml2_wrapper(); virtual ~msxml2_wrapper(); ///////////////////////////////////////////////// // Configuration - virtual bool getFeature(const stringT& name) const; - virtual void setFeature(const stringT& name, bool value); + virtual bool getFeature(const string_type& name) const; + virtual void setFeature(const string_type& name, bool value); ///////////////////////////////////////////////// // Event Handlers /* MSXML does not use EntityResolver currently */ - virtual void setEntityResolver(SAX::basic_EntityResolver& resolver) { } - virtual SAX::basic_EntityResolver* getEntityResolver() const { return 0; } - virtual void setDTDHandler(SAX::basic_DTDHandler& handler) { dtdHandler_.setDTDHandler(handler); } - virtual SAX::basic_DTDHandler* getDTDHandler() const { return dtdHandler_.getDTDHandler(); } - virtual void setContentHandler(SAX::basic_ContentHandler& handler) { contentHandler_.setContentHandler(handler); } - virtual SAX::basic_ContentHandler* getContentHandler() const { return contentHandler_.getContentHandler(); } - virtual void setErrorHandler(SAX::basic_ErrorHandler& handler); - virtual SAX::basic_ErrorHandler* getErrorHandler() const; + virtual void setEntityResolver(SAX::basic_EntityResolver& resolver) { } + virtual SAX::basic_EntityResolver* getEntityResolver() const { return 0; } + virtual void setDTDHandler(SAX::basic_DTDHandler& handler) { dtdHandler_.setDTDHandler(handler); } + virtual SAX::basic_DTDHandler* getDTDHandler() const { return dtdHandler_.getDTDHandler(); } + virtual void setContentHandler(SAX::basic_ContentHandler& handler) { contentHandler_.setContentHandler(handler); } + virtual SAX::basic_ContentHandler* getContentHandler() const { return contentHandler_.getContentHandler(); } + virtual void setErrorHandler(SAX::basic_ErrorHandler& handler); + virtual SAX::basic_ErrorHandler* getErrorHandler() const; ////////////////////////////////////////////////// // Parsing - virtual void parse(SAX::basic_InputSource& input); + virtual void parse(SAX::basic_InputSource& input); protected: - virtual std::auto_ptr::PropertyBase> doGetProperty(const stringT& name); - virtual void doSetProperty(const stringT& name, std::auto_ptr::PropertyBase> value); + virtual std::auto_ptr::PropertyBase> doGetProperty(const string_type& name); + virtual void doSetProperty(const string_type& name, std::auto_ptr::PropertyBase> value); private: ////////////////////////////////////////////////////// // COM interface -> C++ interface adaptors - class LocatorAdaptor : public SAX::basic_Locator + class LocatorAdaptor : public SAX::basic_Locator { public: LocatorAdaptor() : locator_(0) { } LocatorAdaptor(ISAXLocator __RPC_FAR* locator) : locator_(0) { setLocator(locator); } ~LocatorAdaptor() { setLocator(0); } - stringT getPublicId() const + string_type getPublicId() const { if(!locator_) - return stringT(); + return string_type(); const wchar_t* pwchPublicId; locator_->getPublicId(&pwchPublicId); - stringT publicId(string_adaptorT::construct_from_utf16(pwchPublicId)); + string_type publicId(string_adaptor_type::construct_from_utf16(pwchPublicId)); return publicId; } // getPublicId - stringT getSystemId() const + string_type getSystemId() const { if(!locator_) - return stringT(); + return string_type(); const wchar_t* pwchSystemId; locator_->getSystemId(&pwchSystemId); - stringT systemId(string_adaptorT::construct_from_utf16(pwchSystemId)); + string_type systemId(string_adaptor_type::construct_from_utf16(pwchSystemId)); return systemId; } // getSystemId @@ -193,8 +196,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader DTDHandlerAdaptor() : dtdHandler_(0) { } ~DTDHandlerAdaptor() { } - void setDTDHandler(SAX::basic_DTDHandler& handler) { dtdHandler_ = &handler; } - SAX::basic_DTDHandler* getDTDHandler() const { return dtdHandler_; } + void setDTDHandler(SAX::basic_DTDHandler& handler) { dtdHandler_ = &handler; } + SAX::basic_DTDHandler* getDTDHandler() const { return dtdHandler_; } virtual HRESULT STDMETHODCALLTYPE notationDecl( /* [in] */ const wchar_t *pwchName, @@ -205,9 +208,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchSystemId) { if(dtdHandler_) - dtdHandler_->notationDecl(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId), - string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId)); + dtdHandler_->notationDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId), + string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId)); return S_OK; } // notationDecl @@ -222,10 +225,10 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchNotationName) { if(dtdHandler_) - dtdHandler_->unparsedEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId), - string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId), - string_adaptorT::construct_from_utf16(pwchNotationName, cchNotationName)); + dtdHandler_->unparsedEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId), + string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId), + string_adaptor_type::construct_from_utf16(pwchNotationName, cchNotationName)); return S_OK; } // unparsedEntityDecl @@ -235,7 +238,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader unsigned long __stdcall Release() { return 0; } private: - SAX::basic_DTDHandler* dtdHandler_; + SAX::basic_DTDHandler* dtdHandler_; }; // class DTDHandlerAdaptor class ContentHandlerAdaptor : public ISAXContentHandler @@ -244,8 +247,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader ContentHandlerAdaptor() : contentHandler_(0) { } ~ContentHandlerAdaptor() { } - void setContentHandler(SAX::basic_ContentHandler& handler) { contentHandler_ = &handler; } - SAX::basic_ContentHandler* getContentHandler() const { return contentHandler_; } + void setContentHandler(SAX::basic_ContentHandler& handler) { contentHandler_ = &handler; } + SAX::basic_ContentHandler* getContentHandler() const { return contentHandler_; } virtual HRESULT STDMETHODCALLTYPE putDocumentLocator( @@ -276,8 +279,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader { if(contentHandler_) - contentHandler_->startPrefixMapping(string_adaptorT::construct_from_utf16(pwchPrefix, cchPrefix), - string_adaptorT::construct_from_utf16(pwchUri, cchUri)); + contentHandler_->startPrefixMapping(string_adaptor_type::construct_from_utf16(pwchPrefix, cchPrefix), + string_adaptor_type::construct_from_utf16(pwchUri, cchUri)); return S_OK; } // startPrefixMapping @@ -285,7 +288,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ const wchar_t *pwchPrefix, /* [in] */ int cchPrefix) { - if(contentHandler_) contentHandler_->endPrefixMapping(string_adaptorT::construct_from_utf16(pwchPrefix, cchPrefix)); + if(contentHandler_) contentHandler_->endPrefixMapping(string_adaptor_type::construct_from_utf16(pwchPrefix, cchPrefix)); return S_OK; } // endPrefixMapping @@ -301,9 +304,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader if(contentHandler_) { AttributesAdaptor attrs(pAttributes); - contentHandler_->startElement(string_adaptorT::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri), - string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName), - string_adaptorT::construct_from_utf16(pwchQName, cchQName), + contentHandler_->startElement(string_adaptor_type::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri), + string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName), + string_adaptor_type::construct_from_utf16(pwchQName, cchQName), attrs); } // if ... return S_OK; @@ -318,9 +321,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchQName) { if(contentHandler_) - contentHandler_->endElement(string_adaptorT::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri), - string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName), - string_adaptorT::construct_from_utf16(pwchQName, cchQName)); + contentHandler_->endElement(string_adaptor_type::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri), + string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName), + string_adaptor_type::construct_from_utf16(pwchQName, cchQName)); return S_OK; } // endElement @@ -328,7 +331,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ const wchar_t *pwchChars, /* [in] */ int cchChars) { - if(contentHandler_) contentHandler_->characters(string_adaptorT::construct_from_utf16(pwchChars, cchChars)); + if(contentHandler_) contentHandler_->characters(string_adaptor_type::construct_from_utf16(pwchChars, cchChars)); return S_OK; } // characters @@ -337,7 +340,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchChars) { if(contentHandler_) - contentHandler_->ignorableWhitespace(string_adaptorT::construct_from_utf16(pwchChars, cchChars)); + contentHandler_->ignorableWhitespace(string_adaptor_type::construct_from_utf16(pwchChars, cchChars)); return S_OK; } // ignorableWhitespace @@ -348,8 +351,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchData) { if(contentHandler_) - contentHandler_->processingInstruction(string_adaptorT::construct_from_utf16(pwchTarget, cchTarget), - string_adaptorT::construct_from_utf16(pwchData, cchData)); + contentHandler_->processingInstruction(string_adaptor_type::construct_from_utf16(pwchTarget, cchTarget), + string_adaptor_type::construct_from_utf16(pwchData, cchData)); return S_OK; } // processingInstruction @@ -358,7 +361,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchName) { if(contentHandler_) - contentHandler_->skippedEntity(string_adaptorT::construct_from_utf16(pwchName, cchName)); + contentHandler_->skippedEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName)); return S_OK; } // skippedEntity @@ -370,12 +373,12 @@ class msxml2_wrapper : public SAX::basic_XMLReader private: //////////////////////////////////////////////// // member varaibles - SAX::basic_ContentHandler* contentHandler_; + SAX::basic_ContentHandler* contentHandler_; LocatorAdaptor locator_; ////////////////////////////////////////////////////// // COM interface -> C++ interface adaptors - class AttributesAdaptor : public SAX::basic_Attributes + class AttributesAdaptor : public SAX::basic_Attributes { public: AttributesAdaptor(ISAXAttributes __RPC_FAR *pAttributes) : attributes_(pAttributes) { } @@ -390,135 +393,135 @@ class msxml2_wrapper : public SAX::basic_XMLReader return length; } // getLength - virtual stringT getURI(unsigned int index) const + virtual string_type getURI(unsigned int index) const { const wchar_t* pwchUri; int cchUri; HRESULT hr = attributes_->getURI(index, &pwchUri, &cchUri); if (FAILED(hr)) - return stringT(); - stringT uri(string_adaptorT::construct_from_utf16(pwchUri, cchUri)); + return string_type(); + string_type uri(string_adaptor_type::construct_from_utf16(pwchUri, cchUri)); return uri; } // getURI - virtual stringT getLocalName(unsigned int index) const + virtual string_type getLocalName(unsigned int index) const { const wchar_t* pwchLocalName; int cchLocalName; HRESULT hr = attributes_->getLocalName(index, &pwchLocalName, &cchLocalName); if (FAILED(hr)) - return stringT(); - stringT localName(string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName)); + return string_type(); + string_type localName(string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName)); return localName; } // getLocalName - virtual stringT getQName(unsigned int index) const + virtual string_type getQName(unsigned int index) const { const wchar_t* pwchQName; int cchQName; HRESULT hr = attributes_->getQName(index, &pwchQName, &cchQName); if (FAILED(hr)) - return stringT(); - stringT qName(string_adaptorT::construct_from_utf16(pwchQName, cchQName)); + return string_type(); + string_type qName(string_adaptor_type::construct_from_utf16(pwchQName, cchQName)); return qName; } // getQName - virtual stringT getType(unsigned int index) const + virtual string_type getType(unsigned int index) const { const wchar_t* pwchType; int cchType; HRESULT hr = attributes_->getType(index, &pwchType, &cchType); if (FAILED(hr)) - return stringT(); - stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType)); + return string_type(); + string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType)); return type; } // getType - virtual stringT getValue(unsigned int index) const + virtual string_type getValue(unsigned int index) const { const wchar_t* pwchValue; int cchValue; HRESULT hr = attributes_->getValue(index, &pwchValue, &cchValue); if (FAILED(hr)) - return stringT(); - stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue)); + return string_type(); + string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue)); return value; } // getValue ///////////////////////// // name based query - virtual int getIndex(const stringT& uri, const stringT& localName) const + virtual int getIndex(const string_type& uri, const string_type& localName) const { int index = -1; - std::wstring wUri(string_adaptorT::asStdWString(uri)); - std::wstring wLocalName(string_adaptorT::asStdWString(localName)); + std::wstring wUri(string_adaptor_type::asStdWString(uri)); + std::wstring wLocalName(string_adaptor_type::asStdWString(localName)); HRESULT hr = attributes_->getIndexFromName(wUri.data(), static_cast(wUri.length()), wLocalName.data(), static_cast(wLocalName.length()), &index); return index; } // getIndex - virtual int getIndex(const stringT& qName) const + virtual int getIndex(const string_type& qName) const { int index = -1; - std::wstring wQName(string_adaptorT::asStdWString(qName)); + std::wstring wQName(string_adaptor_type::asStdWString(qName)); attributes_->getIndexFromQName(wQName.data(), static_cast(wQName.length()), &index); return index; } // getIndex - virtual stringT getType(const stringT& uri, const stringT& localName) const + virtual string_type getType(const string_type& uri, const string_type& localName) const { const wchar_t* pwchType; int cchType; - std::wstring wUri(string_adaptorT::asStdWString(uri)); - std::wstring wLocalName(string_adaptorT::asStdWString(localName)); + std::wstring wUri(string_adaptor_type::asStdWString(uri)); + std::wstring wLocalName(string_adaptor_type::asStdWString(localName)); HRESULT hr = attributes_->getTypeFromName(wUri.data(), static_cast(wUri.length()), wLocalName.data(), static_cast(wLocalName.length()), &pwchType, &cchType); if (FAILED(hr)) - return stringT(); - stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType)); + return string_type(); + string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType)); return type; } // getType - virtual stringT getType(const stringT& qName) const + virtual string_type getType(const string_type& qName) const { const wchar_t* pwchType; int cchType; - std::wstring wQName(string_adaptorT::asStdWString(qName)); + std::wstring wQName(string_adaptor_type::asStdWString(qName)); HRESULT hr = attributes_->getTypeFromQName(wQName.data(), static_cast(wQName.length()), &pwchType, &cchType); if (FAILED(hr)) - return stringT(); - stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType)); + return string_type(); + string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType)); return type; } // getType - virtual stringT getValue(const stringT& uri, const stringT& localName) const + virtual string_type getValue(const string_type& uri, const string_type& localName) const { const wchar_t* pwchValue; int cchValue; - std::wstring wUri(string_adaptorT::asStdWString(uri)); - std::wstring wLocalName(string_adaptorT::asStdWString(localName)); + std::wstring wUri(string_adaptor_type::asStdWString(uri)); + std::wstring wLocalName(string_adaptor_type::asStdWString(localName)); HRESULT hr = attributes_->getValueFromName(wUri.data(), static_cast(wUri.length()), wLocalName.data(), static_cast(wLocalName.length()), &pwchValue, &cchValue); if (FAILED(hr)) - return stringT(); - stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue)); + return string_type(); + string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue)); return value; } // getValue - virtual stringT getValue(const stringT& qname) const + virtual string_type getValue(const string_type& qname) const { const wchar_t* pwchValue; int cchValue; - std::wstring wQName(string_adaptorT::asStdWString(qname)); + std::wstring wQName(string_adaptor_type::asStdWString(qname)); HRESULT hr = attributes_->getValueFromQName(wQName.data(), static_cast(wQName.length()), &pwchValue, &cchValue); if (FAILED(hr)) - return stringT(); - stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue)); + return string_type(); + string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue)); return value; } // getValue @@ -538,8 +541,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader { } virtual ~ErrorHandlerAdaptor() { } - void setErrorHandler(SAX::basic_ErrorHandler& handler) { errorHandler_ = &handler; } - SAX::basic_ErrorHandler* getErrorHandler() const { return errorHandler_; } + void setErrorHandler(SAX::basic_ErrorHandler& handler) { errorHandler_ = &handler; } + SAX::basic_ErrorHandler* getErrorHandler() const { return errorHandler_; } virtual HRESULT STDMETHODCALLTYPE error( /* [in] */ ISAXLocator *pLocator, @@ -547,8 +550,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ HRESULT hrErrorCode) { bError_ = true; - stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage)); - eError_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator)); + string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage)); + eError_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator)); return S_OK; } // error @@ -558,8 +561,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ HRESULT hrErrorCode) { bFatal_ = true; - stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage)); - eFatal_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator)); + string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage)); + eFatal_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator)); return S_FALSE; } // fatalError @@ -569,8 +572,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ HRESULT hrErrorCode) { bWarning_ = true; - stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage)); - eWarning_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator)); + string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage)); + eWarning_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator)); return S_OK; } // ignorableWarning @@ -599,7 +602,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader unsigned long __stdcall Release() { return 0; } private: - typedef SAX::basic_SAXParseException SAXParseExceptionT; + typedef SAX::basic_SAXParseException SAXParseExceptionT; bool bWarning_; bool bError_; bool bFatal_; @@ -607,7 +610,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader SAXParseExceptionT eError_; SAXParseExceptionT eFatal_; - SAX::basic_ErrorHandler* errorHandler_; + SAX::basic_ErrorHandler* errorHandler_; }; // class ErrorHandlerAdaptor class LexicalHandlerAdaptor : public ISAXLexicalHandler @@ -616,8 +619,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader LexicalHandlerAdaptor() : lexicalHandler_(0) { } virtual ~LexicalHandlerAdaptor() { } - void setLexicalHandler(SAX::basic_LexicalHandler& handler) { lexicalHandler_ = &handler; } - SAX::basic_LexicalHandler* getLexicalHandler() const { return lexicalHandler_; } + void setLexicalHandler(SAX::basic_LexicalHandler& handler) { lexicalHandler_ = &handler; } + SAX::basic_LexicalHandler* getLexicalHandler() const { return lexicalHandler_; } virtual HRESULT STDMETHODCALLTYPE startDTD( /* [in] */ const wchar_t *pwchName, @@ -628,9 +631,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchSystemId) { if(lexicalHandler_) - lexicalHandler_->startDTD(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId), - string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId)); + lexicalHandler_->startDTD(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId), + string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId)); return S_OK; } // startDTD @@ -646,7 +649,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchName) { if(lexicalHandler_) - lexicalHandler_->startEntity(string_adaptorT::construct_from_utf16(pwchName, cchName)); + lexicalHandler_->startEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName)); return S_OK; } // startEntity @@ -655,7 +658,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchName) { if(lexicalHandler_) - lexicalHandler_->endEntity(string_adaptorT::construct_from_utf16(pwchName, cchName)); + lexicalHandler_->endEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName)); return S_OK; } // endEntity @@ -678,7 +681,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchChars) { if(lexicalHandler_) - lexicalHandler_->comment(string_adaptorT::construct_from_utf16(pwchChars, cchChars)); + lexicalHandler_->comment(string_adaptor_type::construct_from_utf16(pwchChars, cchChars)); return S_OK; } // comment @@ -695,7 +698,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader unsigned long __stdcall Release() { return 0; } private: - SAX::basic_LexicalHandler* lexicalHandler_; + SAX::basic_LexicalHandler* lexicalHandler_; }; // class LexicalHandlerAdaptor class DeclHandlerAdaptor : public ISAXDeclHandler @@ -704,8 +707,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader DeclHandlerAdaptor() : declHandler_(0) { } virtual ~DeclHandlerAdaptor() { } - void setDeclHandler(SAX::basic_DeclHandler& handler) { declHandler_ = &handler; } - SAX::basic_DeclHandler* getDeclHandler() const { return declHandler_; } + void setDeclHandler(SAX::basic_DeclHandler& handler) { declHandler_ = &handler; } + SAX::basic_DeclHandler* getDeclHandler() const { return declHandler_; } virtual HRESULT STDMETHODCALLTYPE elementDecl( /* [in] */ const wchar_t *pwchName, @@ -714,8 +717,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchModel) { if(declHandler_) - declHandler_->elementDecl(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchModel, cchModel)); + declHandler_->elementDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchModel, cchModel)); return S_OK; } // elementDecl @@ -732,11 +735,11 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchValue) { if(declHandler_) - declHandler_->attributeDecl(string_adaptorT::construct_from_utf16(pwchElementName, cchElementName), - string_adaptorT::construct_from_utf16(pwchAttributeName, cchAttributeName), - string_adaptorT::construct_from_utf16(pwchType, cchType), - string_adaptorT::construct_from_utf16(pwchValueDefault, cchValueDefault), - string_adaptorT::construct_from_utf16(pwchValue, cchValue)); + declHandler_->attributeDecl(string_adaptor_type::construct_from_utf16(pwchElementName, cchElementName), + string_adaptor_type::construct_from_utf16(pwchAttributeName, cchAttributeName), + string_adaptor_type::construct_from_utf16(pwchType, cchType), + string_adaptor_type::construct_from_utf16(pwchValueDefault, cchValueDefault), + string_adaptor_type::construct_from_utf16(pwchValue, cchValue)); return S_OK; } // attributeDecl @@ -747,8 +750,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchValue) { if(declHandler_) - declHandler_->internalEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchValue, cchValue)); + declHandler_->internalEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchValue, cchValue)); return S_OK; } // internalEntityDecl @@ -761,9 +764,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader /* [in] */ int cchSystemId) { if(declHandler_) - declHandler_->externalEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName), - string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId), - string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId)); + declHandler_->externalEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName), + string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId), + string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId)); return S_OK; } // externalEntityDecl @@ -781,13 +784,13 @@ class msxml2_wrapper : public SAX::basic_XMLReader unsigned long __stdcall Release() { return 0; } private: - SAX::basic_DeclHandler* declHandler_; + SAX::basic_DeclHandler* declHandler_; }; // class DeclHandlerAdaptor class StreamAdaptor : public ISequentialStream { public: - StreamAdaptor(SAX::basic_InputSource& source) : + StreamAdaptor(SAX::basic_InputSource& source) : source_(source) { } // StreamAdaptor @@ -821,7 +824,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader unsigned long __stdcall Release() { return 1; } private: - SAX::basic_InputSource& source_; + SAX::basic_InputSource& source_; }; // StreamAdaptor @@ -835,11 +838,11 @@ class msxml2_wrapper : public SAX::basic_XMLReader DeclHandlerAdaptor declHandler_; ISAXXMLReaderPtr reader_; - SAX::PropertyNames properties_; + SAX::PropertyNames properties_; }; // class msxml -template -msxml2_wrapper::msxml2_wrapper() +template +msxml2_wrapper::msxml2_wrapper() { reader_.CreateInstance("Msxml2.SAXXMLReader.4.0"); if(reader_.GetInterfacePtr() == 0) @@ -862,67 +865,67 @@ msxml2_wrapper::msxml2_wrapper() reader_->putProperty(L"http://xml.org/sax/properties/declaration-handler", wrapper); } // msxml2_wrapper -template -msxml2_wrapper::~msxml2_wrapper() +template +msxml2_wrapper::~msxml2_wrapper() { if(reader_.GetInterfacePtr()) reader_.Release(); } // ~msxml2_wrapper -template -bool msxml2_wrapper::getFeature(const stringT& name) const +template +bool msxml2_wrapper::getFeature(const string_type& name) const { VARIANT_BOOL feature; - std::wstring wName(string_adaptorT::asStdWString(name)); + std::wstring wName(string_adaptor_type::asStdWString(name)); reader_->getFeature(wName.c_str(), &feature); return (feature == VARIANT_TRUE) ? true : false; } // msxml2_wrapper::getFeature -template -void msxml2_wrapper::setFeature(const stringT& name, bool value) +template +void msxml2_wrapper::setFeature(const string_type& name, bool value) { - std::wstring wName(string_adaptorT::asStdWString(name)); + std::wstring wName(string_adaptor_type::asStdWString(name)); reader_->putFeature(wName.c_str(), value); } // setFeature -template -void msxml2_wrapper::setErrorHandler(SAX::basic_ErrorHandler& handler) +template +void msxml2_wrapper::setErrorHandler(SAX::basic_ErrorHandler& handler) { errorHandler_.setErrorHandler(handler); } // setErrorHandler -template -SAX::basic_ErrorHandler* msxml2_wrapper::getErrorHandler() const +template +SAX::basic_ErrorHandler* msxml2_wrapper::getErrorHandler() const { return errorHandler_.getErrorHandler(); } // getErrorHandler -template +template #ifndef ARABICA_VS6_WORKAROUND -std::auto_ptr::PropertyBase> msxml2_wrapper::doGetProperty(const stringT& name) +std::auto_ptr::PropertyBase> msxml2_wrapper::doGetProperty(const string_type& name) #else -std::auto_ptr::PropertyBase> msxml2_wrapper::doGetProperty(const stringT& name) +std::auto_ptr::PropertyBase> msxml2_wrapper::doGetProperty(const string_type& name) #endif { if(name == properties_.lexicalHandler) { - Property*>* prop = new Property*>(lexicalHandler_.getLexicalHandler()); - return std::auto_ptr::PropertyBase>(prop); + Property*>* prop = new Property*>(lexicalHandler_.getLexicalHandler()); + return std::auto_ptr::PropertyBase>(prop); } if(name == properties_.declHandler) { - Property*>* prop = new Property*>(declHandler_.getDeclHandler()); - return std::auto_ptr::PropertyBase>(prop); + Property*>* prop = new Property*>(declHandler_.getDeclHandler()); + return std::auto_ptr::PropertyBase>(prop); } throw SAX::SAXNotRecognizedException("Property not recognized "); } // doGetProperty -template -void msxml2_wrapper::doSetProperty(const stringT& name, std::auto_ptr::PropertyBase> value) +template +void msxml2_wrapper::doSetProperty(const string_type& name, std::auto_ptr::PropertyBase> value) { if(name == properties_.lexicalHandler) { - Property&>* prop = dynamic_cast&>*>(value.get()); + Property&>* prop = dynamic_cast&>*>(value.get()); if(!prop) throw std::runtime_error("bad_cast: Property LexicalHandler is wrong type, should be SAX::LexicalHandler&"); @@ -932,7 +935,7 @@ void msxml2_wrapper::doSetProperty(co } // if ... if(name == properties_.declHandler) { - Property&>* prop = dynamic_cast&>*>(value.get()); + Property&>* prop = dynamic_cast&>*>(value.get()); if(!prop) throw std::runtime_error("bad_cast: Property DeclHandler is wrong type, should be SAX::DeclHandler&"); @@ -943,12 +946,12 @@ void msxml2_wrapper::doSetProperty(co throw SAX::SAXNotRecognizedException("Property not recognized "); } // doSetProperty -template -void msxml2_wrapper::parse(SAX::basic_InputSource& source) +template +void msxml2_wrapper::parse(SAX::basic_InputSource& source) { if(source.getByteStream() == 0) { - std::wstring wSysId(string_adaptorT::asStdWString(source.getSystemId())); + std::wstring wSysId(string_adaptor_type::asStdWString(source.getSystemId())); reader_->parseURL(wSysId.c_str()); } else