mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Split out colour mode string parsing into its own function
This commit is contained in:
		@@ -8,6 +8,8 @@
 | 
			
		||||
 | 
			
		||||
#include <catch2/internal/catch_reporter_spec_parser.hpp>
 | 
			
		||||
 | 
			
		||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
 | 
			
		||||
 | 
			
		||||
namespace Catch {
 | 
			
		||||
 | 
			
		||||
    namespace Detail {
 | 
			
		||||
@@ -59,6 +61,21 @@ namespace Catch {
 | 
			
		||||
 | 
			
		||||
            return parts;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        Optional<ColourMode> stringToColourMode( StringRef colourMode ) {
 | 
			
		||||
            if ( colourMode == "default" ) {
 | 
			
		||||
                return ColourMode::PlatformDefault;
 | 
			
		||||
            } else if ( colourMode == "ansi" ) {
 | 
			
		||||
                return ColourMode::ANSI;
 | 
			
		||||
            } else if ( colourMode == "win32" ) {
 | 
			
		||||
                return ColourMode::Win32;
 | 
			
		||||
            } else if ( colourMode == "none" ) {
 | 
			
		||||
                return ColourMode::None;
 | 
			
		||||
            } else {
 | 
			
		||||
                return {};
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } // namespace Detail
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
} // namespace Catch
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@
 | 
			
		||||
#ifndef CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED
 | 
			
		||||
#define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED
 | 
			
		||||
 | 
			
		||||
#include <catch2/internal/catch_optional.hpp>
 | 
			
		||||
#include <catch2/internal/catch_stringref.hpp>
 | 
			
		||||
 | 
			
		||||
#include <vector>
 | 
			
		||||
@@ -15,9 +16,13 @@
 | 
			
		||||
 | 
			
		||||
namespace Catch {
 | 
			
		||||
 | 
			
		||||
    enum class ColourMode : std::uint8_t;
 | 
			
		||||
 | 
			
		||||
    namespace Detail {
 | 
			
		||||
        //! Splits the reporter spec into reporter name and kv-pair options
 | 
			
		||||
        std::vector<std::string> splitReporterSpec( StringRef reporterSpec );
 | 
			
		||||
 | 
			
		||||
        Optional<ColourMode> stringToColourMode( StringRef colourMode );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user