summaryrefslogtreecommitdiff
path: root/libxsd/xsd/cxx/parser/error-handler.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2009-09-17 07:15:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2009-09-17 07:15:29 +0200
commitf0510d2f90467de8e8f260b47d79a9baaf9bef17 (patch)
tree0b9929946f06a9cbe9b9e8f2a7600dae4e048f79 /libxsd/xsd/cxx/parser/error-handler.txx
Start tracking XSD with git
Diffstat (limited to 'libxsd/xsd/cxx/parser/error-handler.txx')
-rw-r--r--libxsd/xsd/cxx/parser/error-handler.txx41
1 files changed, 41 insertions, 0 deletions
diff --git a/libxsd/xsd/cxx/parser/error-handler.txx b/libxsd/xsd/cxx/parser/error-handler.txx
new file mode 100644
index 0000000..9b5feb7
--- /dev/null
+++ b/libxsd/xsd/cxx/parser/error-handler.txx
@@ -0,0 +1,41 @@
+// file : xsd/cxx/parser/error-handler.txx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+namespace xsd
+{
+ namespace cxx
+ {
+ namespace parser
+ {
+ template <typename C>
+ bool error_handler<C>::
+ handle (const std::basic_string<C>& id,
+ unsigned long line,
+ unsigned long column,
+ severity s,
+ const std::basic_string<C>& message)
+ {
+ diagnostics_.push_back (
+ error<C> (s == severity::warning
+ ? cxx::parser::severity::warning
+ : cxx::parser::severity::error,
+ id, line, column, message));
+
+ if (!failed_ && s != severity::warning)
+ failed_ = true;
+
+ return true;
+ }
+
+ template <typename C>
+ void error_handler<C>::
+ throw_if_failed () const
+ {
+ if (failed_)
+ throw parsing<C> (diagnostics_);
+ }
+ }
+ }
+}