SourceCodeLocation.hpp
1 // @formatter:off
2 //
3 // Balau core C++ library
4 //
5 // Copyright (C) 2008 Bora Software (contact@borasoftware.com)
6 //
7 // Licensed under the Boost Software License - Version 1.0 - August 17th, 2003.
8 // See the LICENSE file for the full license text.
9 //
10 
16 
17 #ifndef COM_BORA_SOFTWARE__BALAU_TYPE__SOURCE_CODE_LOCATION
18 #define COM_BORA_SOFTWARE__BALAU_TYPE__SOURCE_CODE_LOCATION
19 
20 #include <Balau/Type/ToString.hpp>
21 
22 namespace Balau {
23 
28  const char * file;
29  unsigned int line;
30 
32  : file(nullptr)
33  , line(0) {}
34 
35  SourceCodeLocation(const char * file_, unsigned int line_)
36  : file(file_)
37  , line(line_) {}
38 };
39 
40 inline std::string toString(const SourceCodeLocation & location) {
41  return ::toString(location.file) + ":" + ::toString(location.line);
42 }
43 
44 } // namespace Balau
45 
46 #endif // COM_BORA_SOFTWARE__BALAU_TYPE__SOURCE_CODE_LOCATION
Pre-defined universal to-string functions.
Balau::U8String< AllocatorT > toString(const BalauException &e)
Base class toString<AllocatorT> function for Balau exceptions.
Definition: BalauException.hpp:122
The root Balau namespace.
Definition: ApplicationConfiguration.hpp:23
A type used to representing a source code file and line number pair, obtained via the FILE and LINE m...
Definition: SourceCodeLocation.hpp:27
Balau::U8String< AllocatorT > toString(LoggingLevel level)
Print the logging level as a UTF-8 string.
Definition: LoggingLevel.hpp:73