As an example of using the enum_bitmask infrastructure for type safe

sets of optional boolean parameters, the cut function "keep upper",
"keep lower" and "flip lower" boolean parameters were converted into
a single type safe enum_bitmask. Such a coding style is certainly
wordier than the original code, but much safer and more readable
than the error prone "boolean, boolean, boolean" function call
parameter list.
This commit is contained in:
Vojtech Bubnik 2021-06-27 17:36:25 +02:00
parent 0f3cabb5d9
commit e4e8c5df12
6 changed files with 38 additions and 26 deletions

View file

@ -376,7 +376,7 @@ int CLI::run(int argc, char **argv)
o->cut(Z, m_config.opt_float("cut"), &out);
}
#else
model.objects.front()->cut(0, m_config.opt_float("cut"), true, true, true);
model.objects.front()->cut(0, m_config.opt_float("cut"), ModelObjectCutAttribute::KeepLower | ModelObjectCutAttribute::KeepUpper | ModelObjectCutAttribute::FlipLower);
#endif
model.delete_object(size_t(0));
}