#pragma once #include #include namespace settings { class SettingsObjectData { public: template void addValue( const Value value ) { std::list& list = getListObject(); list.push_back( value ); } template Value getNextValueOrDefault( const Value defaultValue ) { Value returnedValue = defaultValue; std::list& list = getListObject(); if ( hasValuesOfType() ) { returnedValue = list.front(); list.pop_front(); } return returnedValue; } template bool hasValuesOfType() { std::list& list = getListObject(); return !list.empty(); } template void consumeDeprecatedValue() { getNextValueOrDefault( Value{} ); } template void addDeprecatedValue( const Value value ) { addValue( value ); } private: template std::list& getListObject() { using std::is_same; const auto isBool = is_same::value; const auto isInt = is_same::value; const auto isDouble = is_same::value; const auto isString = is_same::value; static_assert( isBool || isInt || isDouble || isString, "Type is not supported for the settings object." ); if constexpr ( isBool ) { return m_boolValues; } else if constexpr ( isInt ) { return m_intValues; } else if constexpr ( isDouble ) { return m_doubleValues; } else if constexpr ( isString ) { return m_stringValues; } } std::list m_boolValues; std::list m_intValues; std::list m_doubleValues; std::list m_stringValues; }; } // namespace settings