|
osgEarth 2.1.1
|
Collaboration diagram for osgEarth::Symbology::StringExpression:Public Types | |
| typedef std::pair< std::string, unsigned > | Variable |
| typedef std::vector< Variable > | Variables |
Public Member Functions | |
| StringExpression () | |
| StringExpression (const Config &conf) | |
| StringExpression (const std::string &expr) | |
| StringExpression (const StringExpression &rhs) | |
| const Variables & | variables () const |
| void | set (const Variable &var, const std::string &value) |
| const std::string & | eval () const |
| const std::string & | expr () const |
| bool | empty () const |
| void | setURIContext (const URIContext &uriContext) |
| const URIContext & | uriContext () const |
| Config | getConfig () const |
| void | mergeConfig (const Config &conf) |
Private Types | |
| enum | Op { OPERAND, VARIABLE } |
| typedef std::pair< Op, std::string > | Atom |
| typedef std::vector< Atom > | AtomVector |
Private Member Functions | |
| void | init () |
Private Attributes | |
| std::string | _src |
| AtomVector | _infix |
| Variables | _vars |
| std::string | _value |
| bool | _dirty |
| URIContext | _uriContext |
Simple string expression evaluator with variables.
Definition at line 92 of file Expression.
typedef std::pair<Op,std::string> osgEarth::Symbology::StringExpression::Atom [private] |
Definition at line 133 of file Expression.
typedef std::vector<Atom> osgEarth::Symbology::StringExpression::AtomVector [private] |
Definition at line 134 of file Expression.
| typedef std::pair<std::string,unsigned> osgEarth::Symbology::StringExpression::Variable |
Definition at line 95 of file Expression.
| typedef std::vector<Variable> osgEarth::Symbology::StringExpression::Variables |
Definition at line 96 of file Expression.
enum osgEarth::Symbology::StringExpression::Op [private] |
Definition at line 132 of file Expression.
| osgEarth::Symbology::StringExpression::StringExpression | ( | ) | [inline] |
Definition at line 99 of file Expression.
{ }
| StringExpression::StringExpression | ( | const Config & | conf | ) |
Definition at line 305 of file Expression.cpp.
{
mergeConfig( conf );
init();
}
Here is the call graph for this function:| StringExpression::StringExpression | ( | const std::string & | expr | ) |
| StringExpression::StringExpression | ( | const StringExpression & | rhs | ) |
Copy ctor.
Definition at line 294 of file Expression.cpp.
| bool osgEarth::Symbology::StringExpression::empty | ( | ) | const [inline] |
Whether the expression is empty
Definition at line 122 of file Expression.
{ return _src.empty(); }
Here is the caller graph for this function:| const std::string & StringExpression::eval | ( | ) | const |
Evaluate the expression.
Definition at line 368 of file Expression.cpp.
{
if ( _dirty )
{
std::stringstream buf;
for( AtomVector::const_iterator i = _infix.begin(); i != _infix.end(); ++i )
buf << i->second;
const_cast<StringExpression*>(this)->_value = buf.str();
const_cast<StringExpression*>(this)->_dirty = false;
}
return _value;
}
Here is the caller graph for this function:| const std::string& osgEarth::Symbology::StringExpression::expr | ( | ) | const [inline] |
| Config StringExpression::getConfig | ( | ) | const |
Definition at line 319 of file Expression.cpp.
| void StringExpression::init | ( | ) | [private] |
Definition at line 325 of file Expression.cpp.
{
StringTokenizer izer("", "");
izer.addDelims( "[]", true );
izer.addQuotes( "'\"", false );
izer.keepEmpties() = false;
izer.trimTokens() = false;
StringVector t;
izer.tokenize( _src, t );
//tokenize(_src, t, "[]", "'\"", false, true, false);
// identify tokens:
bool invar = false;
for( unsigned i=0; i<t.size(); ++i )
{
if ( t[i] == "[" && !invar )
{
invar = true;
}
else if ( t[i] == "]" && invar )
{
invar = false;
_infix.push_back( Atom(VARIABLE,"") );
_vars.push_back( Variable(t[i-1],0) );
}
else
_infix.push_back( Atom(OPERAND,t[i]) );
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void StringExpression::mergeConfig | ( | const Config & | conf | ) |
Definition at line 312 of file Expression.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| void StringExpression::set | ( | const Variable & | var, |
| const std::string & | value | ||
| ) |
Set the value of a variable.
Definition at line 357 of file Expression.cpp.
Here is the caller graph for this function:| void osgEarth::Symbology::StringExpression::setURIContext | ( | const URIContext & | uriContext | ) | [inline] |
Definition at line 124 of file Expression.
{ _uriContext = uriContext; }
| const URIContext& osgEarth::Symbology::StringExpression::uriContext | ( | ) | const [inline] |
Definition at line 125 of file Expression.
{ return _uriContext; }
Here is the caller graph for this function:| const Variables& osgEarth::Symbology::StringExpression::variables | ( | ) | const [inline] |
Access the expression variables.
Definition at line 110 of file Expression.
{ return _vars; }
Here is the caller graph for this function:bool osgEarth::Symbology::StringExpression::_dirty [private] |
Definition at line 140 of file Expression.
Definition at line 137 of file Expression.
std::string osgEarth::Symbology::StringExpression::_src [private] |
Definition at line 136 of file Expression.
Definition at line 141 of file Expression.
std::string osgEarth::Symbology::StringExpression::_value [private] |
Definition at line 139 of file Expression.
Definition at line 138 of file Expression.
1.7.3