Skip to content
Snippets Groups Projects

Fix/improve cppgen

Merged Fabian Tërnava requested to merge fix/improve-cppgen into master
2 files
+ 3
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -55,6 +55,8 @@ namespace armarx::aron::codegenerator::cpp::generator
// add legacy typedef
fields.push_back(std::make_shared<CppField>("using", std::string(IMPL_ENUM), simox::alg::to_lower(className) + "_details::Enum", "Legacy typedef of enum"));
ARMARX_CHECK(type.getAcceptedValueMap().size() > 0);
enum_to_name << "{" << std::endl;
name_to_enum << "{" << std::endl;
enum_to_value << "{" << std::endl;
@@ -81,7 +83,7 @@ namespace armarx::aron::codegenerator::cpp::generator
fields.push_back(std::make_shared<CppField>("static inline const std::map<" + std::string(IMPL_ENUM) + ", int>", "EnumToValueMap", enum_to_value.str(), "Mapping enum values to a int value"));
fields.push_back(std::make_shared<CppField>("static inline const std::map<int, " + std::string(IMPL_ENUM) + ">", "ValueToEnumMap", value_to_enum.str(), "Mapping int values to a enum"));
fields.push_back(std::make_shared<CppField>(std::string(IMPL_ENUM), "value", "", "The current value of the enum object"));
fields.push_back(std::make_shared<CppField>(std::string(IMPL_ENUM), "value", type.getAcceptedValueNames()[0], "The current value of the enum object"));
return fields;
}
@@ -162,12 +164,6 @@ namespace armarx::aron::codegenerator::cpp::generator
return c;
}*/
std::pair<std::vector<std::pair<std::string, std::string>>, bool> IntEnumClass::getCtorInitializers(const std::string&) const
{
ARMARX_CHECK(type.getAcceptedValueNames().size() > 0);
return {{{"value", type.getAcceptedValueNames()[0]}}, true};
}
CppCtorPtr IntEnumClass::toEnumCtor(const std::string& name) const
{
CppCtorPtr c = std::make_shared<CppCtor>(name + "(const " + std::string(IMPL_ENUM) + " e)");
Loading