#include "ExInfo.h"
#include <sstream>
//-----------------------------------------------------------------
/**
* Info about problem.
* @param problem text info
*/
ExInfo::ExInfo(const std::string &problem) throw()
: m_what(problem)
{
/* empty */
}
//-----------------------------------------------------------------
/**
* Return info about problem.
* @return detailed info, valid with ExInfo live
*/
const char *
ExInfo::what() const throw()
{
return m_what.c_str();
}
//-----------------------------------------------------------------
/**
* Add text info.
* @param name param name
* @param value param value
* @return *this
*/
ExInfo &
ExInfo::addInfo(const std::string &name,
const std::string &value) throw()
{
m_what.append("; ");
m_what.append(name);
m_what.append("='");
m_what.append(value);
m_what.append("'");
return *this;
}
//-----------------------------------------------------------------
/**
* Add numeric info.
* @param name param name
* @param value param value
* @return *this
*/
ExInfo &
ExInfo::addInfo(const std::string &name, long value) throw()
{
//TODO: toString()
std::ostringstream buffer;
buffer << value;
m_what.append("; ");
m_what.append(name);
m_what.append("=");
m_what.append(buffer.str());
return *this;
}