aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/XML/src/XMLStreamParserException.cpp
blob: d7b01690edda29c064801f98758e5ea1ff13e5fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//
// XMLStreamParserException.cpp
//
// Library: XML
// Package: XML
// Module:  XMLStreamParserException
//
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier:	BSL-1.0
//


#include "Poco/XML/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamParser.h"


namespace Poco {
namespace XML {


XMLStreamParserException::~XMLStreamParserException() noexcept
{
}


XMLStreamParserException::XMLStreamParserException(const std::string& n, Poco::UInt64 l, Poco::UInt64 c, const std::string& d):
	_name(n),
	_line(l),
	_column(c),
	_description(d)
{
	init();
}


XMLStreamParserException::XMLStreamParserException(const XMLStreamParser& p, const std::string& d):
	_name(p.inputName()),
	_line(p.line()),
	_column(p.column()),
	_description(d)
{
	init();
}


void XMLStreamParserException::init()
{
	std::ostringstream os;
	if (!_name.empty())
		os << _name << ':';
	os << _line << ':' << _column << ": error: " << _description;
	_what = os.str();
}


const char* XMLStreamParserException::name() const noexcept
{
	return _name.c_str();
}


Poco::UInt64 XMLStreamParserException::line() const
{
	return _line;
}


Poco::UInt64 XMLStreamParserException::column() const
{
	return _column;
}


const std::string& XMLStreamParserException::description() const
{
	return _description;
}


char const* XMLStreamParserException::what() const noexcept
{
	return _what.c_str();
}


} } // namespace Poco::XML