mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 04:30:09 -05:00
Add ability to append multiple Options to an OptionProperty
via addOptions(vector<int>, vector<string>)
This commit is contained in:
@@ -61,6 +61,23 @@ void OptionProperty::addOption(int value, std::string desc) {
|
||||
_options.push_back(std::move(option));
|
||||
}
|
||||
|
||||
void OptionProperty::addOptions(std::vector<int> values, std::vector<std::string> descs) {
|
||||
if (values.size() != descs.size()) {
|
||||
LERROR("Skipping " << this->fullyQualifiedIdentifier() << ": "
|
||||
<< "number of values (" << values.size() << ") "
|
||||
<< "does not equal number of descriptions (" << descs.size() << ")"
|
||||
);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
LDEBUG(this->fullyQualifiedIdentifier() << ": Adding "
|
||||
<< descs[i]
|
||||
<< " (" << values[i] << ")"
|
||||
);
|
||||
this->addOption(values[i], descs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void OptionProperty::setValue(int value) {
|
||||
// Check if the passed value belongs to any option
|
||||
for (auto o : _options) {
|
||||
|
||||
Reference in New Issue
Block a user