// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include #include #include "Common/Config/Enums.h" namespace Config { namespace detail { // std::underlying_type may only be used with enum types, so make sure T is an enum type first. template using UnderlyingType = typename std::enable_if_t{}, std::underlying_type>::type; } // namespace detail struct ConfigLocation { System system; std::string section; std::string key; bool operator==(const ConfigLocation& other) const; bool operator!=(const ConfigLocation& other) const; bool operator<(const ConfigLocation& other) const; }; template struct ConfigInfo { ConfigInfo(const ConfigLocation& location_, const T& default_value_) : location{location_}, default_value{default_value_} { } // Make it easy to convert ConfigInfo into ConfigInfo> // so that enum settings can still easily work with code that doesn't care about the enum values. template >::value>* = nullptr> ConfigInfo(const ConfigInfo& other) : location{other.location}, default_value{static_cast>( other.default_value)} { } ConfigLocation location; T default_value; }; } // namespace Config