1 /*
2  *  Created by Phil on 25/2/2012.
3  *  Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
4  *
5  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
6  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7  */
8 #ifndef TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
9 #define TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
10 
11 #include "catch_common.h"
12 
13 namespace Catch {
14 
15     struct Colour {
16         enum Code {
17             None = 0,
18 
19             White,
20             Red,
21             Green,
22             Blue,
23             Cyan,
24             Yellow,
25             Grey,
26 
27             Bright = 0x10,
28 
29             BrightRed = Bright | Red,
30             BrightGreen = Bright | Green,
31             LightGrey = Bright | Grey,
32             BrightWhite = Bright | White,
33             BrightYellow = Bright | Yellow,
34 
35             // By intention
36             FileName = LightGrey,
37             Warning = BrightYellow,
38             ResultError = BrightRed,
39             ResultSuccess = BrightGreen,
40             ResultExpectedFailure = Warning,
41 
42             Error = BrightRed,
43             Success = Green,
44 
45             OriginalExpression = Cyan,
46             ReconstructedExpression = BrightYellow,
47 
48             SecondaryText = LightGrey,
49             Headers = White
50         };
51 
52         // Use constructed object for RAII guard
53         Colour( Code _colourCode );
54         Colour( Colour&& other ) noexcept;
55         Colour& operator=( Colour&& other ) noexcept;
56         ~Colour();
57 
58         // Use static method for one-shot changes
59         static void use( Code _colourCode );
60 
61     private:
62         bool m_moved = false;
63     };
64 
65     std::ostream& operator << ( std::ostream& os, Colour const& );
66 
67 } // end namespace Catch
68 
69 #endif // TWOBLUECUBES_CATCH_CONSOLE_COLOUR_HPP_INCLUDED
70