summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/source_location.h
diff options
context:
space:
mode:
authorDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
committerDevtools Arcadia <[email protected]>2022-02-07 18:08:42 +0300
commit1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch)
treee26c9fed0de5d9873cce7e00bc214573dc2195b7 /library/cpp/yt/misc/source_location.h
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'library/cpp/yt/misc/source_location.h')
-rw-r--r--library/cpp/yt/misc/source_location.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/library/cpp/yt/misc/source_location.h b/library/cpp/yt/misc/source_location.h
new file mode 100644
index 00000000000..84213eea708
--- /dev/null
+++ b/library/cpp/yt/misc/source_location.h
@@ -0,0 +1,38 @@
+#pragma once
+
+namespace NYT {
+
+////////////////////////////////////////////////////////////////////////////////
+
+class TSourceLocation
+{
+public:
+ TSourceLocation()
+ : FileName_(nullptr)
+ , Line_(-1)
+ { }
+
+ TSourceLocation(const char* fileName, int line)
+ : FileName_(fileName)
+ , Line_(line)
+ { }
+
+ const char* GetFileName() const;
+ int GetLine() const;
+ bool IsValid() const;
+
+ bool operator<(const TSourceLocation& other) const;
+ bool operator==(const TSourceLocation& other) const;
+
+private:
+ const char* FileName_;
+ int Line_;
+
+};
+
+//! Defines a macro to record the current source location.
+#define FROM_HERE ::NYT::TSourceLocation(__FILE__, __LINE__)
+
+////////////////////////////////////////////////////////////////////////////////
+
+} // namespace NYT