28 #ifndef Pt_SourceInfo_h
29 #define Pt_SourceInfo_h
36 #define PT_FUNCTION __PRETTY_FUNCTION__
38 #elif defined(__BORLANDC__)
39 #define PT_FUNCTION __FUNC__
41 #elif defined(_MSC_VER)
44 #define PT_FUNCTION __FUNCDNAME__
46 #define PT_FUNCTION __FUNCTION__
48 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
49 #define PT_FUNCTION __func__
52 #define PT_FUNCTION "unknown symbol"
55 #define PT_STRINGIFY(x) #x
56 #define PT_TOSTRING(x) PT_STRINGIFY(x)
62 #define PT_SOURCEINFO_STR __FILE__ ":" PT_TOSTRING(__LINE__)
68 #define PT_ERROR_MSG(msg) __FILE__ ":" PT_TOSTRING(__LINE__) ": " #msg
74 #define PT_SOURCEINFO Pt::SourceInfo(__FILE__, PT_TOSTRING(__LINE__), PT_FUNCTION)
109 inline SourceInfo(
const char* f,
const char* ln,
const char* fn)
110 : _file(f), _line(ln), _func(fn)
115 inline const char*
file()
const
120 inline const char*
line()
const
125 inline const char*
func()
const
140 return std::string( info.
file() ) +
':' + info.
line() +
": " += what;
149 return std::string( info.
file() ) +
':' + info.
line() +
": " += what;
158 return std::string( info.
file() ) +
':' + info.
line() +
": " += what;
167 return std::string( info.
file() ) +
':' + info.
line() +
": " += what;
std::string operator+(const char *what, const SourceInfo &info)
Concatenates a string with a SourceInfo.
Definition: SourceInfo.h:147
const char * func() const
Returns the function signature.
Definition: SourceInfo.h:125
std::string operator+(const SourceInfo &info, const std::string &what)
Concatenates a string with a SourceInfo.
Definition: SourceInfo.h:156
Source code info class.
Definition: SourceInfo.h:100
SourceInfo(const char *f, const char *ln, const char *fn)
Constructor.
Definition: SourceInfo.h:109
const char * file() const
Returns the filename.
Definition: SourceInfo.h:115
std::string operator+(const std::string &what, const SourceInfo &info)
Concatenates a string with a SourceInfo.
Definition: SourceInfo.h:138
const char * line() const
Returns the line number.
Definition: SourceInfo.h:120
std::string operator+(const SourceInfo &info, const char *what)
Concatenates a string with a SourceInfo.
Definition: SourceInfo.h:165