-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrc_point.hpp
47 lines (38 loc) · 1.04 KB
/
src_point.hpp
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
#pragma once
#include <string>
#ifndef SRC_LOGGING
#define SRC_LOGGING 1
#endif
#if SRC_LOGGING
#ifndef __OBJC__
#define SRC() base::SrcPoint(__FILE__, __LINE__, __FUNCTION__, "()")
#else
#define SRC() base::SrcPoint(__FILE__, __LINE__, __FUNCTION__)
#endif
#else
#define SRC() base::SrcPoint()
#endif
namespace base
{
class SrcPoint
{
public:
SrcPoint() : m_fileName(""), m_line(-1), m_function(""), m_postfix("") { TruncateFileName(); }
SrcPoint(char const * fileName, int line, char const * function, char const * postfix = "")
: m_fileName(fileName), m_line(line), m_function(function), m_postfix(postfix)
{
TruncateFileName();
}
char const * FileName() const { return m_fileName; }
int Line() const { return m_line; }
char const * Function() const { return m_function; }
char const * Postfix() const { return m_postfix; }
private:
void TruncateFileName();
char const * m_fileName;
int m_line;
char const * m_function;
char const * m_postfix;
};
std::string DebugPrint(SrcPoint const & srcPoint);
} // namespace base