New cpp folder structure

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-07-17 22:35:52 +03:00
committed by Konstantin Pastbin
parent c9cbb64f12
commit 76ffc99abd
2390 changed files with 345 additions and 339 deletions

31
libs/base/src_point.cpp Normal file
View File

@@ -0,0 +1,31 @@
#include "base/src_point.hpp"
#include <algorithm>
#include <sstream>
namespace base
{
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] == '/')
{
std::swap(p[0], p[1]);
p[0] = m_fileName + i + 1;
}
}
m_fileName = p[1];
}
std::string DebugPrint(SrcPoint const & srcPoint)
{
std::ostringstream out;
if (srcPoint.Line() > 0)
out << srcPoint.FileName() << ":" << srcPoint.Line() << " " << srcPoint.Function()
<< srcPoint.Postfix() << ": ";
return out.str();
}
} // namespace base