// Copyright Catch2 Authors // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 #pragma once #include #include #include #include namespace Catch { namespace Detail { struct EnumInfo { StringRef m_name; std::vector> m_values; StringRef lookup( int64_t value ) const; }; EnumInfo makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); template Detail::EnumInfo makeEnumInfo( StringRef enumName, StringRef allEnums, std::initializer_list values ) { static_assert( sizeof( int64_t ) >= sizeof( E ), "Cannot serialize enum to int64_t" ); std::vector intValues; intValues.reserve( values.size() ); for ( auto enumValue : values ) intValues.push_back( static_cast( enumValue ) ); return makeEnumInfo( enumName, allEnums, intValues ); } std::vector parseEnums( StringRef enums ); } // namespace Detail } // namespace Catch