1 | // |
2 | // XMLStreamParserException.cpp |
3 | // |
4 | // Library: XML |
5 | // Package: XML |
6 | // Module: XMLStreamParserException |
7 | // |
8 | // Copyright (c) 2015, Applied Informatics Software Engineering GmbH. |
9 | // and Contributors. |
10 | // |
11 | // SPDX-License-Identifier: BSL-1.0 |
12 | // |
13 | |
14 | |
15 | #include "Poco/XML/XMLStreamParserException.h" |
16 | #include "Poco/XML/XMLStreamParser.h" |
17 | |
18 | |
19 | namespace Poco { |
20 | namespace XML { |
21 | |
22 | |
23 | XMLStreamParserException::~XMLStreamParserException() throw () |
24 | { |
25 | } |
26 | |
27 | |
28 | XMLStreamParserException::XMLStreamParserException(const std::string& n, Poco::UInt64 l, Poco::UInt64 c, const std::string& d): |
29 | _name(n), |
30 | _line(l), |
31 | _column(c), |
32 | _description(d) |
33 | { |
34 | init(); |
35 | } |
36 | |
37 | |
38 | XMLStreamParserException::XMLStreamParserException(const XMLStreamParser& p, const std::string& d): |
39 | _name(p.inputName()), |
40 | _line(p.line()), |
41 | _column(p.column()), |
42 | _description(d) |
43 | { |
44 | init(); |
45 | } |
46 | |
47 | |
48 | void XMLStreamParserException::init() |
49 | { |
50 | std::ostringstream os; |
51 | if (!_name.empty()) |
52 | os << _name << ':'; |
53 | os << _line << ':' << _column << ": error: " << _description; |
54 | _what = os.str(); |
55 | } |
56 | |
57 | |
58 | const char* XMLStreamParserException::name() const throw() |
59 | { |
60 | return _name.c_str(); |
61 | } |
62 | |
63 | |
64 | Poco::UInt64 XMLStreamParserException::line() const |
65 | { |
66 | return _line; |
67 | } |
68 | |
69 | |
70 | Poco::UInt64 XMLStreamParserException::column() const |
71 | { |
72 | return _column; |
73 | } |
74 | |
75 | |
76 | const std::string& XMLStreamParserException::description() const |
77 | { |
78 | return _description; |
79 | } |
80 | |
81 | |
82 | char const* XMLStreamParserException::what() const throw () |
83 | { |
84 | return _what.c_str(); |
85 | } |
86 | |
87 | |
88 | } } // namespace Poco::XML |
89 | |