poco/XML/src/XMLStreamParserException.cpp

91 lines
1.4 KiB
C++
Raw Normal View History

2015-08-22 22:02:41 +02:00
//
// XMLStreamParserException.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamParserException
//
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
2015-08-22 22:02:41 +02:00
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
2015-08-22 22:02:41 +02:00
2015-08-22 17:36:39 +02:00
#include "Poco/XML/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamParser.h"
namespace Poco {
namespace XML {
2015-08-22 17:36:39 +02:00
XMLStreamParserException::~XMLStreamParserException() throw ()
{
}
2015-08-22 17:36:39 +02:00
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();
}
2015-08-22 17:36:39 +02:00
XMLStreamParserException::XMLStreamParserException(const XMLStreamParser& p, const std::string& d):
_name(p.inputName()),
_line(p.line()),
_column(p.column()),
_description(d)
{
init();
}
2015-08-22 17:36:39 +02:00
void XMLStreamParserException::init()
{
std::ostringstream os;
2015-08-22 20:58:45 +02:00
if (!_name.empty())
os << _name << ':';
os << _line << ':' << _column << ": error: " << _description;
_what = os.str();
}
2015-08-22 17:36:39 +02:00
2015-08-22 20:58:45 +02:00
const char* XMLStreamParserException::name() const throw()
{
return _name.c_str();
}
2015-08-22 20:58:45 +02:00
Poco::UInt64 XMLStreamParserException::line() const
{
return _line;
}
2015-08-22 20:58:45 +02:00
Poco::UInt64 XMLStreamParserException::column() const
{
return _column;
}
2015-08-22 20:58:45 +02:00
const std::string& XMLStreamParserException::description() const
{
return _description;
}
char const* XMLStreamParserException::what() const throw ()
{
2015-08-22 20:58:45 +02:00
return _what.c_str();
}
2015-08-22 17:36:39 +02:00
} } // namespace Poco::XML