Split MessageInfo into its own header

This is first step towards splitting apart reporter implementation
and `catch_string.hpp`.
This commit is contained in:
Martin Hořeňovský committed 2020-05-10 20:20:52 +02:00
1 parent 7030d7740d
commit ed967fd7fc
9 files changed
+64 -39

No files matched your search

@@ -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
@@ -0,0 +1,31 @@
#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED
#define CATCH_MESSAGE_INFO_HPP_INCLUDED
#include <catch2/internal/catch_result_type.hpp>
#include <catch2/internal/catch_common.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
#include <string>
namespace Catch {
struct MessageInfo {
MessageInfo( StringRef const& _macroName,
SourceLineInfo const& _lineInfo,
ResultWas::OfType _type );
StringRef macroName;
std::string message;
SourceLineInfo lineInfo;
ResultWas::OfType type;
unsigned int sequence;
bool operator == ( MessageInfo const& other ) const;
bool operator < ( MessageInfo const& other ) const;
private:
static unsigned int globalCount;
};
} // end namespace Catch
#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED
@@ -16,6 +16,7 @@
#include <catch2/internal/catch_test_registry.hpp>
#include <catch2/catch_test_case_info.hpp>
#include <catch2/internal/catch_test_macro_impl.hpp>
#include <catch2/catch_message.hpp>
#include <catch2/catch_totals.hpp>
#include <catch2/catch_test_spec.hpp>
#include <catch2/internal/catch_test_case_tracker.hpp>