mail[Wesnoth-commits] r33309 - in /trunk/src/serialization: preprocessor.cpp preprocessor.hpp


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

Header


Content

Posted by guillaume . melquiond on March 03, 2009 - 18:44:
Author: silene
Date: Tue Mar  3 18:44:06 2009
New Revision: 33309

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33309&view=rev
Log:
Cleaned header includes, loops, and constructors.

Modified:
    trunk/src/serialization/preprocessor.cpp
    trunk/src/serialization/preprocessor.hpp

Modified: trunk/src/serialization/preprocessor.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/preprocessor.cpp?rev=33309&r1=33308&r2=33309&view=diff
==============================================================================
--- trunk/src/serialization/preprocessor.cpp (original)
+++ trunk/src/serialization/preprocessor.cpp Tue Mar  3 18:44:06 2009
@@ -18,16 +18,14 @@
  * WML preprocessor.
  */
 
-#include "../global.hpp"
-
-#include "../config.hpp"
-#include "../filesystem.hpp"
-#include "../log.hpp"
-#include "../wesconfig.h"
-#include "binary_or_text.hpp"
-
-
-#include <boost/bind.hpp>
+#include "global.hpp"
+
+#include "config.hpp"
+#include "filesystem.hpp"
+#include "foreach.hpp"
+#include "log.hpp"
+#include "wesconfig.h"
+#include "serialization/binary_or_text.hpp"
 
 #define ERR_CF LOG_STREAM(err, config)
 #define LOG_CF LOG_STREAM(info, config)
@@ -70,18 +68,15 @@
        writer.write_key_val("linenum", lexical_cast<std::string>(linenum));
        writer.write_key_val("location", location);
 
-       std::for_each(arguments.begin(), arguments.end(),
-                       boost::bind(&preproc_define::write_argument,
-                               this,
-                               boost::ref(writer),
-                               _1));
+       foreach (const std::string &arg, arguments)
+               write_argument(writer, arg);
 
        writer.close_child(key);
 }
 
-void preproc_define::read_argument(const config* cfg)
-{
-       arguments.push_back((*cfg)["name"]);
+void preproc_define::read_argument(const config &cfg)
+{
+       arguments.push_back(cfg["name"]);
 }
 
 void preproc_define::read(const config& cfg)
@@ -91,14 +86,8 @@
        linenum = lexical_cast<int>(cfg["linenum"]);
        location = cfg["location"];
 
-       const config::child_list args= cfg.get_children("argument");
-       typedef std::vector< std::string > arg_vec;
-       std::for_each(args.begin(), args.end(),
-                       boost::bind(&preproc_define::read_argument,
-                               this,
-                               _1
-                               )
-                       );
+       foreach (const config *arg, cfg.get_children("argument"))
+               read_argument(*arg);
 }
 
 preproc_map::value_type preproc_define::read_pair(const config* cfg)

Modified: trunk/src/serialization/preprocessor.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/serialization/preprocessor.hpp?rev=33309&r1=33308&r2=33309&view=diff
==============================================================================
--- trunk/src/serialization/preprocessor.hpp (original)
+++ trunk/src/serialization/preprocessor.hpp Tue Mar  3 18:44:06 2009
@@ -33,8 +33,8 @@
 
 struct preproc_define
 {
-       preproc_define() : value(""), arguments(), textdomain(""), 
linenum(0), location("") {}
-       explicit preproc_define(std::string const &val) : value(val), 
arguments(), textdomain(""), linenum(0), location("") {}
+       preproc_define() : value(), arguments(), textdomain(), linenum(0), 
location() {}
+       explicit preproc_define(std::string const &val) : value(val), 
arguments(), textdomain(), linenum(0), location() {}
        preproc_define(std::string const &val, std::vector< std::string > 
const &args,
                       std::string const &domain, int line, std::string const 
&loc)
                : value(val), arguments(args), textdomain(domain), 
linenum(line), location(loc) {}
@@ -46,7 +46,7 @@
        void write(config_writer&, const std::string&) const;
        void write_argument(config_writer&, const std::string&) const;
        void read(const config&);
-       void read_argument(const config*);
+       void read_argument(const config &);
        static preproc_map::value_type read_pair(const config*);
        bool operator==(preproc_define const &) const;
        bool operator<(preproc_define const &) const;




Related Messages


Powered by MHonArc, Updated Tue Mar 03 19:00:07 2009