Skip to content
Snippets Groups Projects
Commit de9e795b authored by Victor Poughon's avatar Victor Poughon
Browse files

REFAC: use plain array for parameterTypesStrings

parent 150f36db
No related branches found
No related tags found
No related merge requests found
......@@ -59,12 +59,13 @@ typedef enum
ParameterType_RAM,
ParameterType_OutputProcessXML,
ParameterType_InputProcessXML,
ParameterType_Bool
ParameterType_Bool,
ParameterType_MAX__
} ParameterType;
namespace
{
constexpr std::array<const char*, 24> parameterTypesStrings = {{
constexpr char const* parameterTypesStrings [] = {
"Int",
"Float",
"String",
......@@ -89,7 +90,8 @@ constexpr std::array<const char*, 24> parameterTypesStrings = {{
"OutputProcessXML",
"InputProcessXML",
"Bool"
}};
};
static_assert(std::extent<decltype(parameterTypesStrings)>::value == ParameterType_MAX__);
}
// Free functions to convert from and to std::string
......
......@@ -396,6 +396,8 @@ ParameterGroup::AddParameter(ParameterType type, std::string paramKey, std::stri
newParam = BoolParameter::New();
}
break;
default:
break;
}
if (newParam.IsNull())
......
......@@ -32,7 +32,7 @@ std::string ParameterTypeToString(ParameterType type)
ParameterType ParameterStringToType(const std::string& str)
{
for (std::size_t i = 0; i < parameterTypesStrings.size(); i++)
for (std::size_t i = 0; i < ParameterType_MAX__; i++)
{
if (str == parameterTypesStrings[i])
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment