Turn UseColour into enum class

This commit is contained in:
Martin Hořeňovský 2020-08-11 15:50:51 +02:00
parent b0531404e4
commit aa28a917cb
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
4 changed files with 8 additions and 8 deletions

View File

@ -74,7 +74,7 @@ namespace Catch {
double Config::minDuration() const { return m_data.minDuration; }
TestRunOrder Config::runOrder() const { return m_data.runOrder; }
unsigned int Config::rngSeed() const { return m_data.rngSeed; }
UseColour::YesOrNo Config::useColour() const { return m_data.useColour; }
UseColour Config::useColour() const { return m_data.useColour; }
bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
int Config::abortAfter() const { return m_data.abortAfter; }
bool Config::showInvisibles() const { return m_data.showInvisibles; }

View File

@ -46,7 +46,7 @@ namespace Catch {
ShowDurations showDurations = ShowDurations::DefaultForReporter;
double minDuration = -1;
TestRunOrder runOrder = TestRunOrder::Declared;
UseColour::YesOrNo useColour = UseColour::Auto;
UseColour useColour = UseColour::Auto;
WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;
std::string outputFilename;
@ -98,7 +98,7 @@ namespace Catch {
double minDuration() const override;
TestRunOrder runOrder() const override;
unsigned int rngSeed() const override;
UseColour::YesOrNo useColour() const override;
UseColour useColour() const override;
bool shouldDebugBreak() const override;
int abortAfter() const override;
bool showInvisibles() const override;

View File

@ -39,11 +39,11 @@ namespace Catch {
LexicographicallySorted,
Randomized
};
struct UseColour { enum YesOrNo {
enum class UseColour {
Auto,
Yes,
No
}; };
};
struct WaitForKeypress { enum When {
Never,
BeforeStart = 1,
@ -73,7 +73,7 @@ namespace Catch {
virtual std::vector<std::string> const& getTestsOrTags() const = 0;
virtual TestRunOrder runOrder() const = 0;
virtual unsigned int rngSeed() const = 0;
virtual UseColour::YesOrNo useColour() const = 0;
virtual UseColour useColour() const = 0;
virtual std::vector<std::string> const& getSectionsToRun() const = 0;
virtual Verbosity verbosity() const = 0;

View File

@ -106,7 +106,7 @@ namespace {
static Win32ColourImpl s_instance;
auto const* config = getCurrentContext().getConfig();
UseColour::YesOrNo colourMode = config?
UseColour colourMode = config?
config->useColour() : UseColour::Auto;
if( colourMode == UseColour::Auto )
colourMode = UseColour::Yes;
@ -179,7 +179,7 @@ namespace {
IColourImpl* platformColourInstance() {
ErrnoGuard guard;
auto const* config = getCurrentContext().getConfig();
UseColour::YesOrNo colourMode = config
UseColour colourMode = config
? config->useColour()
: UseColour::Auto;
if( colourMode == UseColour::Auto )