summaryrefslogtreecommitdiff
path: root/libxsd/libxsd/cxx/parser/error-handler.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libxsd/libxsd/cxx/parser/error-handler.hxx')
-rw-r--r--libxsd/libxsd/cxx/parser/error-handler.hxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/libxsd/libxsd/cxx/parser/error-handler.hxx b/libxsd/libxsd/cxx/parser/error-handler.hxx
new file mode 100644
index 0000000..7b44325
--- /dev/null
+++ b/libxsd/libxsd/cxx/parser/error-handler.hxx
@@ -0,0 +1,55 @@
+// file : libxsd/cxx/parser/error-handler.hxx
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef LIBXSD_CXX_PARSER_ERROR_HANDLER_HXX
+#define LIBXSD_CXX_PARSER_ERROR_HANDLER_HXX
+
+#include <libxsd/cxx/xml/error-handler.hxx>
+
+#include <libxsd/cxx/parser/exceptions.hxx>
+
+namespace xsd
+{
+ namespace cxx
+ {
+ namespace parser
+ {
+ template <typename C>
+ class error_handler: public xml::error_handler<C>
+ {
+ public:
+ typedef typename xml::error_handler<C>::severity severity;
+
+ error_handler ()
+ : failed_ (false)
+ {
+ }
+
+ virtual bool
+ handle (const std::basic_string<C>& id,
+ unsigned long line,
+ unsigned long column,
+ severity s,
+ const std::basic_string<C>& message);
+
+ void
+ throw_if_failed () const;
+
+ void
+ reset ()
+ {
+ failed_ = false;
+ diagnostics_.clear ();
+ }
+
+ private:
+ bool failed_;
+ diagnostics<C> diagnostics_;
+ };
+ }
+ }
+}
+
+#include <libxsd/cxx/parser/error-handler.txx>
+
+#endif // LIBXSD_CXX_PARSER_ERROR_HANDLER_HXX