aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/misc/source_location.h
blob: b59896fcdddc7005dc525d163642f36c32527227 (plain) (blame)
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
35
36
37
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