/usr/include/elektra/kdbexcept.hpp is in libelektra-dev 0.8.7-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #ifndef ELEKTRA_KDB_EXCEPT_HPP
#define ELEKTRA_KDB_EXCEPT_HPP
/*
* @brief See examples/cpp_example_userexception.cpp for how to use
* USER_DEFINED_EXCEPTIONS.
*/
#ifndef USER_DEFINED_EXCEPTIONS
#include <keyexcept.hpp>
#include <string>
#include <sstream>
#include <kdbio.hpp>
namespace kdb
{
class KDBException : public Exception
{
public:
KDBException (Key key) :
m_key(key),
m_str()
{}
virtual ~KDBException() throw()
{}
virtual const char* what() const throw()
{
if (m_str.empty())
{
// note that the code will be re-evaluated
// if it prints nothing, but an expensive
// function not printing anything seems
// to be unlikely.
//
// note that printError/printWarning will be
// used either from namespace kdb or global
// namespace.
std::stringstream ss;
printWarnings(ss, m_key);
printError(ss, m_key);
m_str = ss.str();
}
return m_str.c_str();
}
private:
Key m_key;
mutable std::string m_str;
};
}
#endif
#endif
|