43 lines
881 B
C++
43 lines
881 B
C++
#pragma once
|
|
#include <luna/Types.h>
|
|
|
|
#ifndef STRINGIZE_VALUE_OF
|
|
#define STRINGIZE(x) #x
|
|
#define STRINGIZE_VALUE_OF(x) STRINGIZE(x)
|
|
#endif
|
|
|
|
class SourceLocation
|
|
{
|
|
public:
|
|
constexpr const char* file()
|
|
{
|
|
return m_file;
|
|
}
|
|
|
|
constexpr u32 line()
|
|
{
|
|
return m_line;
|
|
}
|
|
|
|
constexpr const char* function()
|
|
{
|
|
return m_function;
|
|
}
|
|
|
|
constexpr static SourceLocation current(const char* file = __builtin_FILE(), u32 line = __builtin_LINE(),
|
|
const char* function = __builtin_FUNCTION())
|
|
{
|
|
return SourceLocation { file, line, function };
|
|
}
|
|
|
|
private:
|
|
constexpr SourceLocation(const char* file, u32 line, const char* function)
|
|
: m_file(file), m_line(line), m_function(function)
|
|
{
|
|
}
|
|
|
|
const char* m_file;
|
|
u32 m_line;
|
|
const char* m_function;
|
|
};
|