diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-14 10:45:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-03-14 10:45:12 +0200 |
commit | ce298ad2e8dbc3601d180c178bee9d606b8edab2 (patch) | |
tree | 983545115dcb2d73cf56c3fc2e2f6be5d297eb43 /cutl/xml/parser.hxx | |
parent | 17ad2a3fd8933aa49bff4c8ea49963d15cc0db92 (diff) |
Add convenience constructors to XML parsing and serialization exceptions
Diffstat (limited to 'cutl/xml/parser.hxx')
-rw-r--r-- | cutl/xml/parser.hxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/cutl/xml/parser.hxx b/cutl/xml/parser.hxx index 5dc2a83..d7011af 100644 --- a/cutl/xml/parser.hxx +++ b/cutl/xml/parser.hxx @@ -33,6 +33,8 @@ namespace cutl { namespace xml { + class parser; + struct LIBCUTL_EXPORT parsing: exception { virtual @@ -43,6 +45,8 @@ namespace cutl unsigned long long column, const std::string& description); + parsing (const parser&, const std::string& description); + const std::string& name () const {return name_;} @@ -59,6 +63,10 @@ namespace cutl what () const throw (); private: + void + init (); + + private: std::string name_; unsigned long long line_; unsigned long long column_; @@ -83,14 +91,20 @@ namespace cutl receive_characters | receive_attributes; - // Parse std::istream. Name is used in diagnostics to identify the - // document being parsed. std::ios_base::failure exception is used - // to report io errors (badbit and failbit). + // Parse std::istream. Input name is used in diagnostics to identify + // the document being parsed. std::ios_base::failure exception is + // used to report io errors (badbit and failbit). // parser (std::istream&, - const std::string& name, + const std::string& input_name, feature_type = receive_default); + const std::string& + input_name () const {return iname_;} + + // Parsing events. + // + public: enum event_type { // If adding new events, also update the stream insertion operator. @@ -135,6 +149,9 @@ namespace cutl event_type event () {return event_;} + // Event data. + // + public: const qname_type& qname () const {return *pqname_;} const std::string& namespace_ () const {return pqname_->namespace_ ();} @@ -202,7 +219,7 @@ namespace cutl private: std::istream& is_; - const std::string name_; + const std::string iname_; feature_type feature_; XML_Parser p_; |