xtd 0.2.0
__xtd_source_location.hpp
Go to the documentation of this file.
1
3#pragma once
5#define __XTD_STD_INTERNAL__
7#undef __XTD_STD_INTERNAL__
8
9#if defined(__xtd__cpp_lib_source_location)
10#include <source_location>
11using __xtd_source_location__ = std::source_location;
12#else
13#include <cstdint>
14
15#define __XTD_FILE__ __builtin_FILE()
16#define __XTD_LINE__ __builtin_LINE()
17#define __XTD_FUNC__ __builtin_FUNCTION()
18#define __XTD_COLUMN__ __builtin_COLUMN()
19
20class __xtd_source_location__ {
21public:
22 const char* file_name() const noexcept {return data_.file;}
23 uint32_t line() const noexcept {return data_.line;}
24 const char* function_name() const noexcept {return data_.func;}
25 uint32_t column() const noexcept {return data_.column;}
26
27 static __xtd_source_location__ current(const char* file = __XTD_FILE__, uint32_t line = __XTD_LINE__, const char* func = __XTD_FUNC__, uint32_t column = __XTD_COLUMN__) noexcept {
28 auto csl = __xtd_source_location__ {};
29 csl.data_ = {file, line, func, column};
30 return csl;
31 }
32
33private:
34 struct data {
35 const char* file;
36 uint32_t line;
37 const char* func;
38 uint32_t column;
39 } data_;
40};
41
42#undef __XTD_FILE__
43#undef __XTD_LINE__
44#undef __XTD_FUNC__
45#undef __XTD_COLUMN__
46#endif
Contains __xtd_std_version definitions.
xtd::delegate< result_t(arguments_t... arguments)> func
Represents a delegate that has variables parameters and returns a value of the type specified by the ...
Definition func.hpp:27
@ current
Specifies the current position within a stream.