mail[Wesnoth-commits] r33991 - /trunk/src/variable.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by guillaume . melquiond on March 21, 2009 - 19:44:
Author: silene
Date: Sat Mar 21 19:44:49 2009
New Revision: 33991

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33991&view=rev
Log:
Moved to loops based on config::all_children_range.

Modified:
    trunk/src/variable.cpp

Modified: trunk/src/variable.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=33991&r1=33990&r2=33991&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Sat Mar 21 19:44:49 2009
@@ -228,12 +228,10 @@
                res[i.first] = expand(i.first);
        }
 
-       for(config::all_children_iterator child = cfg_->ordered_begin();
-               child != cfg_->ordered_end(); ++child)
+       foreach (const config::any_child &child, cfg_->all_children_range())
        {
-               const std::string &child_key = *(*child).first;
-               if(child_key == "insert_tag") {
-                       vconfig insert_cfg(child->second);
+               if (child.key == "insert_tag") {
+                       vconfig insert_cfg(&child.cfg);
                        const t_string& name = insert_cfg["name"];
                        const t_string& vname = insert_cfg["variable"];
                        if(!vconfig_recursion.insert(vname).second) {
@@ -266,7 +264,7 @@
                                }
                        }
                } else {
-                       res.add_child(child_key, 
vconfig((*child).second).get_parsed_config());
+                       res.add_child(child.key, 
vconfig(&child.cfg).get_parsed_config());
                }
        }
        return res;
@@ -276,14 +274,12 @@
 {
        vconfig::child_list res;
 
-       for(config::all_children_iterator child = cfg_->ordered_begin();
-               child != cfg_->ordered_end(); ++child)
+       foreach (const config::any_child &child, cfg_->all_children_range())
        {
-               const std::string &child_key = *(*child).first;
-               if(child_key == key) {
-                       res.push_back(vconfig(child->second, cache_key_));
-               } else if(child_key == "insert_tag") {
-                       vconfig insert_cfg(child->second);
+               if (child.key == key) {
+                       res.push_back(vconfig(&child.cfg, cache_key_));
+               } else if (child.key == "insert_tag") {
+                       vconfig insert_cfg(&child.cfg);
                        if(insert_cfg["name"] == key) {
                                variable_info vinfo(insert_cfg["variable"], 
false, variable_info::TYPE_CONTAINER);
                                if(!vinfo.is_valid) {




Related Messages


Powered by MHonArc, Updated Sat Mar 21 20:00:36 2009