/usr/include/vmmlib/exception.hpp is in libvmmlib-dev 1.0-2.
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #ifndef __VMMLIB__EXCEPTION__HPP__
#define __VMMLIB__EXCEPTION__HPP__
#include <iostream>
#include <stdexcept>
#include <string>
#include <sstream>
#include <cassert>
#include <vmmlib/vmmlib_config.hpp>
#define VMMLIB_HERE ( except_here( __FILE__, __LINE__ ) )
#ifdef VMMLIB_THROW_EXCEPTIONS
#define VMMLIB_ERROR( desc, here ) throw( exception( desc, here ) )
#else
#define VMMLIB_ERROR( desc, here ) error_noexcept( desc, here )
#endif
namespace vmml
{
struct except_here
{
except_here( const char* file_, int line_ ) : file( file_ ), line( line_ ) {}
const char* file;
int line;
}; // struct except_here
inline void
error_noexcept( const std::string& desc, const except_here& here )
{
std::cerr
<< "vmmlib error at " << here.file << ":" << here.line << "\n"
<< desc
<< std::endl;
assert( 0 );
}
class exception : public std::exception
{
public:
exception( const std::string& desc, const except_here& here )
: _description( desc )
, _here( here )
{}
virtual ~exception() throw() {}
virtual const char* what() const throw()
{
std::stringstream ss;
ss
<< _here.file << "(" << _here.line << "): - "
<< _description
<< std::endl;
return ss.str().c_str();
}
protected:
std::string _description;
const except_here& _here;
private:
// disallow std ctor
exception() : _here( *new except_here( "", 0 ) ){};
// disallow assignment operator
virtual const exception& operator=( const exception& ){ return *this; }
};
} // namespace stream_process
#endif
|