本文整理汇总了C++中xmlnodelist::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: storeNode
void
XmlDocument::store( std::ostream& out ) const
{
out << "<?xml version=\"1.0\"?>" << std::endl;
for( XmlNodeList::const_iterator i = getChildren().begin(); i != getChildren().end(); i++ )
{
storeNode( i->get(), 0, out );
}
}
示例2: trim
WMSCapabilities*
WMSCapabilitiesReader::read(std::istream &in)
{
osg::ref_ptr<WMSCapabilities> capabilities = new WMSCapabilities;
osg::ref_ptr<XmlDocument> doc = XmlDocument::load( in );
if (!doc.valid() || doc->getChildren().empty())
{
OE_NOTICE << "Failed to load Capabilities " << std::endl;
return 0;
}
//Get the Capabilities version
osg::ref_ptr<XmlElement> e_root = static_cast<XmlElement*>(doc->getChildren()[0].get());
capabilities->setVersion( e_root->getAttr(ATTR_VERSION ) );
osg::ref_ptr<XmlElement> e_capability = e_root->getSubElement( ELEM_CAPABILITY );
if (!e_capability.valid())
{
OE_NOTICE << "Could not find Capability element" << std::endl;
return 0;
}
//Get the supported formats
osg::ref_ptr<XmlElement> e_request = e_capability->getSubElement( ELEM_REQUEST );
if (e_request.valid())
{
osg::ref_ptr<XmlElement> e_getMap = e_request->getSubElement( ELEM_GETMAP );
if ( e_getMap.valid() )
{
//Read all the formats
XmlNodeList formats = e_getMap->getSubElements( ELEM_FORMAT );
for( XmlNodeList::const_iterator i = formats.begin(); i != formats.end(); i++ )
{
string format = trim(static_cast<XmlElement*>( i->get() )->getText());
capabilities->getFormats().push_back(format);
}
}
}
//Try to read the layers
readLayers( e_capability.get(), 0, capabilities->getLayers());
return capabilities.release();
}
示例3: trim
std::string
XmlElement::getText() const
{
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;
}
示例4: conf
Config
XmlElement::getConfig() const
{
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;
}
示例5:
XmlElement*
XmlElement::getSubElement( const std::string& name ) const
{
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;
}
示例6: removeElementNamespace
WFSCapabilities*
WFSCapabilitiesReader::read(std::istream &in)
{
osg::ref_ptr<WFSCapabilities> capabilities = new WFSCapabilities;
osg::ref_ptr<XmlDocument> doc = XmlDocument::load( in );
if (!doc.valid() || doc->getChildren().empty())
{
OE_NOTICE << "Failed to load Capabilities " << std::endl;
return 0;
}
//Get the Capabilities version
osg::ref_ptr<XmlElement> e_root = static_cast<XmlElement*>(doc->getChildren()[0].get());
capabilities->setVersion( e_root->getAttr(ATTR_VERSION ) );
removeElementNamespace(e_root);
osg::ref_ptr<XmlElement> e_service = e_root->getSubElement( ELEM_SERVICE );
if (!e_service.valid())
{
OE_NOTICE << "Could not find Service element" << std::endl;
return 0;
}
//Read the parameters from the Service block
capabilities->setName( e_service->getSubElementText(ELEM_NAME ) );
capabilities->setAbstract( e_service->getSubElementText( ELEM_ABSTRACT ) );
capabilities->setTitle( e_service->getSubElementText( ELEM_TITLE ) );
//Read all the feature types
osg::ref_ptr<XmlElement> e_feature_types = e_root->getSubElement( ELEM_FEATURETYPELIST );
if (e_feature_types.valid())
{
XmlNodeList featureTypes = e_feature_types->getSubElements( ELEM_FEATURETYPE );
for( XmlNodeList::const_iterator itr = featureTypes.begin(); itr != featureTypes.end(); itr++ )
{
XmlElement* e_featureType = static_cast<XmlElement*>( itr->get() );
WFSFeatureType* featureType = new WFSFeatureType();
featureType->setName( e_featureType->getSubElementText( ELEM_NAME ) );
featureType->setTitle( e_featureType->getSubElementText( ELEM_TITLE ) );
featureType->setAbstract( e_featureType->getSubElementText( ELEM_ABSTRACT ) );
//NOTE: TILED and MAXLEVEL aren't part of the WFS spec, these are enhancements to our server for tiled WFS access
std::string tiledStr = e_featureType->getSubElementText(ELEM_TILED);
featureType->setTiled( as<bool>(tiledStr, false) );
std::string maxLevelStr = e_featureType->getSubElementText(ELEM_MAXLEVEL);
featureType->setMaxLevel( as<int>(maxLevelStr, -1));
std::string firstLevelStr = e_featureType->getSubElementText(ELEM_FIRSTLEVEL);
featureType->setFirstLevel( as<int>(firstLevelStr, 0));
// Read the SRS
std::string srsText = e_featureType->getSubElementText(ELEM_SRS);
if (srsText.compare("") != 0)
{
featureType->setSRS( srsText );
}
osg::ref_ptr<XmlElement> e_bb = e_featureType->getSubElement( ELEM_LATLONGBOUNDINGBOX );
if (e_bb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_bb->getAttr( ATTR_MINX ), 0);
minY = as<double>(e_bb->getAttr( ATTR_MINY ), 0);
maxX = as<double>(e_bb->getAttr( ATTR_MAXX ), 0);
maxY = as<double>(e_bb->getAttr( ATTR_MAXY ), 0);
featureType->setExtent( GeoExtent( osgEarth::SpatialReference::create( srsText ), minX, minY, maxX, maxY) );
}
capabilities->getFeatureTypes().push_back( featureType );
}
}
return capabilities.release();
}
示例7: readLayers
static void
readLayers(XmlElement* e, WMSLayer* parentLayer, WMSLayer::LayerList& layers)
{
XmlNodeList layerNodes = e->getSubElements( ELEM_LAYER );
for( XmlNodeList::const_iterator i = layerNodes.begin(); i != layerNodes.end(); i++ )
{
XmlElement* e_layer = static_cast<XmlElement*>( i->get() );
WMSLayer *layer = new WMSLayer;
layer->setName( e_layer->getSubElementText( ELEM_NAME ) );
layer->setTitle( e_layer->getSubElementText( ELEM_TITLE ) );
layer->setAbstract( e_layer->getSubElementText( ELEM_ABSTRACT ) );
//Read all the supported styles
XmlNodeList styles = e_layer->getSubElements( ELEM_STYLE );
for( XmlNodeList::const_iterator styleitr = styles.begin(); styleitr != styles.end(); styleitr++ )
{
XmlElement* e_style = static_cast<XmlElement*>( styleitr->get() );
string name = e_style->getSubElementText( ELEM_NAME );
string title = e_style->getSubElementText( ELEM_TITLE );
layer->getStyles().push_back(WMSStyle(name,title));
}
//Read all the supported SRS's
XmlNodeList spatialReferences = e_layer->getSubElements( ELEM_SRS );
for (XmlNodeList::const_iterator srsitr = spatialReferences.begin(); srsitr != spatialReferences.end(); ++srsitr)
{
string srs = static_cast<XmlElement*>( srsitr->get() )->getText();
layer->getSpatialReferences().push_back(srs);
}
//Read all the supported CRS's
spatialReferences = e_layer->getSubElements( ELEM_CRS );
for (XmlNodeList::const_iterator srsitr = spatialReferences.begin(); srsitr != spatialReferences.end(); ++srsitr)
{
string crs = static_cast<XmlElement*>( srsitr->get() )->getText();
layer->getSpatialReferences().push_back(crs);
}
osg::ref_ptr<XmlElement> e_bb = e_layer->getSubElement( ELEM_LATLONBOUNDINGBOX );
if (e_bb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_bb->getAttr( ATTR_MINX ), 0);
minY = as<double>(e_bb->getAttr( ATTR_MINY ), 0);
maxX = as<double>(e_bb->getAttr( ATTR_MAXX ), 0);
maxY = as<double>(e_bb->getAttr( ATTR_MAXY ), 0);
layer->setLatLonExtents(minX, minY, maxX, maxY);
}
else {
osg::ref_ptr<XmlElement> e_gbb = e_layer->getSubElement( ELEM_GEOGRAPHICBOUNDINGBOX );
if (e_gbb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_gbb->getSubElementText( ATTR_WESTLON ), 0);
minY = as<double>(e_gbb->getSubElementText( ATTR_SOUTHLAT ), 0);
maxX = as<double>(e_gbb->getSubElementText( ATTR_EASTLON ), 0);
maxY = as<double>(e_gbb->getSubElementText( ATTR_NORTHLAT ), 0);
layer->setLatLonExtents(minX, minY, maxX, maxY);
}
}
e_bb = e_layer->getSubElement( ELEM_BOUNDINGBOX );
if (e_bb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_bb->getAttr( ATTR_MINX ), 0);
minY = as<double>(e_bb->getAttr( ATTR_MINY ), 0);
maxX = as<double>(e_bb->getAttr( ATTR_MAXX ), 0);
maxY = as<double>(e_bb->getAttr( ATTR_MAXY ), 0);
layer->setExtents(minX, minY, maxX, maxY);
}
//Add the layer to the list and set its parent layer
layers.push_back(layer);
layer->setParentLayer( parentLayer );
//Read any other layers that are in the layer node
readLayers( e_layer, layer, layer->getLayers());
}
}