xmlerror.h
Go to the documentation of this file.
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2.1 of the License, or (at your option) any later version.
6  *
7  * As a special exception, you may use this file as part of a free
8  * software library without restriction. Specifically, if other files
9  * instantiate templates or use macros or inline functions from this
10  * file, or you compile this file and link it with other files to
11  * produce an executable, this file does not by itself cause the
12  * resulting executable to be covered by the GNU General Public
13  * License. This exception does not however invalidate any other
14  * reasons why the executable file might be covered by the GNU Library
15  * General Public License.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25  */
26 #ifndef cxxtools_Xml_XmlError_h
27 #define cxxtools_Xml_XmlError_h
28 
29 #include <stdexcept>
30 
31 namespace cxxtools {
32 
33 namespace xml {
34 
36 class XmlError : public std::runtime_error
37 {
38  public:
45  XmlError(const std::string& what, unsigned line);
46 
47  unsigned line() const
48  { return _line; }
49 
50  private:
51  unsigned _line;
52 };
53 
57 class XmlNoDocument : public XmlError
58 {
59  public:
60  explicit XmlNoDocument(unsigned line)
61  : XmlError("no xml document read", line)
62  { }
63 };
64 
69 {
70  public:
71  explicit XmlUnexpectedEndOfDocument(unsigned line)
72  : XmlError("unexpected end of xml", line)
73  { }
74 };
75 
76 }
77 
78 }
79 
80 #endif