mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	VS integration part 1 - allow catch_message.hpp to be included by more than 1 source file
This commit is contained in:
		@@ -38,6 +38,7 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
 | 
			
		||||
#define INTERNAL_CATCH_INLINE
 | 
			
		||||
#include "internal/catch_impl.hpp"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,8 +31,6 @@ namespace Catch {
 | 
			
		||||
        bool operator < ( MessageInfo const& other ) const {
 | 
			
		||||
            return sequence < other.sequence;
 | 
			
		||||
        }
 | 
			
		||||
    private:
 | 
			
		||||
        static unsigned int globalCount;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct MessageBuilder {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,28 +12,32 @@
 | 
			
		||||
 | 
			
		||||
namespace Catch {
 | 
			
		||||
 | 
			
		||||
    MessageInfo::MessageInfo(   std::string const& _macroName,
 | 
			
		||||
    template <typename T>
 | 
			
		||||
    struct MessageInfoCounter {
 | 
			
		||||
        // This may need protecting if threading support is added
 | 
			
		||||
        static T globalCount;
 | 
			
		||||
    };
 | 
			
		||||
    template <typename T>
 | 
			
		||||
    T MessageInfoCounter<T>::globalCount = T();
 | 
			
		||||
 | 
			
		||||
    INTERNAL_CATCH_INLINE MessageInfo::MessageInfo(   std::string const& _macroName,
 | 
			
		||||
                                SourceLineInfo const& _lineInfo,
 | 
			
		||||
                                ResultWas::OfType _type )
 | 
			
		||||
    :   macroName( _macroName ),
 | 
			
		||||
        lineInfo( _lineInfo ),
 | 
			
		||||
        type( _type ),
 | 
			
		||||
        sequence( ++globalCount )
 | 
			
		||||
        sequence( ++MessageInfoCounter<unsigned int>::globalCount )
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    // This may need protecting if threading support is added
 | 
			
		||||
    unsigned int MessageInfo::globalCount = 0;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    ////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
    ScopedMessage::ScopedMessage( MessageBuilder const& builder )
 | 
			
		||||
    INTERNAL_CATCH_INLINE ScopedMessage::ScopedMessage( MessageBuilder const& builder )
 | 
			
		||||
    : m_info( builder.m_info )
 | 
			
		||||
    {
 | 
			
		||||
        m_info.message = builder.m_stream.str();
 | 
			
		||||
        getResultCapture().pushScopedMessage( m_info );
 | 
			
		||||
    }
 | 
			
		||||
    ScopedMessage::~ScopedMessage() {
 | 
			
		||||
    INTERNAL_CATCH_INLINE ScopedMessage::~ScopedMessage() {
 | 
			
		||||
        getResultCapture().popScopedMessage( m_info );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user