mirror of
https://github.com/catchorg/Catch2.git
synced 2025-02-17 03:43:29 +01:00
Made Colour copyable to remove warning
This commit is contained in:
parent
a31f05fe83
commit
a469d9bc0f
@ -54,14 +54,15 @@ namespace Catch {
|
|||||||
|
|
||||||
// Use constructed object for RAII guard
|
// Use constructed object for RAII guard
|
||||||
Colour( Code _colourCode );
|
Colour( Code _colourCode );
|
||||||
|
Colour( Colour const& other );
|
||||||
~Colour();
|
~Colour();
|
||||||
|
|
||||||
// Use static method for one-shot changes
|
// Use static method for one-shot changes
|
||||||
static void use( Code _colourCode );
|
static void use( Code _colourCode );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Colour( Colour const& other );
|
|
||||||
static Detail::IColourImpl* impl();
|
static Detail::IColourImpl* impl();
|
||||||
|
bool m_moved;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::ostream& operator << ( std::ostream& os, Colour const& ) { return os; }
|
inline std::ostream& operator << ( std::ostream& os, Colour const& ) { return os; }
|
||||||
|
@ -149,8 +149,9 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Colour::Colour( Code _colourCode ){ use( _colourCode ); }
|
Colour::Colour( Code _colourCode ) : m_moved( false ) { use( _colourCode ); }
|
||||||
Colour::~Colour(){ use( None ); }
|
Colour::Colour( Colour const& _other ) : m_moved( false ) { const_cast<Colour&>( _other ).m_moved = true; }
|
||||||
|
Colour::~Colour(){ if( !m_moved ) use( None ); }
|
||||||
void Colour::use( Code _colourCode ) {
|
void Colour::use( Code _colourCode ) {
|
||||||
impl()->use( _colourCode );
|
impl()->use( _colourCode );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user