poco/XML/src/XMLStreamParserException.cpp

88 lines
1.6 KiB
C++
Raw Normal View History

2015-08-22 22:02:41 +02:00
//
// XMLStreamParserException.cpp
//
// $Id$
//
// Library: XML
// Package: XML
// Module: XMLStreamParserException
//
// Definition of the XMLStreamParserException class.
//
// Copyright (c) 2004-2015, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
// copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
2015-08-22 17:36:39 +02:00
#include "Poco/XML/XMLStreamParserException.h"
#include "Poco/XML/XMLStreamParser.h"
using namespace std;
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 string& n, Poco::UInt64 l, Poco::UInt64 c, const string& d)
2015-08-22 20:58:45 +02:00
: _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)
2015-08-22 20:58:45 +02:00
: _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();
}
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 throw ()
{
2015-08-22 20:58:45 +02:00
return _what.c_str();
}
2015-08-22 17:36:39 +02:00
} /* namespace XML */
} /* namespace Poco */