00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _psourceinfo_h_
00021 #define _psourceinfo_h_
00022
00023 #include <pclasses/pexport.h>
00024
00025
00026 #ifdef __GNUC__
00027 #define P_PRETTY_FUNCTION __PRETTY_FUNCTION__
00028
00029 #elif defined(__BORLANDC__)
00030 #define P_PRETTY_FUNCTION __FUNC__
00031
00032 #elif defined(_MSC_VER_)
00033
00034 #if _MSC_VER_ >= 1300
00035 #define P_PRETTY_FUNCTION __FUNCDNAME__
00036 #else
00037 #define P_PRETTY_FUNCTION __FUNCTION__
00038 #endif
00039
00040 #else
00041 #define P_PRETTY_FUNCTION __FUNCTION__
00042 #endif
00043
00044 #define P_SOURCEINFO P::SourceInfo(__FILE__,__LINE__,P_PRETTY_FUNCTION)
00045
00046 namespace P {
00047
00049
00055 class PCORE_EXPORT SourceInfo {
00056 public:
00058 SourceInfo() throw();
00059
00061 SourceInfo(const SourceInfo& si) throw();
00062
00064
00069 SourceInfo(const char* _file, unsigned int _line, const char* _func) throw();
00070
00072
00077 inline const char* file() const throw() {
00078 return m_file;
00079 }
00080
00082
00087 inline unsigned int line() const throw() {
00088 return m_line;
00089 }
00090
00092
00097 inline const char* func() const throw() {
00098 return m_func;
00099 }
00100
00102 SourceInfo& operator=(const SourceInfo& si);
00103
00104 private:
00105 const char* m_file;
00106 unsigned int m_line;
00107 const char* m_func;
00108
00109 };
00110
00111 }
00112
00113 #endif