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
15namespace Catch {
16
17 namespace Detail {
18 struct EnumInfo {
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
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
#define value
Definition pkcs11.h:157
std::vector< std::pair< int, std::string > > m_values
StringRef lookup(int value) const
virtual Detail::EnumInfo const & registerEnum(StringRef enumName, StringRef allEnums, std::vector< int > const &values)=0
Detail::EnumInfo const & registerEnum(StringRef enumName, StringRef allEnums, std::initializer_list< E > values)