source_location.h 819 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma once
  2. namespace NYT {
  3. ////////////////////////////////////////////////////////////////////////////////
  4. class TSourceLocation
  5. {
  6. public:
  7. TSourceLocation()
  8. : FileName_(nullptr)
  9. , Line_(-1)
  10. { }
  11. TSourceLocation(const char* fileName, int line)
  12. : FileName_(fileName)
  13. , Line_(line)
  14. { }
  15. const char* GetFileName() const;
  16. int GetLine() const;
  17. bool IsValid() const;
  18. bool operator<(const TSourceLocation& other) const;
  19. bool operator==(const TSourceLocation& other) const;
  20. private:
  21. const char* FileName_;
  22. int Line_;
  23. };
  24. //! Defines a macro to record the current source location.
  25. #define FROM_HERE ::NYT::TSourceLocation(__FILE__, __LINE__)
  26. ////////////////////////////////////////////////////////////////////////////////
  27. } // namespace NYT