forked from catchorg/Catch2
		
	
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
/*
 | 
						|
 *  Created by Phil Nash on 1/2/2013.
 | 
						|
 *  Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
 | 
						|
 *
 | 
						|
 *  Distributed under the Boost Software License, Version 1.0. (See accompanying
 | 
						|
 *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 | 
						|
 */
 | 
						|
#ifndef TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED
 | 
						|
#define TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED
 | 
						|
 | 
						|
#include "catch_message.h"
 | 
						|
 | 
						|
namespace Catch {
 | 
						|
 | 
						|
    MessageInfo::MessageInfo(   std::string const& _macroName,
 | 
						|
                                SourceLineInfo const& _lineInfo,
 | 
						|
                                ResultWas::OfType _type )
 | 
						|
    :   macroName( _macroName ),
 | 
						|
        lineInfo( _lineInfo ),
 | 
						|
        type( _type ),
 | 
						|
        sequence( ++globalCount )
 | 
						|
    {}
 | 
						|
 | 
						|
    // This may need protecting if threading support is added
 | 
						|
    unsigned int MessageInfo::globalCount = 0;
 | 
						|
 | 
						|
 | 
						|
    ////////////////////////////////////////////////////////////////////////////
 | 
						|
 | 
						|
    ScopedMessage::ScopedMessage( MessageBuilder const& builder )
 | 
						|
    :   m_info( builder.m_info ),
 | 
						|
        m_runContext( getCurrentRunContext() )
 | 
						|
    {
 | 
						|
        m_info.message = builder.m_stream.str();
 | 
						|
        m_runContext.pushScopedMessage( m_info );
 | 
						|
    }
 | 
						|
    ScopedMessage::ScopedMessage( ScopedMessage const& other )
 | 
						|
    :   m_info( other.m_info ),
 | 
						|
        m_runContext( other.m_runContext )
 | 
						|
    {}
 | 
						|
 | 
						|
    ScopedMessage::~ScopedMessage() {
 | 
						|
        m_runContext.popScopedMessage( m_info );
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
} // end namespace Catch
 | 
						|
 | 
						|
#endif // TWOBLUECUBES_CATCH_MESSAGE_HPP_INCLUDED
 |