|
osgEarth 2.1.1
|
Inheritance diagram for osgEarth::XmlElement:
Collaboration diagram for osgEarth::XmlElement:Public Member Functions | |
| XmlElement (const std::string &name) | |
| XmlElement (const std::string &name, const XmlAttributes &attrs) | |
| XmlElement (const Config &conf) | |
| virtual | ~XmlElement () |
| const std::string & | getName () const |
| void | setName (const std::string &name) |
| XmlAttributes & | getAttrs () |
| const XmlAttributes & | getAttrs () const |
| const std::string & | getAttr (const std::string &key) const |
| XmlNodeList & | getChildren () |
| const XmlNodeList & | getChildren () const |
| XmlElement * | getSubElement (const std::string &name) const |
| XmlNodeList | getSubElements (const std::string &name) const |
| std::string | getText () const |
| std::string | getSubElementText (const std::string &tag) const |
| void | addSubElement (const std::string &tag, const std::string &text) |
| void | addSubElement (const std::string &tag, const Properties &attrs, const std::string &text) |
| virtual Config | getConfig () const |
| virtual bool | isElement () const |
| virtual bool | isText () const |
Private Attributes | |
| std::string | name |
| XmlAttributes | attrs |
| XmlNodeList | children |
| XmlElement::XmlElement | ( | const std::string & | name | ) |
Definition at line 58 of file XmlUtils.cpp.
{
name = _name;
}
Here is the caller graph for this function:| XmlElement::XmlElement | ( | const std::string & | name, |
| const XmlAttributes & | attrs | ||
| ) |
Definition at line 63 of file XmlUtils.cpp.
| XmlElement::XmlElement | ( | const Config & | conf | ) |
Definition at line 69 of file XmlUtils.cpp.
{
name = conf.key();
for( Properties::const_iterator i = conf.attrs().begin(); i != conf.attrs().end(); i++ )
attrs[i->first] = i->second;
for( ConfigSet::const_iterator j = conf.children().begin(); j != conf.children().end(); j++ )
{
if (!j->children().empty())
{
children.push_back( new XmlElement( *j ) );
}
else
{
addSubElement(j->key(), j->attrs(), j->value());
}
}
}
Here is the call graph for this function:| virtual osgEarth::XmlElement::~XmlElement | ( | ) | [inline, virtual] |
| void XmlElement::addSubElement | ( | const std::string & | tag, |
| const std::string & | text | ||
| ) |
Definition at line 203 of file XmlUtils.cpp.
{
XmlElement* ele = new XmlElement(tag);
ele->getChildren().push_back(new XmlText(text));
children.push_back(ele);
}
Here is the call graph for this function:
Here is the caller graph for this function:| void XmlElement::addSubElement | ( | const std::string & | tag, |
| const Properties & | attrs, | ||
| const std::string & | text | ||
| ) |
Definition at line 211 of file XmlUtils.cpp.
{
XmlElement* ele = new XmlElement(tag);
for( Properties::const_iterator i = attrs.begin(); i != attrs.end(); i++ )
ele->attrs[i->first] = i->second;
ele->getChildren().push_back(new XmlText(text));
children.push_back(ele);
}
Here is the call graph for this function:| const std::string & XmlElement::getAttr | ( | const std::string & | key | ) | const |
Definition at line 112 of file XmlUtils.cpp.
{
XmlAttributes::const_iterator i = attrs.find( key );
return i != attrs.end()? i->second : EMPTY_VALUE;
}
Here is the caller graph for this function:| XmlAttributes & XmlElement::getAttrs | ( | ) |
Definition at line 100 of file XmlUtils.cpp.
{
return attrs;
}
Here is the caller graph for this function:| const XmlAttributes & XmlElement::getAttrs | ( | ) | const |
Definition at line 106 of file XmlUtils.cpp.
{
return attrs;
}
| XmlNodeList & XmlElement::getChildren | ( | ) |
Definition at line 119 of file XmlUtils.cpp.
{
return children;
}
Here is the caller graph for this function:| const XmlNodeList & XmlElement::getChildren | ( | ) | const |
Definition at line 125 of file XmlUtils.cpp.
{
return children;
}
| Config XmlElement::getConfig | ( | ) | const [virtual] |
Reimplemented in osgEarth::XmlDocument.
Definition at line 221 of file XmlUtils.cpp.
{
Config conf( name );
for( XmlAttributes::const_iterator a = attrs.begin(); a != attrs.end(); a++ )
conf.attr( a->first ) = a->second;
for( XmlNodeList::const_iterator c = children.begin(); c != children.end(); c++ )
{
XmlNode* n = c->get();
if ( n->isElement() )
conf.add( static_cast<const XmlElement*>(n)->getConfig() );
}
conf.value() = getText();
//else
// conf.value() = trim( static_cast<const XmlText*>(n)->getValue() );
return conf;
}
Here is the call graph for this function:| const std::string & XmlElement::getName | ( | ) | const |
Reimplemented in osgEarth::XmlDocument.
Definition at line 88 of file XmlUtils.cpp.
{
return name;
}
Here is the caller graph for this function:| XmlElement * XmlElement::getSubElement | ( | const std::string & | name | ) | const |
Definition at line 131 of file XmlUtils.cpp.
{
std::string name_lower = name;
std::transform( name_lower.begin(), name_lower.end(), name_lower.begin(), tolower );
for( XmlNodeList::const_iterator i = getChildren().begin(); i != getChildren().end(); i++ )
{
if ( i->get()->isElement() )
{
XmlElement* e = (XmlElement*)i->get();
std::string name = e->getName();
std::transform( name.begin(), name.end(), name.begin(), tolower );
if ( name == name_lower )
return e;
}
}
return NULL;
}
Here is the call graph for this function:
Here is the caller graph for this function:| XmlNodeList XmlElement::getSubElements | ( | const std::string & | name | ) | const |
Definition at line 180 of file XmlUtils.cpp.
{
XmlNodeList results;
std::string name_lower = name;
std::transform( name_lower.begin(), name_lower.end(), name_lower.begin(), tolower );
for( XmlNodeList::const_iterator i = getChildren().begin(); i != getChildren().end(); i++ )
{
if ( i->get()->isElement() )
{
XmlElement* e = (XmlElement*)i->get();
std::string name = e->getName();
std::transform( name.begin(), name.end(), name.begin(), tolower );
if ( name == name_lower )
results.push_back( e );
}
}
return results;
}
Here is the call graph for this function:
Here is the caller graph for this function:| std::string XmlElement::getSubElementText | ( | const std::string & | tag | ) | const |
Definition at line 172 of file XmlUtils.cpp.
{
XmlElement* e = getSubElement( name );
return e? e->getText() : EMPTY_VALUE;
}
Here is the call graph for this function:
Here is the caller graph for this function:| std::string XmlElement::getText | ( | ) | const |
Definition at line 152 of file XmlUtils.cpp.
{
std::stringstream builder;
for( XmlNodeList::const_iterator i = getChildren().begin(); i != getChildren().end(); i++ )
{
if ( i->get()->isText() )
{
builder << ( static_cast<XmlText*>( i->get() ) )->getValue();
}
}
std::string builderStr;
builderStr = builder.str();
std::string result = trim( builderStr );
return result;
}
Here is the call graph for this function:
Here is the caller graph for this function:| virtual bool osgEarth::XmlElement::isElement | ( | ) | const [inline, virtual] |
| virtual bool osgEarth::XmlElement::isText | ( | ) | const [inline, virtual] |
| void XmlElement::setName | ( | const std::string & | name | ) |
Definition at line 94 of file XmlUtils.cpp.
XmlAttributes osgEarth::XmlElement::attrs [private] |
XmlNodeList osgEarth::XmlElement::children [private] |
std::string osgEarth::XmlElement::name [private] |
1.7.3