Diag-Client-Lib
file_path.h
Go to the documentation of this file.
1 #include <string_view>
2 
3 namespace utility {
4 namespace details {
5 // constexpr function to strip the file path
6 constexpr std::string_view StripFilePath(std::string_view path) {
7  size_t pos{path.find_last_of("/\\")};
8  return (pos == std::string_view::npos) ? path : path.substr(pos + 1);
9 }
10 } // namespace details
11 } // namespace utility
12 
13 // Macro to get the file name during compile time
14 #define FILE_NAME utility::details::StripFilePath(__FILE__)
constexpr std::string_view StripFilePath(std::string_view path)
Definition: file_path.h:6