src/Viewer/ViewPropertyEvaluator.*: added getBoolValue().
This commit is contained in:
parent
1e07dab5c5
commit
db255233f7
2 changed files with 25 additions and 0 deletions
|
@ -498,6 +498,17 @@ namespace ViewPropertyEvaluator {
|
||||||
return default_;
|
return default_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getSequenceBoolValue(Sequence& sequence, bool default_)
|
||||||
|
{
|
||||||
|
SGPropertyNode* node = getSequenceNode(sequence);
|
||||||
|
if (node) {
|
||||||
|
if (node->getStringValue()[0] != 0) {
|
||||||
|
return node->getBoolValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return default_;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& getStringValue(const char* spec)
|
const std::string& getStringValue(const char* spec)
|
||||||
{
|
{
|
||||||
std::shared_ptr<Sequence> sequence = getSequence(spec);
|
std::shared_ptr<Sequence> sequence = getSequence(spec);
|
||||||
|
@ -515,6 +526,17 @@ namespace ViewPropertyEvaluator {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getBoolValue(const char* spec, bool default_)
|
||||||
|
{
|
||||||
|
std::shared_ptr<Sequence> sequence = getSequence(spec);
|
||||||
|
if (sequence->_nodes.size() != 1 || sequence->_nodes.front()->_begin[0] != '(') {
|
||||||
|
SG_LOG(SG_VIEW, SG_DEBUG, "bad sequence for getBoolValue() - must have outermost '(...)': '" << spec);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
bool ret = getSequenceBoolValue(*sequence, default_);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator << (std::ostream& out, const Dump& dump)
|
std::ostream& operator << (std::ostream& out, const Dump& dump)
|
||||||
{
|
{
|
||||||
out << "ViewPropertyEvaluator\n";
|
out << "ViewPropertyEvaluator\n";
|
||||||
|
|
|
@ -107,6 +107,9 @@ namespace ViewPropertyEvaluator {
|
||||||
*/
|
*/
|
||||||
double getDoubleValue(const char* spec, double default_=0);
|
double getDoubleValue(const char* spec, double default_=0);
|
||||||
|
|
||||||
|
/* Similar to getDoubleValue(). */
|
||||||
|
bool getBoolValue(const char* spec, bool default_=false);
|
||||||
|
|
||||||
|
|
||||||
/* Outputs detailed information about all specs that have been seen.
|
/* Outputs detailed information about all specs that have been seen.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue