|
osgEarth 2.1.1
|
Collaboration diagram for osgEarth::Config:Public Types | |
| typedef std::map< std::string, osg::ref_ptr< osg::Referenced > > | RefMap |
Public Member Functions | |
| Config () | |
| Config (const std::string &key) | |
| Config (const std::string &key, const std::string &value) | |
| Config (const Config &rhs) | |
| void | setURIContext (const URIContext &value) |
| const URIContext & | uriContext () const |
| bool | loadXML (std::istream &in) |
| bool | empty () const |
| std::string & | key () |
| const std::string & | key () const |
| const std::string & | value () const |
| std::string & | value () |
| Properties & | attrs () |
| const Properties & | attrs () const |
| std::string | attr (const std::string &name) const |
| std::string & | attr (const std::string &name) |
| const ConfigSet & | children () const |
| const ConfigSet | children (const std::string &key) const |
| bool | hasChild (const std::string &key) const |
| void | remove (const std::string &key) |
| const Config & | child (const std::string &key) const |
| void | merge (const Config &rhs) |
| template<typename T > | |
| void | addIfSet (const std::string &key, const optional< T > &opt) |
| template<typename T > | |
| void | addObjIfSet (const std::string &key, const osg::ref_ptr< T > &opt) |
| template<typename T > | |
| void | addObjIfSet (const std::string &key, const optional< T > &obj) |
| template<typename X , typename Y > | |
| void | addIfSet (const std::string &key, const std::string &val, const optional< X > &target, const Y &targetValue) |
| void | addChild (const std::string &key, const std::string &value) |
| void | add (const std::string &key, const std::string &value) |
| void | addChild (const Config &conf) |
| void | add (const Config &conf) |
| void | add (const std::string &key, const Config &conf) |
| void | add (const ConfigSet &set) |
| template<typename T > | |
| void | updateIfSet (const std::string &key, const optional< T > &opt) |
| template<typename T > | |
| void | updateObjIfSet (const std::string &key, const osg::ref_ptr< T > &opt) |
| template<typename T > | |
| void | updateObjIfSet (const std::string &key, const optional< T > &obj) |
| template<typename X , typename Y > | |
| void | updateIfSet (const std::string &key, const std::string &val, const optional< X > &target, const Y &targetValue) |
| void | updateChild (const std::string &key, const std::string &value) |
| void | update (const std::string &key, const std::string &value) |
| void | updateChild (const Config &conf) |
| void | update (const Config &conf) |
| void | update (const std::string &key, const Config &conf) |
| bool | hasValue (const std::string &key) const |
| const std::string | value (const std::string &key) const |
| template<typename T > | |
| T | value (const std::string &key, T fallback) const |
| bool | boolValue (bool fallback) const |
| template<typename T > | |
| bool | getIfSet (const std::string &key, optional< T > &output) const |
| template<typename T > | |
| bool | getObjIfSet (const std::string &key, optional< T > &output) const |
| template<typename T > | |
| bool | getObjIfSet (const std::string &key, osg::ref_ptr< T > &output) const |
| template<typename X , typename Y > | |
| bool | getIfSet (const std::string &key, const std::string &val, optional< X > &target, const Y &targetValue) const |
| std::string | toString (int indent=0) const |
| std::string | toHashString () const |
| void | addNonSerializable (const std::string &key, osg::Referenced *obj) |
| void | updateNonSerializable (const std::string &key, osg::Referenced *obj) |
| template<typename X > | |
| X * | getNonSerializable (const std::string &key) const |
| template<> | |
| void | addIfSet (const std::string &key, const optional< Config > &opt) |
| template<> | |
| void | updateIfSet (const std::string &key, const optional< Config > &opt) |
| template<> | |
| bool | getIfSet (const std::string &key, optional< Config > &output) const |
| template<> | |
| void | addIfSet (const std::string &key, const optional< URI > &opt) |
| template<> | |
| void | updateIfSet (const std::string &key, const optional< URI > &opt) |
| template<> | |
| bool | getIfSet (const std::string &key, optional< URI > &output) const |
Protected Attributes | |
| std::string | _key |
| std::string | _defaultValue |
| Properties | _attrs |
| ConfigSet | _children |
| URIContext | _uriContext |
| RefMap | _refMap |
Config is a general-purpose container for serializable data. You store an object's members to Config, and then translate the Config to a particular format (like XML or JSON). Likewise, the object can de-serialize a Config back into member data. Config support the optional<> template for optional values.
| typedef std::map<std::string, osg::ref_ptr<osg::Referenced> > osgEarth::Config::RefMap |
| osgEarth::Config::Config | ( | const std::string & | key | ) | [inline] |
| osgEarth::Config::Config | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [inline] |
| osgEarth::Config::Config | ( | const Config & | rhs | ) | [inline] |
Definition at line 62 of file Config.
: _key(rhs._key), _defaultValue(rhs._defaultValue), _attrs(rhs._attrs), _children(rhs._children), _refMap(rhs._refMap), _uriContext(rhs._uriContext) { }
| void osgEarth::Config::add | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [inline] |
| void osgEarth::Config::add | ( | const Config & | conf | ) | [inline] |
Definition at line 167 of file Config.
{
_children.push_back( conf );
_children.back().setURIContext( _uriContext );
}
| void osgEarth::Config::add | ( | const std::string & | key, |
| const Config & | conf | ||
| ) | [inline] |
| void osgEarth::Config::add | ( | const ConfigSet & | set | ) | [inline] |
| void osgEarth::Config::addChild | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [inline] |
| void osgEarth::Config::addChild | ( | const Config & | conf | ) | [inline] |
| void osgEarth::Config::addIfSet | ( | const std::string & | key, |
| const optional< T > & | opt | ||
| ) | [inline] |
| void osgEarth::Config::addIfSet | ( | const std::string & | key, |
| const std::string & | val, | ||
| const optional< X > & | target, | ||
| const Y & | targetValue | ||
| ) | [inline] |
| void osgEarth::Config::addNonSerializable | ( | const std::string & | key, |
| osg::Referenced * | obj | ||
| ) | [inline] |
| void osgEarth::Config::addObjIfSet | ( | const std::string & | key, |
| const osg::ref_ptr< T > & | opt | ||
| ) | [inline] |
| void osgEarth::Config::addObjIfSet | ( | const std::string & | key, |
| const optional< T > & | obj | ||
| ) | [inline] |
| std::string osgEarth::Config::attr | ( | const std::string & | name | ) | const [inline] |
| std::string& osgEarth::Config::attr | ( | const std::string & | name | ) | [inline] |
| Properties& osgEarth::Config::attrs | ( | ) | [inline] |
| const Properties& osgEarth::Config::attrs | ( | ) | const [inline] |
| bool osgEarth::Config::boolValue | ( | bool | fallback | ) | const [inline] |
Definition at line 267 of file Config.
{
return osgEarth::as<bool>( _defaultValue, fallback );
}
Here is the call graph for this function:
Here is the caller graph for this function:| const Config & Config::child | ( | const std::string & | key | ) | const |
Definition at line 54 of file Config.cpp.
{
for( ConfigSet::const_iterator i = _children.begin(); i != _children.end(); i++ ) {
if ( i->key() == childName )
return *i;
}
return emptyConfig();
}
Here is the call graph for this function:
Here is the caller graph for this function:| const ConfigSet& osgEarth::Config::children | ( | ) | const [inline] |
| const ConfigSet osgEarth::Config::children | ( | const std::string & | key | ) | const [inline] |
| bool osgEarth::Config::empty | ( | ) | const [inline] |
Definition at line 70 of file Config.
{
return _key.empty() && _defaultValue.empty() && _children.empty();
}
Here is the caller graph for this function:| bool osgEarth::Config::getIfSet | ( | const std::string & | key, |
| optional< T > & | output | ||
| ) | const [inline] |
| bool osgEarth::Config::getIfSet | ( | const std::string & | key, |
| const std::string & | val, | ||
| optional< X > & | target, | ||
| const Y & | targetValue | ||
| ) | const [inline] |
| X* osgEarth::Config::getNonSerializable | ( | const std::string & | key | ) | const [inline] |
| bool osgEarth::Config::getObjIfSet | ( | const std::string & | key, |
| osg::ref_ptr< T > & | output | ||
| ) | const [inline] |
| bool osgEarth::Config::getObjIfSet | ( | const std::string & | key, |
| optional< T > & | output | ||
| ) | const [inline] |
| bool osgEarth::Config::hasChild | ( | const std::string & | key | ) | const [inline] |
| bool osgEarth::Config::hasValue | ( | const std::string & | key | ) | const [inline] |
| std::string& osgEarth::Config::key | ( | ) | [inline] |
| const std::string& osgEarth::Config::key | ( | ) | const [inline] |
| bool Config::loadXML | ( | std::istream & | in | ) |
Definition at line 45 of file Config.cpp.
{
osg::ref_ptr<XmlDocument> xml = XmlDocument::load( in );
if ( xml.valid() )
*this = xml->getConfig();
return xml.valid();
}
Here is the call graph for this function:
Here is the caller graph for this function:| void Config::merge | ( | const Config & | rhs | ) |
Definition at line 64 of file Config.cpp.
{
for( Properties::const_iterator a = rhs._attrs.begin(); a != rhs._attrs.end(); ++a )
_attrs[ a->first ] = a->second;
for( ConfigSet::const_iterator c = rhs._children.begin(); c != rhs._children.end(); ++c )
addChild( *c );
}
Here is the call graph for this function:
Here is the caller graph for this function:| void osgEarth::Config::remove | ( | const std::string & | key | ) | [inline] |
| void Config::setURIContext | ( | const URIContext & | value | ) |
Context for resolving relative URIs that occur in this Config
Definition at line 33 of file Config.cpp.
{
_uriContext = context;
for( ConfigSet::iterator i = _children.begin(); i != _children.end(); i++ )
{
i->setURIContext( context.add(i->_uriContext) );
//URI newURI( i->uriContext(), context );
//i->setURIContext( *newURI );
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| std::string Config::toHashString | ( | ) | const |
Definition at line 102 of file Config.cpp.
{
std::stringstream buf;
buf << std::fixed;
buf << "{" << (_key.empty()? "anonymous" : _key) << ":";
if ( !_defaultValue.empty() ) buf << _defaultValue;
if ( !_attrs.empty() ) {
buf << "[";
for( Properties::const_iterator a = _attrs.begin(); a != _attrs.end(); a++ )
buf << a->first << "=" << a->second << ",";
buf << "]";
}
if ( !_children.empty() ) {
for( ConfigSet::const_iterator c = _children.begin(); c != _children.end(); c++ )
buf << (*c).toHashString();
}
buf << "}";
std::string bufStr;
bufStr = buf.str();
return bufStr;
}
Here is the caller graph for this function:| std::string Config::toString | ( | int | indent = 0 | ) | const |
Definition at line 74 of file Config.cpp.
{
std::stringstream buf;
buf << std::fixed;
for( int i=0; i<indent; i++ ) buf << " ";
buf << "{ " << (_key.empty()? "anonymous" : _key) << ": ";
if ( !_defaultValue.empty() ) buf << _defaultValue;
if ( !_attrs.empty() ) {
buf << std::endl;
for( int i=0; i<indent+1; i++ ) buf << " ";
buf << "attrs: [ ";
for( Properties::const_iterator a = _attrs.begin(); a != _attrs.end(); a++ )
buf << a->first << "=" << a->second << ", ";
buf << " ]";
}
if ( !_children.empty() ) {
for( ConfigSet::const_iterator c = _children.begin(); c != _children.end(); c++ )
buf << std::endl << (*c).toString( indent+1 );
}
buf << " }";
std::string bufStr;
bufStr = buf.str();
return bufStr;
}
Here is the caller graph for this function:| void osgEarth::Config::update | ( | const Config & | conf | ) | [inline] |
| void osgEarth::Config::update | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [inline] |
| void osgEarth::Config::update | ( | const std::string & | key, |
| const Config & | conf | ||
| ) | [inline] |
| void osgEarth::Config::updateChild | ( | const std::string & | key, |
| const std::string & | value | ||
| ) | [inline] |
| void osgEarth::Config::updateChild | ( | const Config & | conf | ) | [inline] |
| void osgEarth::Config::updateIfSet | ( | const std::string & | key, |
| const std::string & | val, | ||
| const optional< X > & | target, | ||
| const Y & | targetValue | ||
| ) | [inline] |
| void osgEarth::Config::updateIfSet | ( | const std::string & | key, |
| const optional< T > & | opt | ||
| ) | [inline] |
| void osgEarth::Config::updateNonSerializable | ( | const std::string & | key, |
| osg::Referenced * | obj | ||
| ) | [inline] |
| void osgEarth::Config::updateObjIfSet | ( | const std::string & | key, |
| const osg::ref_ptr< T > & | opt | ||
| ) | [inline] |
| void osgEarth::Config::updateObjIfSet | ( | const std::string & | key, |
| const optional< T > & | obj | ||
| ) | [inline] |
| const URIContext& osgEarth::Config::uriContext | ( | ) | const [inline] |
Definition at line 66 of file Config.
{ return _uriContext; }
Here is the caller graph for this function:| T osgEarth::Config::value | ( | const std::string & | key, |
| T | fallback | ||
| ) | const [inline] |
| std::string& osgEarth::Config::value | ( | ) | [inline] |
Definition at line 78 of file Config.
{ return _defaultValue; }
| const std::string osgEarth::Config::value | ( | const std::string & | key | ) | const [inline] |
| const std::string& osgEarth::Config::value | ( | ) | const [inline] |
Definition at line 77 of file Config.
{ return _defaultValue; }
Here is the caller graph for this function:Properties osgEarth::Config::_attrs [protected] |
ConfigSet osgEarth::Config::_children [protected] |
std::string osgEarth::Config::_defaultValue [protected] |
std::string osgEarth::Config::_key [protected] |
RefMap osgEarth::Config::_refMap [protected] |
URIContext osgEarth::Config::_uriContext [protected] |
1.7.3