|
@@ -16,6 +16,47 @@
|
|
|
|
|
|
namespace SP {
|
|
|
|
|
|
+ namespace Detail
|
|
|
+ {
|
|
|
+
|
|
|
+ struct SourceLineInfo {
|
|
|
+
|
|
|
+ SourceLineInfo() :file(""), line(0) {/*empty*/ }
|
|
|
+ SourceLineInfo(char const* file, std::size_t line) :file(file), line(line) {/*empty*/ }
|
|
|
+
|
|
|
+
|
|
|
+#if defined(_MSC_VER)
|
|
|
+#else
|
|
|
+ SourceLineInfo(SourceLineInfo const& rhs) = default;
|
|
|
+ SourceLineInfo(SourceLineInfo&& rhs) = default;
|
|
|
+ SourceLineInfo& operator = (SourceLineInfo const& rhs) = default;
|
|
|
+ SourceLineInfo& operator =(SourceLineInfo&& rhs) = default;
|
|
|
+#endif //_MSC_VER
|
|
|
+
|
|
|
+ bool operator == (SourceLineInfo const& rhs) const {
|
|
|
+ return line < rhs.line || (line == rhs.line && (std::strcmp(file, rhs.file) < 0));
|
|
|
+ }
|
|
|
+ bool operator < (SourceLineInfo const& rhs) const {
|
|
|
+ return line == rhs.line && (file == rhs.file || std::strcmp(file, rhs.file) == 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ const std::string ToString() const {
|
|
|
+ std::ostringstream oss;
|
|
|
+ oss << "file: {" << _GetFileName(file) << "} ,line: {" << line << "}";
|
|
|
+ return oss.str();
|
|
|
+ }
|
|
|
+
|
|
|
+ char const* file;
|
|
|
+ std::size_t line;
|
|
|
+ };
|
|
|
+
|
|
|
+ inline std::ostream& operator << (std::ostream& os, SourceLineInfo const& info)
|
|
|
+ {
|
|
|
+ os << info.file << '(' << info.line << ')';
|
|
|
+ return os;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
namespace Catch {
|
|
|
|
|
|
class CBaseException : public std::exception
|
|
@@ -68,4 +109,6 @@ namespace SP {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#define SP_INTERNAL_LINEINFO ::SP::Detail::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
|
|
|
+
|
|
|
#endif /** _RVC_CATCH_H__*/
|