Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
32c980b7
Commit
32c980b7
authored
Apr 02, 2014
by
Christian Schulte zu Berge
Browse files
Introducing GenericOptionProperty::selectByOption()
parent
f52c44b3
Changes
1
Show whitespace changes
Inline
Side-by-side
core/properties/optionproperty.h
View file @
32c980b7
...
...
@@ -158,6 +158,12 @@ namespace campvis {
*/
void
selectByIndex
(
int
index
);
/**
* Sets the selected option to \a option.
* \param option Option to set.
*/
void
selectByOption
(
T
option
);
protected:
std
::
vector
<
GenericOption
<
T
>
>
_options
;
};
...
...
@@ -223,6 +229,17 @@ namespace campvis {
setValue
(
index
);
}
template
<
typename
T
>
void
campvis
::
GenericOptionProperty
<
T
>::
selectByOption
(
T
option
)
{
for
(
size_t
i
=
0
;
i
<
_options
.
size
();
++
i
)
{
if
(
_options
[
i
].
_value
==
option
)
{
setValue
(
static_cast
<
int
>
(
i
));
return
;
}
}
LERROR
(
"Could not find specified option."
);
}
}
#endif // OPTIONPROPERTY_H__
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment