range based for loops for better readability

This commit is contained in:
artemp 2014-07-08 16:39:22 +01:00
parent 888ae11309
commit 65ee7ea005
2 changed files with 12 additions and 18 deletions

View file

@ -271,20 +271,18 @@ public:
{
std::stringstream ss;
ss << "Feature ( id=" << id_ << std::endl;
context_type::map_type::const_iterator itr = ctx_->mapping_.begin();
context_type::map_type::const_iterator end = ctx_->mapping_.end();
for ( ;itr!=end; ++itr)
for (auto const& kv : ctx_->mapping_)
{
std::size_t index = itr->second;
std::size_t index = kv.second;
if (index < data_.size())
{
if (data_[itr->second] == mapnik::value_null())
if (data_[kv.second] == mapnik::value_null())
{
ss << " " << itr->first << ":null" << std::endl;
ss << " " << kv.first << ":null" << std::endl;
}
else
{
ss << " " << itr->first << ":" << data_[itr->second] << std::endl;
ss << " " << kv.first << ":" << data_[kv.second] << std::endl;
}
}
}

View file

@ -5,8 +5,8 @@
namespace mapnik
{
/* Debug dump ptree XML representation.
*/
// Debug dump ptree XML representation.
void dump_xml(xml_node const& xml, unsigned level=0)
{
std::string indent;
@ -15,21 +15,17 @@ void dump_xml(xml_node const& xml, unsigned level=0)
{
indent += " ";
}
xml_node::attribute_map const& attr = xml.get_attributes();
xml_node::attribute_map const& attr_map = xml.get_attributes();
std::cerr << indent <<"[" << xml.name();
xml_node::attribute_map::const_iterator aitr = attr.begin();
xml_node::attribute_map::const_iterator aend = attr.end();
for (;aitr!=aend; aitr++)
for (auto const& attr : attr_map)
{
std::cerr << " (" << aitr->first << ", " << aitr->second.value << ", " << aitr->second.processed << ")";
std::cerr << " (" << attr.first << ", " << attr.second.value << ", " << attr.second.processed << ")";
}
std::cerr << "]" << "\n";
if (xml.is_text()) std::cerr << indent << "text: '" << xml.text() << "'\n";
xml_node::const_iterator itr = xml.begin();
xml_node::const_iterator end = xml.end();
for (; itr!=end; itr++)
for (auto const& child : xml)
{
dump_xml(*itr, level+1);
dump_xml(child, level+1);
}
std::cerr << indent << "[/" << xml.name() << "]" << "\n";
}