Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal/catch_message_info.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-05-10 16:44:27 +0200
committerMartin Hořeňovský2020-05-10 20:20:52 +0200
commited967fd7fcb0f1d995d11ebf1d7d4106d582d43c (patch)
tree158f20386c33958c08290e8e37a79875b03307a6 /src/catch2/internal/catch_message_info.cpp
parent7030d7740d4d576149d5afb31b2f7668d02f8bdc (diff)
downloadcatch3-ed967fd7fcb0f1d995d11ebf1d7d4106d582d43c.tar.gz
Split MessageInfo into its own header
This is first step towards splitting apart reporter implementation and `catch_string.hpp`.
Diffstat (limited to 'src/catch2/internal/catch_message_info.cpp')
-rw-r--r--src/catch2/internal/catch_message_info.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/catch2/internal/catch_message_info.cpp b/src/catch2/internal/catch_message_info.cpp
new file mode 100644
index 00000000..65d990ad
--- /dev/null
+++ b/src/catch2/internal/catch_message_info.cpp
@@ -0,0 +1,26 @@
+
+#include <catch2/internal/catch_message_info.hpp>
+
+namespace Catch {
+
+ MessageInfo::MessageInfo( StringRef const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ type( _type ),
+ sequence( ++globalCount )
+ {}
+
+ bool MessageInfo::operator==( MessageInfo const& other ) const {
+ return sequence == other.sequence;
+ }
+
+ bool MessageInfo::operator<( MessageInfo const& other ) const {
+ return sequence < other.sequence;
+ }
+
+ // This may need protecting if threading support is added
+ unsigned int MessageInfo::globalCount = 0;
+
+} // end namespace Catch