Revision 111, 1.2 kB
(checked in by mido, 16 years ago)
|
pridana knihovna XSD (a jeji chlebodarkyne XERCES), v ramci Win32 zprovoznen priklad tests/test_xsd_hello.cxx
|
Rev | Line | |
---|
[111] | 1 | // file : xsd/cxx/tree/error-handler.hxx |
---|
| 2 | // author : Boris Kolpackov <boris@codesynthesis.com> |
---|
| 3 | // copyright : Copyright (c) 2005-2008 Code Synthesis Tools CC |
---|
| 4 | // license : GNU GPL v2 + exceptions; see accompanying LICENSE file |
---|
| 5 | |
---|
| 6 | #ifndef XSD_CXX_TREE_ERROR_HANDLER_HXX |
---|
| 7 | #define XSD_CXX_TREE_ERROR_HANDLER_HXX |
---|
| 8 | |
---|
| 9 | #include <xsd/cxx/xml/error-handler.hxx> |
---|
| 10 | |
---|
| 11 | #include <xsd/cxx/tree/exceptions.hxx> |
---|
| 12 | |
---|
| 13 | namespace xsd |
---|
| 14 | { |
---|
| 15 | namespace cxx |
---|
| 16 | { |
---|
| 17 | namespace tree |
---|
| 18 | { |
---|
| 19 | template <typename C> |
---|
| 20 | class error_handler: public xml::error_handler<C> |
---|
| 21 | { |
---|
| 22 | typedef typename xml::error_handler<C>::severity severity; |
---|
| 23 | |
---|
| 24 | public: |
---|
| 25 | error_handler () |
---|
| 26 | : failed_ (false) |
---|
| 27 | { |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | virtual bool |
---|
| 31 | handle (const std::basic_string<C>& id, |
---|
| 32 | unsigned long line, |
---|
| 33 | unsigned long column, |
---|
| 34 | severity, |
---|
| 35 | const std::basic_string<C>& message); |
---|
| 36 | |
---|
| 37 | template <typename X> |
---|
| 38 | void |
---|
| 39 | throw_if_failed () const |
---|
| 40 | { |
---|
| 41 | if (failed_) |
---|
| 42 | throw X (diagnostics_); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | private: |
---|
| 46 | bool failed_; |
---|
| 47 | diagnostics<C> diagnostics_; |
---|
| 48 | }; |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | #include <xsd/cxx/tree/error-handler.txx> |
---|
| 54 | |
---|
| 55 | #endif // XSD_CXX_TREE_ERROR_HANDLER_HXX |
---|