blob: 54b8976c1885382e893ec95071e746c77384059b (
plain)
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
|
#include "base/src_point.hpp"
#include "std/algorithm.hpp"
#include "std/sstream.hpp"
namespace my
{
void SrcPoint::TruncateFileName()
{
size_t const maxLen = 10000;
char const * p[] = { m_fileName, m_fileName };
for (size_t i = 0; i < maxLen && m_fileName[i]; ++i)
{
if (m_fileName[i] == '\\' || m_fileName[i] == '/')
{
swap(p[0], p[1]);
p[0] = m_fileName + i + 1;
}
}
m_fileName = p[1];
}
} // namespace my
string DebugPrint(my::SrcPoint const & srcPoint)
{
ostringstream out;
if (srcPoint.Line() > 0)
out << srcPoint.FileName() << ":" << srcPoint.Line() << " " << srcPoint.Function()
<< srcPoint.Postfix() << " ";
return out.str();
}
|