summaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/xml/sax
diff options
context:
space:
mode:
Diffstat (limited to 'libxsd/xsd/cxx/xml/sax')
-rw-r--r--libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx78
-rw-r--r--libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx76
-rw-r--r--libxsd/xsd/cxx/xml/sax/std-input-source.hxx151
3 files changed, 0 insertions, 305 deletions
diff --git a/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx b/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
deleted file mode 100644
index 7ceecbe..0000000
--- a/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
+++ /dev/null
@@ -1,78 +0,0 @@
-// file : xsd/cxx/xml/sax/bits/error-handler-proxy.hxx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef XSD_CXX_XML_SAX_ERROR_HANDLER_PROXY_HXX
-#define XSD_CXX_XML_SAX_ERROR_HANDLER_PROXY_HXX
-
-#include <xercesc/sax/ErrorHandler.hpp>
-#include <xercesc/sax/SAXParseException.hpp>
-
-#include <xsd/cxx/xml/error-handler.hxx>
-
-namespace xsd
-{
- namespace cxx
- {
- namespace xml
- {
- namespace sax
- {
- namespace bits
- {
- template <typename C>
- class error_handler_proxy: public xercesc::ErrorHandler
- {
- public:
- error_handler_proxy (error_handler<C>& eh)
- : failed_ (false), eh_ (&eh), native_eh_ (0)
- {
- }
-
- error_handler_proxy (xercesc::ErrorHandler& eh)
- : failed_ (false), eh_ (0), native_eh_ (&eh)
- {
- }
-
- public:
- virtual void
- warning (const xercesc::SAXParseException& e);
-
- virtual void
- error (const xercesc::SAXParseException& e);
-
- virtual void
- fatalError (const xercesc::SAXParseException& e);
-
- public:
- bool
- failed () const
- {
- return failed_;
- }
-
- virtual void
- resetErrors()
- {
- failed_ = false;
- }
-
- private:
- typedef typename error_handler<C>::severity severity;
-
- void
- handle (const xercesc::SAXParseException&, severity);
-
- private:
- bool failed_;
- error_handler<C>* eh_;
- xercesc::ErrorHandler* native_eh_;
- };
- }
- }
- }
- }
-}
-
-#include <xsd/cxx/xml/sax/bits/error-handler-proxy.txx>
-
-#endif // XSD_CXX_XML_SAX_ERROR_HANDLER_PROXY_HXX
diff --git a/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx b/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx
deleted file mode 100644
index 58cef7a..0000000
--- a/libxsd/xsd/cxx/xml/sax/bits/error-handler-proxy.txx
+++ /dev/null
@@ -1,76 +0,0 @@
-// file : xsd/cxx/xml/sax/bits/error-handler-proxy.txx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#include <xsd/cxx/xml/string.hxx>
-
-namespace xsd
-{
- namespace cxx
- {
- namespace xml
- {
- namespace sax
- {
- namespace bits
- {
- template <typename C>
- void error_handler_proxy<C>::
- warning (const xercesc::SAXParseException& e)
- {
- if (native_eh_)
- native_eh_->warning (e);
- else
- handle (e, severity::warning);
- }
-
-
- template <typename C>
- void error_handler_proxy<C>::
- error (const xercesc::SAXParseException& e)
- {
- failed_ = true;
-
- if (native_eh_)
- native_eh_->error (e);
- else
- handle (e, severity::error);
- }
-
-
- template <typename C>
- void error_handler_proxy<C>::
- fatalError (const xercesc::SAXParseException& e)
- {
- failed_ = true;
-
- if (native_eh_)
- native_eh_->fatalError (e);
- else
- handle (e, severity::fatal);
- }
-
-
- template <typename C>
- void error_handler_proxy<C>::
- handle (const xercesc::SAXParseException& e, severity s)
- {
- //@@ I do not honor return values from the handler. This
- // is not too bad at the moment because I set
- // all-errors-are-fatal flag on the parser.
- //
- const XMLCh* id (e.getPublicId ());
-
- if (id == 0)
- id = e.getSystemId ();
-
- eh_->handle (transcode<C> (id),
- static_cast<unsigned long> (e.getLineNumber ()),
- static_cast<unsigned long> (e.getColumnNumber ()),
- s,
- transcode<C> (e.getMessage ()));
- }
- }
- }
- }
- }
-}
diff --git a/libxsd/xsd/cxx/xml/sax/std-input-source.hxx b/libxsd/xsd/cxx/xml/sax/std-input-source.hxx
deleted file mode 100644
index f4376d1..0000000
--- a/libxsd/xsd/cxx/xml/sax/std-input-source.hxx
+++ /dev/null
@@ -1,151 +0,0 @@
-// file : xsd/cxx/xml/sax/std-input-source.hxx
-// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
-
-#ifndef XSD_CXX_XML_SAX_STD_INPUT_SOURCE_HXX
-#define XSD_CXX_XML_SAX_STD_INPUT_SOURCE_HXX
-
-#include <istream>
-
-#include <xsd/cxx/xml/string.hxx>
-
-#include <xercesc/sax/InputSource.hpp>
-#include <xercesc/util/BinInputStream.hpp>
-
-namespace xsd
-{
- namespace cxx
- {
- namespace xml
- {
- namespace sax
- {
- class std_input_stream: public xercesc::BinInputStream
- {
- public:
- std_input_stream (std::istream& is)
- : is_ (is)
- {
- }
-
- virtual XMLFilePos
- curPos () const
- {
- return static_cast<XMLFilePos> (is_.tellg ());
- }
-
- virtual XMLSize_t
- readBytes (XMLByte* const buf, const XMLSize_t size)
- {
- // Some implementations don't clear gcount if you
- // call read() on a stream that is in the eof state.
- //
- if (is_.eof ())
- return 0;
-
- // Unset the exception failbit while we are working
- // with the stream.
- //
- std::ios_base::iostate old (is_.exceptions ());
- is_.exceptions (old & ~std::ios_base::failbit);
-
- is_.read (reinterpret_cast<char*> (buf),
- static_cast<std::streamsize> (size));
-
- // Clear the fail bit if it was caused by eof and restore
- // the original exception state. If there are any pending
- // errors then the exception will be thrown now.
- //
- if (is_.fail () && is_.eof ())
- is_.clear (is_.rdstate () & ~std::ios_base::failbit);
-
- is_.exceptions (old);
-
- // Make sure that if we failed, readBytes won't be called
- // again.
- //
- return !is_.fail ()
- ? static_cast<XMLSize_t> (is_.gcount ())
- : 0;
- }
-
- virtual const XMLCh*
- getContentType () const
- {
- return 0;
- }
-
- private:
- std::istream& is_;
- };
-
-
- class std_input_source: public xercesc::InputSource
- {
- public:
- std_input_source (std::istream& is)
- : is_ (&is)
- {
- }
-
- template <typename C>
- std_input_source (std::istream& is, const C* system_id)
- : xercesc::InputSource (xml::string (system_id).c_str ()),
- is_ (&is)
- {
- }
-
- template <typename C>
- std_input_source (std::istream& is,
- const std::basic_string<C>& system_id)
- : xercesc::InputSource (xml::string (system_id).c_str ()),
- is_ (&is)
- {
- }
-
- template <typename C>
- std_input_source (std::istream& is,
- const C* system_id,
- const C* public_id)
- : xercesc::InputSource (xml::string (system_id).c_str (),
- xml::string (public_id).c_str ()),
- is_ (&is)
- {
- }
-
- template <typename C>
- std_input_source (std::istream& is,
- const std::basic_string<C>& system_id,
- const std::basic_string<C>& public_id)
- : xercesc::InputSource (xml::string (system_id).c_str (),
- xml::string (public_id).c_str ()),
- is_ (&is)
- {
- }
-
- struct copy {};
-
- // Throws the copy exception if this function is called more
- // than once.
- //
- virtual xercesc::BinInputStream*
- makeStream () const
- {
- if (is_ == 0)
- throw copy ();
-
- std::istream& is (*is_);
-
- is_ = 0;
-
- return new std_input_stream (is);
- }
-
- private:
- mutable std::istream* is_;
- };
- }
- }
- }
-}
-
-#endif // XSD_CXX_XML_SAX_STD_INPUT_SOURCE_HXX