Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_interfaces_enum_values_registry.h
Go to the documentation of this file.
1
/*
2
* Created by Phil on 4/4/2019.
3
* Copyright 2019 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_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
9
#define TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
10
11
#include "
catch_stringref.h
"
12
13
#include <vector>
14
15
namespace
Catch
{
16
17
namespace
Detail {
18
struct
EnumInfo
{
19
StringRef
m_name
;
20
std::vector<std::pair<int, std::string>>
m_values
;
21
22
~EnumInfo
();
23
24
StringRef
lookup
(
int
value
)
const
;
25
};
26
}
// namespace Detail
27
28
struct
IMutableEnumValuesRegistry
{
29
virtual
~IMutableEnumValuesRegistry
();
30
31
virtual
Detail::EnumInfo
const
&
registerEnum
(
StringRef
enumName,
StringRef
allEnums, std::vector<int>
const
& values ) = 0;
32
33
template
<
typename
E>
34
Detail::EnumInfo
const
&
registerEnum
(
StringRef
enumName,
StringRef
allEnums, std::initializer_list<E> values ) {
35
std::vector<int> intValues;
36
intValues.reserve( values.size() );
37
for
(
auto
enumValue : values )
38
intValues.push_back(
static_cast<
int
>
( enumValue ) );
39
return
registerEnum
( enumName, allEnums, intValues );
40
}
41
};
42
43
}
// Catch
44
45
#endif
//TWOBLUECUBES_CATCH_INTERFACESENUMVALUESREGISTRY_H_INCLUDED
catch_stringref.h
Catch::StringRef
Definition
catch.hpp:522
Catch
Definition
231-Cfg-OutputStreams.cpp:32
value
#define value
Definition
pkcs11.h:157
Catch::Detail::EnumInfo
Definition
catch_interfaces_enum_values_registry.h:18
Catch::Detail::EnumInfo::m_values
std::vector< std::pair< int, std::string > > m_values
Definition
catch_interfaces_enum_values_registry.h:20
Catch::Detail::EnumInfo::m_name
StringRef m_name
Definition
catch_interfaces_enum_values_registry.h:19
Catch::Detail::EnumInfo::lookup
StringRef lookup(int value) const
Definition
catch_enum_values_registry.cpp:34
Catch::Detail::EnumInfo::~EnumInfo
~EnumInfo()
Definition
catch_enum_values_registry.cpp:32
Catch::IMutableEnumValuesRegistry
Definition
catch_interfaces_enum_values_registry.h:28
Catch::IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry
virtual ~IMutableEnumValuesRegistry()
Definition
catch_enum_values_registry.cpp:17
Catch::IMutableEnumValuesRegistry::registerEnum
virtual Detail::EnumInfo const & registerEnum(StringRef enumName, StringRef allEnums, std::vector< int > const &values)=0
Catch::IMutableEnumValuesRegistry::registerEnum
Detail::EnumInfo const & registerEnum(StringRef enumName, StringRef allEnums, std::initializer_list< E > values)
Definition
catch_interfaces_enum_values_registry.h:34
libraries
sys-vm
external
Catch2
include
internal
catch_interfaces_enum_values_registry.h
Generated by
1.12.0