[Wesnoth-cvs-commits] wesnoth/src builder.cpp cavegen.cpp config.cpp ... (February 20, 2005 - 23:26)

 

CVSROOT:	/cvsroot/wesnoth
Module name:	wesnoth
Branch: 	
Changes by:	Guillaume Melquiond <silene@xxxxxxxxxxxxxxxx>	05/02/20 21:45:22

Modified files:
	src            : builder.cpp cavegen.cpp config.cpp config.hpp 
	                 dialogs.cpp font.cpp game.cpp game_events.cpp 
	                 gamestatus.cpp gettext.cpp help.cpp map.cpp 
	                 mapgen.cpp multiplayer_client.cpp 
	                 multiplayer_connect.cpp playturn.cpp 
	                 preferences.cpp race.cpp team.cpp theme.cpp 
	                 unit.cpp unit_types.cpp 
	src/editor     : editor.cpp editor_main.cpp map_manip.cpp 
	src/serialization: string_utils.cpp string_utils.hpp 
	src/server     : server.cpp 
	src/tools      : exploder_cutter.cpp exploder_utils.cpp 
	src/widgets    : button.cpp menu.cpp 

Log message:
	Completely remove string functions from config.cpp.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/builder.cpp.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/cavegen.cpp.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.cpp.diff?tr1=1.127&tr2=1.128&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/config.hpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/dialogs.cpp.diff?tr1=1.80&tr2=1.81&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/font.cpp.diff?tr1=1.98&tr2=1.99&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game.cpp.diff?tr1=1.193&tr2=1.194&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/game_events.cpp.diff?tr1=1.118&tr2=1.119&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gamestatus.cpp.diff?tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/gettext.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/help.cpp.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/map.cpp.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/mapgen.cpp.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_client.cpp.diff?tr1=1.86&tr2=1.87&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/multiplayer_connect.cpp.diff?tr1=1.102&tr2=1.103&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/playturn.cpp.diff?tr1=1.328&tr2=1.329&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.132&tr2=1.133&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/race.cpp.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/team.cpp.diff?tr1=1.78&tr2=1.79&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/theme.cpp.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit.cpp.diff?tr1=1.121&tr2=1.122&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/unit_types.cpp.diff?tr1=1.79&tr2=1.80&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor.cpp.diff?tr1=1.90&tr2=1.91&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/editor_main.cpp.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/editor/map_manip.cpp.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/string_utils.cpp.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/serialization/string_utils.hpp.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/server/server.cpp.diff?tr1=1.64&tr2=1.65&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_cutter.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/tools/exploder_utils.cpp.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/button.cpp.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/widgets/menu.cpp.diff?tr1=1.76&tr2=1.77&r1=text&r2=text

Patches:
Index: wesnoth/src/builder.cpp
diff -u wesnoth/src/builder.cpp:1.40 wesnoth/src/builder.cpp:1.41
--- wesnoth/src/builder.cpp:1.40	Fri Dec 31 21:01:37 2004
+++ wesnoth/src/builder.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: builder.cpp,v 1.40 2004/12/31 21:01:37 isaaccp Exp $ */
+/* $Id: builder.cpp,v 1.41 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <ayin@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -495,7 +495,7 @@
 
 		} else if((**img)["position"] == "vertical") {
 
-			std::vector<std::string> base = config::split((**img)["base"]);
+			std::vector<std::string> base = utils::split((**img)["base"]);
 			int basex = 0, basey = 0;
 
 			if(base.size() >= 2) {
@@ -546,7 +546,7 @@
 void terrain_builder::add_constraint_item(std::vector<std::string> &list, const config& cfg, const std::string &item)
 {
 	if(!cfg[item].empty()) {
-		std::vector<std::string> item_string = config::split(cfg[item]);
+		std::vector<std::string> item_string = utils::split(cfg[item]);
 		
 		for(std::vector<std::string>::const_iterator itor = item_string.begin();
 				itor != item_string.end(); ++itor) {
@@ -575,11 +575,11 @@
 	int lineno = 0;
 	int x = 0;
 
-	const std::vector<std::string> &lines = config::split(mapstring, '\n', 0);
+	const std::vector<std::string> &lines = utils::split(mapstring, '\n', 0);
 	std::vector<std::string>::const_iterator line = lines.begin();
 	
 	//Strips trailing empty lines
-	while(line != lines.end() && std::find_if(line->begin(),line->end(),config::notspace) == line->end()) {
+	while (line != lines.end() && std::find_if(line->begin(), line->end(), utils::notspace) == line->end()) {
 		line++;
 	}
 	//Break if there only are blank lines
@@ -604,7 +604,7 @@
 
 		while(lpos < line->size()) {
 			std::string types = line->substr(lpos, 4);
-			config::strip(types);
+			utils::strip(types);
 			
 			//If there are numbers in the types string, consider it
 			//is an anchor
@@ -641,7 +641,7 @@
 
 		add_rule(rules, tpl);
 	} else {
-		const std::vector<std::string>& rot = config::split(rotations, ',');
+		const std::vector<std::string>& rot = utils::split(rotations, ',');
 			
 		for(size_t angle = 0; angle < rot.size(); angle++) {
 			building_rule rule = rotate_rule(tpl, angle, rot);
@@ -688,7 +688,7 @@
 				loc.y = atoi((**tc)["y"].c_str());
 			} 
 			if(!(**tc)["loc"].empty()) {
-				std::vector<std::string> sloc = config::split((**tc)["pos"]);
+				std::vector<std::string> sloc = utils::split((**tc)["pos"]);
 				if(sloc.size() == 2) {
 					loc.x = atoi(sloc[0].c_str());
 					loc.y = atoi(sloc[1].c_str());
Index: wesnoth/src/cavegen.cpp
diff -u wesnoth/src/cavegen.cpp:1.14 wesnoth/src/cavegen.cpp:1.15
--- wesnoth/src/cavegen.cpp:1.14	Sun Feb  6 10:40:12 2005
+++ wesnoth/src/cavegen.cpp	Sun Feb 20 21:45:21 2005
@@ -137,7 +137,7 @@
 		size_t min_xpos = 0, min_ypos = 0, max_xpos = width_, max_ypos = height_;
 
 		if(xpos != "") {
-			const std::vector<std::string>& items = config::split(xpos,'-');
+			const std::vector<std::string>& items = utils::split(xpos, '-');
 			if(items.empty() == false) {
 				min_xpos = atoi(items.front().c_str()) - 1;
 				max_xpos = atoi(items.back().c_str());
@@ -145,7 +145,7 @@
 		}
 
 		if(ypos != "") {
-			const std::vector<std::string>& items = config::split(ypos,'-');
+			const std::vector<std::string>& items = utils::split(ypos, '-');
 			if(items.empty() == false) {
 				min_ypos = atoi(items.front().c_str()) - 1;
 				max_ypos = atoi(items.back().c_str());
Index: wesnoth/src/config.cpp
diff -u wesnoth/src/config.cpp:1.127 wesnoth/src/config.cpp:1.128
--- wesnoth/src/config.cpp:1.127	Sun Feb 20 19:22:31 2005
+++ wesnoth/src/config.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: config.cpp,v 1.127 2005/02/20 19:22:31 silene Exp $ */
+/* $Id: config.cpp,v 1.128 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -27,10 +27,11 @@
 #include "game_events.hpp"
 #include "gettext.hpp"
 #include "log.hpp"
-#include "serialization/preprocessor.hpp"
 #include "util.hpp"
 #include "wassert.hpp"
 #include "wesconfig.h"
+#include "serialization/preprocessor.hpp"
+#include "serialization/string_utils.hpp"
 
 #define ERR_CF lg::err(lg::config)
 #define WRN_CF lg::warn(lg::config)
@@ -290,7 +291,7 @@
 					//we strip it away, since it simply indicates that this value is translatable.
 					if(value.empty() == false && std::count(value.begin(),value.end(),'_') == 1) {
 						std::string val = value;
-						if(strip(val) == "_") {
+						if (utils::strip(val) == "_") {
 							value = "";
 							translatable = true;
 						}
@@ -319,8 +320,8 @@
 					//see if this is a CSV list=CSV list style assignment (e.g. x,y=5,8)
 					std::vector<std::string> vars, values;
 					if(std::count(var.begin(),var.end(),',') > 0) {
-						vars = config::split(var);
-						values = config::split(value);
+						vars = utils::split(var);
+						values = utils::split(value);
 					} else {
 						vars.push_back(var);
 						values.push_back(value);
@@ -352,7 +353,7 @@
 							}
 
 							if(has_quotes == false) {
-								strip(value);
+								utils::strip(value);
 							}
 
 							if(n < vars.size()) {
@@ -911,213 +912,13 @@
 		return NULL;
 }
 
-std::string config::join(const std::vector<std::string>& v, char c)
-{
-	std::stringstream str;
-	for(std::vector<std::string>::const_iterator i = v.begin(); i != v.end(); ++i) {
-		str << *i;
-		if(i+1 != v.end()) {
-			str << c;
-		}
-	}
-
-	return str.str();
-}
-
-std::vector<std::string> config::split(const std::string& val, char c, int flags)
-{
-	std::vector<std::string> res;
-
-	std::string::const_iterator i1 = val.begin();
-	std::string::const_iterator i2 = val.begin();
-
-	while(i2 != val.end()) {
-		if(*i2 == c) {
-			std::string new_val(i1,i2);
-			if(flags & STRIP_SPACES)
-				strip(new_val);
-			if(!(flags & REMOVE_EMPTY) || !new_val.empty())
-				res.push_back(new_val);
-			++i2;
-			if(flags & STRIP_SPACES) {
-				while(i2 != val.end() && *i2 == ' ')
-					++i2;
-			}
-
-			i1 = i2;
-		} else {
-			++i2;
-		}
-	}
-
-	std::string new_val(i1,i2);
-	if(flags & STRIP_SPACES)
-		strip(new_val);
-	if(!(flags & REMOVE_EMPTY) || !new_val.empty())
-		res.push_back(new_val);
-
-	return res;
-}
-
-//identical to split(), except it does not split when it otherwise
-//would if the previous character was identical to the parameter 'quote'.
-//i.e. it does not split quoted commas.
-//this method was added to make it possible to quote user input,
-//particularly so commas in user input will not cause visual problems in menus.
-//why not change split()? that would change the methods post condition.
-std::vector<std::string> config::quoted_split(const std::string& val, char c, int flags, char quote)
-{
-	std::vector<std::string> res;
-
-	std::string::const_iterator i1 = val.begin();
-	std::string::const_iterator i2 = val.begin();
-
-	while(i2 != val.end()) {
-		if(*i2 == quote) {
-			// ignore quoted character
-			++i2;
-			if(i2 != val.end()) ++i2;
-		} else if(*i2 == c) {
-			std::string new_val(i1,i2);
-			if(flags & STRIP_SPACES)
-				strip(new_val);
-			if(!(flags & REMOVE_EMPTY) || !new_val.empty())
-				res.push_back(new_val);
-			++i2;
-			if(flags & STRIP_SPACES) {
-				while(i2 != val.end() && *i2 == ' ')
-					++i2;
-			}
-
-			i1 = i2;
-		} else {
-			++i2;
-		}
-	}
-
-	std::string new_val(i1,i2);
-	if(flags & STRIP_SPACES)
-		strip(new_val);
-	if(!(flags & REMOVE_EMPTY) || !new_val.empty())
-		res.push_back(new_val);
-
-	return res;
-}
-
-std::pair<int,int> config::parse_range(const std::string& str)
-{
-	const std::string::const_iterator dash = std::find(str.begin(),str.end(),'-');
-	const std::string a(str.begin(),dash);
-	const std::string b = dash != str.end() ? std::string(dash+1,str.end()) : a;
-	std::pair<int,int> res(atoi(a.c_str()),atoi(b.c_str()));
-	if(res.second < res.first)
-		res.second = res.first;
-
-	return res;
-}
-
-//make sure we regard '\r' and '\n' as a space, since Mac, Unix, and DOS
-//all consider these differently.
-bool config::notspace(char c) { return !portable_isspace(c); }
-
-//prepend all special characters with a backslash
-//special characters are:
-//#@{}+-,\*
-std::string& config::escape(std::string& str)
-{
-	if(!str.empty()) {
-		std::string::size_type pos = 0;
-
-		do {
-			pos = str.find_first_of("#@{}+-,\\*",pos);
-			if(pos != std::string::npos) {
-				str.insert(pos,1,'\\');
-				pos += 2;
-			}
-		} while(pos < str.size() && pos != std::string::npos);
-	}
-	return str;
-}
-// remove all escape characters (backslash)
-std::string& config::unescape(std::string& str)
-{
-	std::string::size_type pos = 0;
-
-	do {
-		pos = str.find('\\',pos);
-		if(pos != std::string::npos) {
-			str.erase(pos,1);
-			++pos;
-		}
-	} while(pos < str.size() && pos != std::string::npos);
-	return str;
-}
-std::string& config::strip(std::string& str)
-{
-	//if all the string contains is whitespace, then the whitespace may
-	//have meaning, so don't strip it
-	const std::string::iterator it=std::find_if(str.begin(),str.end(),notspace);
-	if(it == str.end())
-		return str;
-
-	str.erase(str.begin(),it);
-	str.erase(std::find_if(str.rbegin(),str.rend(),notspace).base(),str.end());
-
-	return str;
-}
-
+#if 0
 bool config::has_value(const std::string& values, const std::string& val)
 {
 	const std::vector<std::string>& vals = split(values);
 	return std::count(vals.begin(),vals.end(),val) > 0;
 }
-
-namespace {
-
-bool not_id(char c)
-{
-	return !isdigit(c) && !isalpha(c) && c != '.' && c != '_';
-}
-
-void do_interpolation(std::string& res, size_t npos, const string_map* m)
-{
-	LOG_CF << "doing interpolation into '" << res << "': " << npos << "\n";
-	const std::string::iterator i = std::find(res.begin()+npos,res.end(),'$');
-	if(i == res.end() || i+1 == res.end()) {
-		return;
-	}
-
-	npos = i - res.begin();
-
-	const std::string::iterator end = std::find_if(i+1,res.end(),not_id);
-
-	const std::string key(i+1,end);
-	res.erase(i,end);
-
-	if(m != NULL) {
-		const string_map::const_iterator itor = m->find(key);
-		if(itor != m->end()) {
-			res.insert(npos,itor->second);
-		}
-	} else {
-		res.insert(npos,game_events::get_variable_const(key));
-	}
-
-	do_interpolation(res,npos,m);
-}
-
-}
-
-std::string config::interpolate_variables_into_string(const std::string& str, const string_map* symbols)
-{
-	std::string res = str;
-	do_interpolation(res,0,symbols);
-
-	//remove any pipes in the string, as they are used simply to seperate variables
-	res.erase(std::remove(res.begin(),res.end(),'|'),res.end());
-
-	return res;
-}
+#endif
 
 void config::clear()
 {
Index: wesnoth/src/config.hpp
diff -u wesnoth/src/config.hpp:1.55 wesnoth/src/config.hpp:1.56
--- wesnoth/src/config.hpp:1.55	Sun Feb 20 19:22:31 2005
+++ wesnoth/src/config.hpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: config.hpp,v 1.55 2005/02/20 19:22:31 silene Exp $ */
+/* $Id: config.hpp,v 1.56 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -116,26 +116,6 @@
 	void clear_children(const std::string& key);
 	void remove_child(const std::string& key, size_t index);
 
-	// REMOVE_EMPTY : remove empty elements
-	// STRIP_SPACES : strips leading and trailing blank spaces
-	enum { REMOVE_EMPTY = 0x01, STRIP_SPACES = 0x02 };
-	static std::vector<std::string> split(const std::string& val, char c=',', int flags = REMOVE_EMPTY | STRIP_SPACES);
-	static std::string join(const std::vector<std::string>& v, char c=',');
-	static std::vector<std::string> quoted_split(const std::string& val, char c=',',
-						     int flags = REMOVE_EMPTY | STRIP_SPACES, char quote='\\');
-
-	static std::pair<int,int> parse_range(const std::string& str);
-	static bool notspace(char c);
-	static std::string& escape(std::string& str);
-	static std::string& unescape(std::string& str);
-	static std::string& strip(std::string& str);
-	static bool has_value(const std::string& values, const std::string& val);
-
-	//function which will interpolate variables, starting with '$' in the string 'str' with
-	//the equivalent symbols in the given symbol table. If 'symbols' is NULL, then game event
-	//variables will be used instead
-	static std::string interpolate_variables_into_string(const std::string& str, const string_map* symbols=NULL);
-
 	void clear();
 	bool empty() const;
 
Index: wesnoth/src/dialogs.cpp
diff -u wesnoth/src/dialogs.cpp:1.80 wesnoth/src/dialogs.cpp:1.81
--- wesnoth/src/dialogs.cpp:1.80	Wed Jan 19 20:11:34 2005
+++ wesnoth/src/dialogs.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: dialogs.cpp,v 1.80 2005/01/19 20:11:34 silene Exp $ */
+/* $Id: dialogs.cpp,v 1.81 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -351,7 +351,7 @@
 
 	// escape all special characters in filenames
 	std::string name = (*info_)[index_].name;
-	str << font::BOLD_TEXT << config::escape(name) << "\n" << time_buf;
+	str << font::BOLD_TEXT << utils::escape(name) << "\n" << time_buf;
 
 	const std::string& campaign_type = summary["campaign_type"];
 	if(summary["corrupt"] == "yes") {
@@ -696,7 +696,7 @@
 	
 	const std::string text = details.str();
 	
-	const std::vector<std::string> lines = config::split(text,'\n');
+	const std::vector<std::string> lines = utils::split(text, '\n');
 
 	SDL_Rect cur_area = area;
 
@@ -770,7 +770,7 @@
 
 	/* description text */
 	const std::string& desc_text = font::word_wrap_text((*descriptions_)[index_].first,font::SIZE_SMALL,area.w-2*campaign_preview_border);
-	const std::vector<std::string> lines = config::split(desc_text,'\n');
+	const std::vector<std::string> lines = utils::split(desc_text, '\n');
 	SDL_Rect txt_area = { area.x+campaign_preview_border,area.y,0,0 };
 
 	for(std::vector<std::string>::const_iterator line = lines.begin(); line != lines.end(); ++line) {
Index: wesnoth/src/editor/editor.cpp
diff -u wesnoth/src/editor/editor.cpp:1.90 wesnoth/src/editor/editor.cpp:1.91
--- wesnoth/src/editor/editor.cpp:1.90	Sat Feb 19 19:37:36 2005
+++ wesnoth/src/editor/editor.cpp	Sun Feb 20 21:45:22 2005
@@ -546,7 +546,7 @@
 	if (!load_successful) {
 		const std::string failed_msg = _("Load failed: ");
 		const std::string show_msg = failed_msg +
-			config::interpolate_variables_into_string(msg, &symbols);
+			utils::interpolate_variables_into_string(msg, &symbols);
 		gui::show_dialog(gui_, NULL, "", show_msg, gui::OK_ONLY);
 		throw load_map_exception();
 	}
Index: wesnoth/src/editor/editor_main.cpp
diff -u wesnoth/src/editor/editor_main.cpp:1.24 wesnoth/src/editor/editor_main.cpp:1.25
--- wesnoth/src/editor/editor_main.cpp:1.24	Wed Jan 26 20:36:24 2005
+++ wesnoth/src/editor/editor_main.cpp	Sun Feb 20 21:45:22 2005
@@ -82,7 +82,7 @@
 			if(arg+1 != argc) {
 				++arg;
 				const std::string val(argv[arg]);
-				const std::vector<std::string> res = config::split(val,'x');
+				const std::vector<std::string> res = utils::split(val, 'x');
 				if(res.size() == 2) {
 					const int xres = lexical_cast_default<int>(res.front());
 					const int yres = lexical_cast_default<int>(res.back());
Index: wesnoth/src/editor/map_manip.cpp
diff -u wesnoth/src/editor/map_manip.cpp:1.7 wesnoth/src/editor/map_manip.cpp:1.8
--- wesnoth/src/editor/map_manip.cpp:1.7	Fri May 28 17:07:46 2004
+++ wesnoth/src/editor/map_manip.cpp	Sun Feb 20 21:45:22 2005
@@ -13,6 +13,7 @@
 #include "../map.hpp"
 #include "../config.hpp"
 #include "../util.hpp"
+#include "serialization/string_utils.hpp"
 
 #include "map_manip.hpp"
 
@@ -192,7 +193,7 @@
 std::string resize_map(const gamemap &map, const unsigned new_w,
 					   const unsigned new_h, const gamemap::TERRAIN fill_with) {
 	std::string str_map = map.write();
-	std::vector<std::string> lines = config::split(str_map, '\n');
+	std::vector<std::string> lines = utils::split(str_map, '\n');
 	bool map_changed = false;
 	const unsigned old_w = (unsigned)map.x();
 	const unsigned old_h = (unsigned)map.y();
@@ -209,7 +210,7 @@
 		map_changed = true;
 	}
 	if (map_changed) {
-		return config::join(lines, '\n');
+		return utils::join(lines, '\n');
 	}
 	else {
 		return "";
@@ -222,7 +223,7 @@
 	if (str_map == "") {
 		return str_map;
 	}
-	std::vector<std::string> lines = config::split(str_map, '\n');
+	std::vector<std::string> lines = utils::split(str_map, '\n');
 	std::vector<std::string> new_lines;
 	if (axis == FLIP_Y) {
 		if (is_even(lines[0].size())) {
@@ -249,7 +250,7 @@
 	else {
 		new_lines = lines;
 	}
-	return config::join(new_lines, '\n');
+	return utils::join(new_lines, '\n');
 }
 
 bool valid_mapdata(const std::string &data, const config &cfg) {
Index: wesnoth/src/font.cpp
diff -u wesnoth/src/font.cpp:1.98 wesnoth/src/font.cpp:1.99
--- wesnoth/src/font.cpp:1.98	Wed Feb  9 23:32:01 2005
+++ wesnoth/src/font.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: font.cpp,v 1.98 2005/02/09 23:32:01 ydirson Exp $ */
+/* $Id: font.cpp,v 1.99 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -344,7 +344,7 @@
 		return surface();
 
 	// XXX Changed by erl, to not strip when rendering text. Works everywhere?
-	const std::vector<std::string> lines = config::split(text,'\n', config::REMOVE_EMPTY);
+	const std::vector<std::string> lines = utils::split(text, '\n', utils::REMOVE_EMPTY);
 	std::vector<surface> surfaces;
 	surfaces.reserve(lines.size());
 	size_t width = 0, height = 0;
@@ -565,7 +565,7 @@
 		if(i1 != i2) {
 			std::string new_string(i1,i2);
 
-			config::unescape(new_string);
+			utils::unescape(new_string);
 
 			const SDL_Rect rect = draw_text_line(gui, area, sz, col, new_string, x, y, use_tooltips, text_style);
 			if(rect.w > res.w) {
Index: wesnoth/src/game.cpp
diff -u wesnoth/src/game.cpp:1.193 wesnoth/src/game.cpp:1.194
--- wesnoth/src/game.cpp:1.193	Sun Feb 20 15:27:25 2005
+++ wesnoth/src/game.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: game.cpp,v 1.193 2005/02/20 15:27:25 Sirp Exp $ */
+/* $Id: game.cpp,v 1.194 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -392,7 +392,7 @@
 			if(arg_+1 != argc_) {
 				++arg_;
 				const std::string val(argv_[arg_]);
-				const std::vector<std::string> res = config::split(val,'x');
+				const std::vector<std::string> res = utils::split(val, 'x');
 				if(res.size() == 2) {
 					const int xres = lexical_cast_default<int>(res.front());
 					const int yres = lexical_cast_default<int>(res.back());
@@ -650,7 +650,7 @@
    			continue;
    		}
 
-   		std::vector<std::string> name_value = config::split(val,'=');
+   		std::vector<std::string> name_value = utils::split(val, '=');
    		if(name_value.size() > 2) {
    			std::cerr << "invalid argument '" << val << "'\n";
    			return false;
@@ -679,7 +679,7 @@
    			} else if(last_digit && name_head == "--side") {
    				side_types[side] = value;
    			} else if(last_digit && name_head == "--parm") {
-   				const std::vector<std::string> name_value = config::split(value,':');
+   				const std::vector<std::string> name_value = utils::split(value, ':');
    				if(name_value.size() != 2) {
    					std::cerr << "argument to '" << name << "' must be in the format name:value\n";
    					return false;
@@ -985,9 +985,9 @@
 	state_.scenario = campaign["first_scenario"];
 
 	const std::string difficulty_descriptions = campaign["difficulty_descriptions"];
-	std::vector<std::string> difficulty_options = config::split(difficulty_descriptions,';');
+	std::vector<std::string> difficulty_options = utils::split(difficulty_descriptions, ';');
 
-	const std::vector<std::string> difficulties = config::split(campaign["difficulties"]);
+	const std::vector<std::string> difficulties = utils::split(campaign["difficulties"]);
 
 	if(difficulties.empty() == false) {
 		if(difficulty_options.size() != difficulties.size()) {
@@ -1058,7 +1058,7 @@
 		return;
 	}
 
-	const std::vector<std::string> items = config::split(host,':');
+	const std::vector<std::string> items = utils::split(host, ':');
 	host = items.front();
 
 	try {
Index: wesnoth/src/game_events.cpp
diff -u wesnoth/src/game_events.cpp:1.118 wesnoth/src/game_events.cpp:1.119
--- wesnoth/src/game_events.cpp:1.118	Fri Jan 21 20:07:30 2005
+++ wesnoth/src/game_events.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: game_events.cpp,v 1.118 2005/01/21 20:07:30 Sirp Exp $ */
+/* $Id: game_events.cpp,v 1.119 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -301,7 +301,7 @@
 
 		const std::string& type = cfg["type"];
 
-		const std::vector<std::string>& types = config::split(type);
+		const std::vector<std::string>& types = utils::split(type);
 		for(std::vector<std::string>::const_iterator i = types.begin(); i != types.end(); ++i) {
 			(*teams)[index].recruits().insert(*i);
 			preferences::encountered_units().insert(*i);
@@ -321,7 +321,7 @@
 			return rval;
 
 		const std::string& type = cfg["type"];
-		const std::vector<std::string>& types = config::split(type);
+		const std::vector<std::string>& types = utils::split(type);
 		for(std::vector<std::string>::const_iterator i = types.begin(); i != types.end(); ++i) {
 			(*teams)[index].recruits().erase(*i);
 
@@ -338,7 +338,7 @@
 		if(index >= teams->size())
 			return rval;
 
-		std::vector<std::string> recruit = config::split(cfg["recruit"]);
+		std::vector<std::string> recruit = utils::split(cfg["recruit"]);
 		if(recruit.size() == 1 && recruit.back() == "")
 			recruit.clear();
 
@@ -461,8 +461,8 @@
 		const game_data::unit_type_map::const_iterator itor = game_data_ptr->unit_types.find(type);
 		if(itor != game_data_ptr->unit_types.end()) {
 			unit dummy_unit(&itor->second,0,false,true,gender);
-			const std::vector<std::string> xvals = config::split(cfg["x"]);
-			const std::vector<std::string> yvals = config::split(cfg["y"]);
+			const std::vector<std::string> xvals = utils::split(cfg["x"]);
+			const std::vector<std::string> yvals = utils::split(cfg["y"]);
 			std::vector<gamemap::location> path;
 			gamemap::location src;
 			gamemap::location dst;
@@ -493,19 +493,22 @@
 
 	//setting a variable
 	else if(cmd == "set_variable") {
-		const std::string& name = config::interpolate_variables_into_string(cfg.get_attribute("name"));
+		const std::string& name = utils::interpolate_variables_into_string(
+			cfg.get_attribute("name"));
 		std::string& var = game_events::get_variable(name);
 		const std::string& value = cfg["value"];
 		if(value.empty() == false) {
 			var = value;
 		}
 
-		const std::string& format = config::interpolate_variables_into_string(cfg.get_attribute("format"));
+		const std::string& format = utils::interpolate_variables_into_string(
+			cfg.get_attribute("format"));
 		if(format.empty() == false) {
 			var = format;
 		}
 
-		const std::string& to_variable = config::interpolate_variables_into_string(cfg.get_attribute("to_variable"));
+		const std::string& to_variable = utils::interpolate_variables_into_string(
+			cfg.get_attribute("to_variable"));
 		if(to_variable.empty() == false) {
 			var = game_events::get_variable(to_variable);
 		}
@@ -628,9 +631,9 @@
 	else if(cmd == "role") {
 
 		//get a list of the types this unit can be
-		std::vector<std::string> types = config::split(cfg["type"]);
+		std::vector<std::string> types = utils::split(cfg["type"]);
 
-                std::vector<std::string> sides = config::split(cfg["side"]);
+                std::vector<std::string> sides = utils::split(cfg["side"]);
 
 		//iterate over all the types, and for each type, try to find
 		//a unit that matches
@@ -977,7 +980,7 @@
 		//if we're not replaying, or if we are replaying and there is no choice
 		//to be made, show the dialog.
 		if(get_replay_source().at_end() || options.empty()) {
-			const std::string msg = config::interpolate_variables_into_string(cfg["message"]);
+			const std::string msg = utils::interpolate_variables_into_string(cfg["message"]);
 			option_chosen = gui::show_dialog(*screen,surface,caption,msg,
 		                        options.empty() ? gui::MESSAGE : gui::OK_ONLY,
 		                        options.empty() ? NULL : &options);
@@ -1127,7 +1130,8 @@
 	}
 
 	else if(cmd == "unstore_unit") {
-		const config& var = game_events::get_variable_cfg(config::interpolate_variables_into_string(cfg.get_attribute("variable")));
+		const config& var = game_events::get_variable_cfg(
+			utils::interpolate_variables_into_string(cfg.get_attribute("variable")));
 
 		try {
 			const unit u(*game_data_ptr,var);
@@ -1282,8 +1286,8 @@
                                                    const std::string& yloc)
 {
 	if(std::find(xloc.begin(),xloc.end(),',') != xloc.end()) {
-		std::vector<std::string> xlocs = config::split(xloc);
-		std::vector<std::string> ylocs = config::split(yloc);
+		std::vector<std::string> xlocs = utils::split(xloc);
+		std::vector<std::string> ylocs = utils::split(yloc);
 
 		const int size = xlocs.size() < ylocs.size()?xlocs.size():ylocs.size();
 		for(int i = 0; i != size; ++i) {
@@ -1540,7 +1544,7 @@
 	used_items.clear();
 	const std::string& used = cfg["used_items"];
 	if(!used.empty()) {
-		const std::vector<std::string>& v = config::split(used);
+		const std::vector<std::string>& v = utils::split(used);
 		for(std::vector<std::string>::const_iterator i = v.begin(); i != v.end(); ++i) {
 			used_items.insert(*i);
 		}
Index: wesnoth/src/gamestatus.cpp
diff -u wesnoth/src/gamestatus.cpp:1.54 wesnoth/src/gamestatus.cpp:1.55
--- wesnoth/src/gamestatus.cpp:1.54	Sun Feb 20 15:27:25 2005
+++ wesnoth/src/gamestatus.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: gamestatus.cpp,v 1.54 2005/02/20 15:27:25 Sirp Exp $ */
+/* $Id: gamestatus.cpp,v 1.55 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -208,7 +208,7 @@
 
 	const std::string& can_recruit_str = (*cfg)["can_recruit"];
 	if(can_recruit_str != "") {
-		const std::vector<std::string> can_recruit = config::split(can_recruit_str);
+		const std::vector<std::string> can_recruit = utils::split(can_recruit_str);
 		std::copy(can_recruit.begin(),can_recruit.end(),std::inserter(res.can_recruit,res.can_recruit.end()));
 	}
 
Index: wesnoth/src/gettext.cpp
diff -u wesnoth/src/gettext.cpp:1.7 wesnoth/src/gettext.cpp:1.8
--- wesnoth/src/gettext.cpp:1.7	Sun Dec  5 18:24:44 2004
+++ wesnoth/src/gettext.cpp	Sun Feb 20 21:45:21 2005
@@ -1,6 +1,7 @@
 #include "global.hpp"
 
 #include "gettext.hpp"
+#include "serialization/string_utils.hpp"
 
 #include <cstring>
 
@@ -38,7 +39,6 @@
 std::string vgettext (const char *msgid, const string_map& symbols)
 {
 	const std::string orig(gettext(msgid));
-	const std::string msg = config::interpolate_variables_into_string(orig,
-			&symbols);
+	const std::string msg = utils::interpolate_variables_into_string(orig, &symbols);
 	return msg;
 }
Index: wesnoth/src/help.cpp
diff -u wesnoth/src/help.cpp:1.66 wesnoth/src/help.cpp:1.67
--- wesnoth/src/help.cpp:1.66	Sun Jan 23 15:32:07 2005
+++ wesnoth/src/help.cpp	Sun Feb 20 21:45:21 2005
@@ -735,7 +735,7 @@
 	const config *toplevel = cfg.child("toplevel");
 	if (toplevel != NULL) {
 		const std::vector<std::string> toplevel_refs
-			= config::quoted_split((*toplevel)["sections"]);
+			= utils::quoted_split((*toplevel)["sections"]);
 		if (std::find(toplevel_refs.begin(), toplevel_refs.end(), section_id)
 			!= toplevel_refs.end()) {
 			return true;
@@ -744,7 +744,7 @@
 	for (config::const_child_itors itors = cfg.child_range("section");
 		 itors.first != itors.second; itors.first++) {
 		const std::vector<std::string> sections_refd
-			= config::quoted_split((*(*itors.first))["sections"]);
+			= utils::quoted_split((*(*itors.first))["sections"]);
 		if (std::find(sections_refd.begin(), sections_refd.end(), section_id)
 			!= sections_refd.end()) {
 			return true;
@@ -757,7 +757,7 @@
 	const config *toplevel = cfg.child("toplevel");
 	if (toplevel != NULL) {
 		const std::vector<std::string> toplevel_refs
-			= config::quoted_split((*toplevel)["topics"]);
+			= utils::quoted_split((*toplevel)["topics"]);
 		if (std::find(toplevel_refs.begin(), toplevel_refs.end(), topic_id)
 			!= toplevel_refs.end()) {
 			return true;
@@ -766,7 +766,7 @@
 	for (config::const_child_itors itors = cfg.child_range("section");
 		 itors.first != itors.second; itors.first++) {
 		const std::vector<std::string> topics_refd
-			= config::quoted_split((*(*itors.first))["topics"]);
+			= utils::quoted_split((*(*itors.first))["topics"]);
 		if (std::find(topics_refd.begin(), topics_refd.end(), topic_id)
 			!= topics_refd.end()) {
 			return true;
@@ -782,7 +782,7 @@
 				  << std::endl;
 	}
 	else if (section_cfg != NULL) {
-		const std::vector<std::string> sections = config::quoted_split((*section_cfg)["sections"]);
+		const std::vector<std::string> sections = utils::quoted_split((*section_cfg)["sections"]);
 		const std::string id = level == 0 ? "toplevel" : (*section_cfg)["id"];
 		if (level != 0) {
 			if (!is_valid_id(id)) {
@@ -814,7 +814,7 @@
 			generate_sections((*section_cfg)["generator"]);
 		std::transform(generated_sections.begin(), generated_sections.end(),
 					   std::back_inserter(sec.sections), create_section());
-		const std::vector<std::string> topics = config::quoted_split((*section_cfg)["topics"]);
+		const std::vector<std::string> topics = utils::quoted_split((*section_cfg)["topics"]);
 		// Find all topics in this section.
 		for (it = topics.begin(); it != topics.end(); it++) {
 			config const *topic_cfg = help_cfg->find_child("topic", "id", *it);
@@ -1300,7 +1300,7 @@
 			}
 			string_map sm;
 			sm["terrains"] = alias_ss.str();
-			ss << config::interpolate_variables_into_string(
+			ss << utils::interpolate_variables_into_string(
 				_("This terrain acts as $terrains for movement and defense purposes."), &sm);
 			if (aliased_terrains.size() > 1)
 				ss << " " << _("The terrain with the best modifier is chosen automatically.");
@@ -1386,7 +1386,7 @@
 	std::vector<std::string>::iterator it =
 		std::remove(res_lines.begin(), res_lines.end(), "");
 	std::vector<std::string> res_lines_rem(res_lines.begin(), it);
-	std::string text = config::join(res_lines_rem, '\n');
+	std::string text = utils::join(res_lines_rem, '\n');
 	return text;
 }
 
@@ -2449,7 +2449,7 @@
 std::vector<std::string> split_in_width(const std::string &s, const int font_size,
 										const unsigned width) {
 	std::string wrapped = font::word_wrap_text(s, font_size, width);
-	std::vector<std::string> parts = config::split(wrapped, '\n', 0);
+	std::vector<std::string> parts = utils::split(wrapped, '\n', 0);
 	return parts;
 }
 
Index: wesnoth/src/map.cpp
diff -u wesnoth/src/map.cpp:1.49 wesnoth/src/map.cpp:1.50
--- wesnoth/src/map.cpp:1.49	Sat Feb 19 09:26:31 2005
+++ wesnoth/src/map.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: map.cpp,v 1.49 2005/02/19 09:26:31 isaaccp Exp $ */
+/* $Id: map.cpp,v 1.50 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -393,12 +393,12 @@
 std::vector<gamemap::location> parse_location_range(const std::string& x, const std::string& y)
 {
 	std::vector<gamemap::location> res;
-	const std::vector<std::string> xvals = config::split(x);
-	const std::vector<std::string> yvals = config::split(y);
+	const std::vector<std::string> xvals = utils::split(x);
+	const std::vector<std::string> yvals = utils::split(y);
 
 	for(unsigned int i = 0; i != minimum(xvals.size(),yvals.size()); ++i) {
-		const std::pair<int,int> xrange = config::parse_range(xvals[i]);
-		const std::pair<int,int> yrange = config::parse_range(yvals[i]);
+		const std::pair<int,int> xrange = utils::parse_range(xvals[i]);
+		const std::pair<int,int> yrange = utils::parse_range(yvals[i]);
 
 		for(int x = xrange.first; x <= xrange.second; ++x) {
 			for(int y = yrange.first; y <= yrange.second; ++y) {
Index: wesnoth/src/mapgen.cpp
diff -u wesnoth/src/mapgen.cpp:1.55 wesnoth/src/mapgen.cpp:1.56
--- wesnoth/src/mapgen.cpp:1.55	Sun Feb  6 10:40:12 2005
+++ wesnoth/src/mapgen.cpp	Sun Feb 20 21:45:21 2005
@@ -30,7 +30,7 @@
 {
 	//the first token is the name of the generator, tokens after
 	//that are arguments to the generator
-	std::vector<std::string> parameters = config::split(parms,' ');
+	std::vector<std::string> parameters = utils::split(parms, ' ');
 	util::scoped_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
 	if(generator == NULL) {
 		ERR_CF << "could not find map generator '" << parameters.front() << "'\n";
@@ -45,7 +45,7 @@
 {
 	//the first token is the name of the generator, tokens after
 	//that are arguments to the generator
-	std::vector<std::string> parameters = config::split(parms,' ');
+	std::vector<std::string> parameters = utils::split(parms, ' ');
 	util::scoped_ptr<map_generator> generator(create_map_generator(parameters.front(),cfg));
 	if(generator == NULL) {
 		ERR_CF << "could not find map generator '" << parameters.front() << "'\n";
@@ -526,7 +526,7 @@
 std::string generate_name(const unit_race& name_generator, const std::string& id, std::string* base_name=NULL,
 						  std::map<std::string,std::string>* additional_symbols=NULL)
 {
-	const std::vector<std::string>& options = config::split(string_table[id]);
+	const std::vector<std::string>& options = utils::split(string_table[id]);
 	if(options.empty() == false) {
 		const size_t choice = rand()%options.size();
 		LOG_NG << "calling name generator...\n";
@@ -546,7 +546,7 @@
 
 		(*additional_symbols)["name"] = name;
 		LOG_NG << "interpolation variables into '" << options[choice] << "'\n";
-		return config::interpolate_variables_into_string(options[choice],additional_symbols);
+		return utils::interpolate_variables_into_string(options[choice], additional_symbols);
 	}
 
 	return "";
@@ -1007,7 +1007,7 @@
 					}
 
 					if(direction != -1) {
-						const std::vector<std::string> items = config::split(convert_to_bridge);
+						const std::vector<std::string> items = utils::split(convert_to_bridge);
 						if(size_t(direction) < items.size() && items[direction].empty() == false) {
 							terrain[x][y] = items[direction][0];
 						}
Index: wesnoth/src/multiplayer_client.cpp
diff -u wesnoth/src/multiplayer_client.cpp:1.86 wesnoth/src/multiplayer_client.cpp:1.87
--- wesnoth/src/multiplayer_client.cpp:1.86	Sun Jan 23 01:13:23 2005
+++ wesnoth/src/multiplayer_client.cpp	Sun Feb 20 21:45:21 2005
@@ -633,7 +633,7 @@
 	}
 
 	if(!side["leader"].empty()) {
-		leaders_ = config::split(side["leader"]);
+		leaders_ = utils::split(side["leader"]);
 	}
 	
 	const std::string default_leader = side["type"];
@@ -747,7 +747,7 @@
 		const config& side = *side_list_[selection_];
 		std::string faction = side["name"];
 		const std::string recruits = side["recruit"];
-		const std::vector<std::string> recruit_list = config::split(recruits);
+		const std::vector<std::string> recruit_list = utils::split(recruits);
 		std::ostringstream recruit_string;
 
 		if(faction[0] == font::IMAGE) {
Index: wesnoth/src/multiplayer_connect.cpp
diff -u wesnoth/src/multiplayer_connect.cpp:1.102 wesnoth/src/multiplayer_connect.cpp:1.103
--- wesnoth/src/multiplayer_connect.cpp:1.102	Wed Feb  9 15:25:32 2005
+++ wesnoth/src/multiplayer_connect.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: multiplayer_connect.cpp,v 1.102 2005/02/09 15:25:32 j_daniel Exp $ */
+/* $Id: multiplayer_connect.cpp,v 1.103 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -786,7 +786,7 @@
 			if ((**side)["type"] == "random" || (**side)["type"].empty()) {
 				// Choose a random leader type.  
 				std::vector<std::string> types = 
-					config::split((**side)["leader"]);
+					utils::split((**side)["leader"]);
 				if (!types.empty()) {
 					const int lchoice = rand() % types.size();
 					(**side)["type"] = types[lchoice];
Index: wesnoth/src/playturn.cpp
diff -u wesnoth/src/playturn.cpp:1.328 wesnoth/src/playturn.cpp:1.329
--- wesnoth/src/playturn.cpp:1.328	Sun Feb  6 10:40:12 2005
+++ wesnoth/src/playturn.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: playturn.cpp,v 1.328 2005/02/06 10:40:12 isaaccp Exp $ */
+/* $Id: playturn.cpp,v 1.329 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -1878,7 +1878,7 @@
 		if(message != "") {
 			string_map symbols;
 			symbols["noun"] = (u.gender() == unit_race::MALE ? _("him") : _("her"));
-			message = config::interpolate_variables_into_string(message,&symbols);
+			message = utils::interpolate_variables_into_string(message, &symbols);
 
 			const int res = gui::show_dialog(disp_,NULL,"",message,gui::YES_NO);
 			if(res != 0) {
@@ -2310,7 +2310,7 @@
 	bool found = false;
 	gamemap::location loc = last_search_hit_;
 	//If this is a location search, just center on that location.
-	std::vector<std::string> args = config::split(last_search_,',');
+	std::vector<std::string> args = utils::split(last_search_, ',');
 	if(args.size() == 2) {
 		int x, y;
 		x = lexical_cast_default<int>(args[0], 0)-1;
@@ -2361,7 +2361,7 @@
 		//Not found, inform the player
 		string_map symbols;
 		symbols["search"] = last_search_;
-		const std::string msg = config::interpolate_variables_into_string(
+		const std::string msg = utils::interpolate_variables_into_string(
 			_("Couldn't find label or unit containing the string '$search'."),&symbols);
 		gui::show_dialog(gui_,NULL,"",msg);
 	}
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.132 wesnoth/src/preferences.cpp:1.133
--- wesnoth/src/preferences.cpp:1.132	Sun Feb 20 15:27:25 2005
+++ wesnoth/src/preferences.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.132 2005/02/20 15:27:25 Sirp Exp $ */
+/* $Id: preferences.cpp,v 1.133 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -71,10 +71,10 @@
 	set_show_haloes(prefs["show_haloes"] != "no");
 
 	std::vector<std::string> v;
-	v = config::split(prefs["encountered_units"]);
+	v = utils::split(prefs["encountered_units"]);
 	std::copy(v.begin(), v.end(),
 			  std::inserter(encountered_units_set, encountered_units_set.begin()));
-	v = config::split(prefs["encountered_terrains"]);
+	v = utils::split(prefs["encountered_terrains"]);
 	std::copy(v.begin(), v.end(),
 			  std::inserter(encountered_terrains_set, encountered_terrains_set.begin()));
 }
@@ -84,11 +84,11 @@
 	
 	std::vector<std::string> v;
 	std::copy(encountered_units_set.begin(), encountered_units_set.end(), std::back_inserter(v));
-	prefs["encountered_units"] = config::join(v);
+	prefs["encountered_units"] = utils::join(v);
 	v.clear();
 	std::copy(encountered_terrains_set.begin(), encountered_terrains_set.end(),
 			  std::back_inserter(v));
-	prefs["encountered_terrains"] = config::join(v);
+	prefs["encountered_terrains"] = utils::join(v);
 	encountered_units_set.clear();
 	encountered_terrains_set.clear();
 	try {
Index: wesnoth/src/race.cpp
diff -u wesnoth/src/race.cpp:1.11 wesnoth/src/race.cpp:1.12
--- wesnoth/src/race.cpp:1.11	Thu Nov 18 04:08:32 2004
+++ wesnoth/src/race.cpp	Sun Feb 20 21:45:21 2005
@@ -99,8 +99,8 @@
 unit_race::unit_race(const config& cfg) : name_(cfg["name"]), ntraits_(atoi(cfg["num_traits"].c_str())),
                                           not_living_(cfg["not_living"] == "yes")
 {
-	names_[MALE] = config::split(cfg["male_names"]);
-	names_[FEMALE] = config::split(cfg["female_names"]);
+	names_[MALE] = utils::split(cfg["male_names"]);
+	names_[FEMALE] = utils::split(cfg["female_names"]);
 
 	chain_size_ = atoi(cfg["markov_chain_size"].c_str());
 	if(chain_size_ <= 0)
Index: wesnoth/src/serialization/string_utils.cpp
diff -u wesnoth/src/serialization/string_utils.cpp:1.2 wesnoth/src/serialization/string_utils.cpp:1.3
--- wesnoth/src/serialization/string_utils.cpp:1.2	Sun Feb 20 20:46:48 2005
+++ wesnoth/src/serialization/string_utils.cpp	Sun Feb 20 21:45:22 2005
@@ -1,4 +1,4 @@
-/* $Id: string_utils.cpp,v 1.2 2005/02/20 20:46:48 silene Exp $ */
+/* $Id: string_utils.cpp,v 1.3 2005/02/20 21:45:22 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Copyright (C) 2005 by Guillaume Melquiond <guillaume.melquiond@xxxxxxxxx>
@@ -13,6 +13,7 @@
 */
 
 #include <cctype>
+#include <sstream>
 
 #include "serialization/string_utils.hpp"
 
@@ -131,11 +132,108 @@
 	do_interpolation(res, 0, symbols);
 
 	//remove any pipes in the string, as they are used simply to seperate variables
-	res.erase(std::remove(res.begin(),res.end(),'|'),res.end());
+	res.erase(std::remove(res.begin(), res.end(), '|'), res.end());
 
 	return res;
 }
 
+//prepend all special characters with a backslash
+//special characters are:
+//#@{}+-,\*
+std::string &escape(std::string &str)
+{
+	std::string::size_type pos = 0;
+	do {
+		pos = str.find_first_of("#@{}+-,\\*", pos);
+		if (pos == std::string::npos)
+			break;
+		str.insert(pos, 1, '\\');
+		pos += 2;
+	} while (pos < str.size());
+	return str;
+}
+
+// remove all escape characters (backslash)
+std::string &unescape(std::string &str)
+{
+	std::string::size_type pos = 0;
+	do {
+		pos = str.find('\\', pos);
+		if (pos == std::string::npos)
+			break;
+		str.erase(pos, 1);
+		++pos;
+	} while (pos < str.size());
+	return str;
+}
+
+std::string join(std::vector< std::string > const &v, char c)
+{
+	std::stringstream str;
+	for(std::vector< std::string >::const_iterator i = v.begin(); i != v.end(); ++i) {
+		str << *i;
+		if (i + 1 != v.end())
+			str << c;
+	}
+
+	return str.str();
+}
+
+//identical to split(), except it does not split when it otherwise
+//would if the previous character was identical to the parameter 'quote'.
+//i.e. it does not split quoted commas.
+//this method was added to make it possible to quote user input,
+//particularly so commas in user input will not cause visual problems in menus.
+//why not change split()? that would change the methods post condition.
+std::vector< std::string > quoted_split(std::string const &val, char c, int flags, char quote)
+{
+	std::vector<std::string> res;
+
+	std::string::const_iterator i1 = val.begin();
+	std::string::const_iterator i2 = val.begin();
 
+	while (i2 != val.end()) {
+		if (*i2 == quote) {
+			// ignore quoted character
+			++i2;
+			if (i2 != val.end()) ++i2;
+		} else if (*i2 == c) {
+			std::string new_val(i1, i2);
+			if (flags & STRIP_SPACES)
+				strip(new_val);
+			if (!(flags & REMOVE_EMPTY) || !new_val.empty())
+				res.push_back(new_val);
+			++i2;
+			if (flags & STRIP_SPACES) {
+				while(i2 != val.end() && *i2 == ' ')
+					++i2;
+			}
+
+			i1 = i2;
+		} else {
+			++i2;
+		}
+	}
+
+	std::string new_val(i1, i2);
+	if (flags & STRIP_SPACES)
+		strip(new_val);
+	if (!(flags & REMOVE_EMPTY) || !new_val.empty())
+		res.push_back(new_val);
+
+	return res;
+}
+
+std::pair< int, int > parse_range(std::string const &str)
+{
+	const std::string::const_iterator dash = std::find(str.begin(), str.end(), '-');
+	const std::string a(str.begin(), dash);
+	const std::string b = dash != str.end() ? std::string(dash + 1, str.end()) : a;
+	std::pair<int,int> res(atoi(a.c_str()), atoi(b.c_str()));
+	if (res.second < res.first)
+		res.second = res.first;
+
+	return res;
+}
 
 }
Index: wesnoth/src/serialization/string_utils.hpp
diff -u wesnoth/src/serialization/string_utils.hpp:1.1 wesnoth/src/serialization/string_utils.hpp:1.2
--- wesnoth/src/serialization/string_utils.hpp:1.1	Sun Feb 20 19:22:31 2005
+++ wesnoth/src/serialization/string_utils.hpp	Sun Feb 20 21:45:22 2005
@@ -1,4 +1,4 @@
-/* $Id: string_utils.hpp,v 1.1 2005/02/20 19:22:31 silene Exp $ */
+/* $Id: string_utils.hpp,v 1.2 2005/02/20 21:45:22 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Copyright (C) 2005 by Guillaume Melquiond <guillaume.melquiond@xxxxxxxxx>
@@ -32,7 +32,7 @@
 std::string join(std::vector< std::string > const &v, char c = ',');
 std::vector< std::string > quoted_split(std::string const &val, char c= ',',
                                         int flags = REMOVE_EMPTY | STRIP_SPACES, char quote = '\\');
-std::pair< int, int > parse_range(const std::string& str);
+std::pair< int, int > parse_range(std::string const &str);
 bool notspace(char c);
 std::string &escape(std::string &str);
 std::string &unescape(std::string &str);
Index: wesnoth/src/server/server.cpp
diff -u wesnoth/src/server/server.cpp:1.64 wesnoth/src/server/server.cpp:1.65
--- wesnoth/src/server/server.cpp:1.64	Sun Feb 20 21:37:14 2005
+++ wesnoth/src/server/server.cpp	Sun Feb 20 21:45:22 2005
@@ -5,6 +5,7 @@
 #include "../network.hpp"
 #include "../util.hpp"
 #include "../wassert.hpp"
+#include "serialization/string_utils.hpp"
 
 #include "SDL.h"
 
@@ -367,7 +368,7 @@
 
 	//check the username is valid (all alpha-numeric or space)
 	std::string username = (*login)["username"];
-	config::strip(username);
+	utils::strip(username);
 	const int alnum = std::count_if(username.begin(),username.end(),isalnum);
 	const int spaces = std::count(username.begin(),username.end(),' ');
 	if((alnum + spaces != username.size()) || spaces == username.size() || username.empty()) {
Index: wesnoth/src/team.cpp
diff -u wesnoth/src/team.cpp:1.78 wesnoth/src/team.cpp:1.79
--- wesnoth/src/team.cpp:1.78	Thu Feb  3 19:48:00 2005
+++ wesnoth/src/team.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: team.cpp,v 1.78 2005/02/03 19:48:00 silene Exp $ */
+/* $Id: team.cpp,v 1.79 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -94,7 +94,7 @@
 
 	const std::string& enemies_list = cfg["enemy"];
 	if(!enemies_list.empty()) {
-		std::vector<std::string> venemies = config::split(enemies_list);
+		std::vector<std::string> venemies = utils::split(enemies_list);
 		for(std::vector<std::string>::const_iterator i = venemies.begin(); i != venemies.end(); ++i) {
 			enemies.push_back(atoi(i->c_str()));
 		}
@@ -156,7 +156,7 @@
 		village_value = atof(village_val.c_str());
 	}
 
-	std::vector<std::string> recruits = config::split(cfg["recruit"]);
+	std::vector<std::string> recruits = utils::split(cfg["recruit"]);
 	for(std::vector<std::string>::const_iterator i = recruits.begin(); i != recruits.end(); ++i) {
 		can_recruit.insert(*i);
 	}
@@ -166,7 +166,7 @@
 		recruit_pattern = global_ai_params["recruitment_pattern"];
 	}
 
-	recruitment_pattern = config::split(recruit_pattern);
+	recruitment_pattern = utils::split(recruit_pattern);
 
 	//default recruitment pattern is to buy 2 fighters for every 1 archer
 	if(recruitment_pattern.empty()) {
@@ -361,7 +361,7 @@
 	for(std::vector<config>::const_iterator i = info_.ai_params.begin(); i != info_.ai_params.end(); ++i) {
 		const std::string& time_of_day = (*i)["time_of_day"];
 		if(time_of_day.empty() == false) {
-			const std::vector<std::string>& times = config::split(time_of_day);
+			const std::vector<std::string>& times = utils::split(time_of_day);
 			if(std::count(times.begin(),times.end(),tod.id) == 0) {
 				continue;
 			}
@@ -371,9 +371,9 @@
 		if(turns.empty() == false) {
 			bool matched = false;
 
-			const std::vector<std::string>& turns_list = config::split(turns);
+			const std::vector<std::string>& turns_list = utils::split(turns);
 			for(std::vector<std::string>::const_iterator j = turns_list.begin(); j != turns_list.end(); ++j) {
-				const std::pair<int,int> range = config::parse_range(*j);
+				const std::pair<int,int> range = utils::parse_range(*j);
 				if(turn >= range.first && turn <= range.second) {
 					matched = true;
 					break;
Index: wesnoth/src/theme.cpp
diff -u wesnoth/src/theme.cpp:1.30 wesnoth/src/theme.cpp:1.31
--- wesnoth/src/theme.cpp:1.30	Wed Jan 19 21:57:16 2005
+++ wesnoth/src/theme.cpp	Sun Feb 20 21:45:21 2005
@@ -37,7 +37,7 @@
 
 	_rect read_rect(const config& cfg) {
 		_rect rect = { 0, 0, 0, 0 };
-		const std::vector<std::string> items = config::split(cfg["rect"].c_str());
+		const std::vector<std::string> items = utils::split(cfg["rect"].c_str());
 		if(items.size() >= 1)
 			rect.x1 = atoi(items[0].c_str());
 
@@ -67,7 +67,7 @@
 	std::string resolve_rect(const std::string& rect_str) {
 		_rect rect = { 0, 0, 0, 0 };
 		std::stringstream resolved;
-		const std::vector<std::string> items = config::split(rect_str.c_str());
+		const std::vector<std::string> items = utils::split(rect_str.c_str());
 		if(items.size() >= 1) {
 			rect.x1 = compute(items[0], ref_rect.x1, ref_rect.x2);
 			resolved << rect.x1;
@@ -411,7 +411,7 @@
 theme::menu::menu(const config& cfg) : object(cfg), context_(cfg["is_context_menu"] == "true"),
                                        title_(cfg["title"] + cfg["title_literal"]),
 									   image_(cfg["image"]),
-									   items_(config::split(cfg["items"]))
+									   items_(utils::split(cfg["items"]))
 {}
 
 bool theme::menu::is_context() const { return context_; }
Index: wesnoth/src/tools/exploder_cutter.cpp
diff -u wesnoth/src/tools/exploder_cutter.cpp:1.3 wesnoth/src/tools/exploder_cutter.cpp:1.4
--- wesnoth/src/tools/exploder_cutter.cpp:1.3	Mon Jul 19 18:31:32 2004
+++ wesnoth/src/tools/exploder_cutter.cpp	Sun Feb 20 21:45:22 2005
@@ -1,4 +1,4 @@
-/* $Id: exploder_cutter.cpp,v 1.3 2004/07/19 18:31:32 gruikya Exp $ */
+/* $Id: exploder_cutter.cpp,v 1.4 2005/02/20 21:45:22 silene Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <ayin@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -12,8 +12,9 @@
 */
 
 #include "exploder_cutter.hpp"
-#include "../filesystem.hpp"
-#include "../sdl_utils.hpp"
+#include "filesystem.hpp"
+#include "sdl_utils.hpp"
+#include "serialization/string_utils.hpp"
 #include "SDL_image.h"
 
 cutter::cutter() : verbose_(false)
@@ -128,7 +129,7 @@
 
 	const cutter::mask& mask = masks_[name];
 
-	std::vector<std::string> pos = config::split((*config)["pos"]);
+	std::vector<std::string> pos = utils::split((*config)["pos"]);
 	if(pos.size() != 2) 
 		throw exploder_failure("Invalid position " + (*config)["pos"]);
 
Index: wesnoth/src/tools/exploder_utils.cpp
diff -u wesnoth/src/tools/exploder_utils.cpp:1.3 wesnoth/src/tools/exploder_utils.cpp:1.4
--- wesnoth/src/tools/exploder_utils.cpp:1.3	Mon Jul 19 18:31:32 2004
+++ wesnoth/src/tools/exploder_utils.cpp	Sun Feb 20 21:45:22 2005
@@ -1,4 +1,4 @@
-/* $Id: exploder_utils.cpp,v 1.3 2004/07/19 18:31:32 gruikya Exp $ */
+/* $Id: exploder_utils.cpp,v 1.4 2005/02/20 21:45:22 silene Exp $ */
 /*
    Copyright (C) 2004 by Philippe Plantier <ayin@xxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org
@@ -12,13 +12,13 @@
 */
 
 #include "exploder_utils.hpp"
-#include "../game_config.hpp"
-#include "../config.hpp"
+#include "game_config.hpp"
+#include "serialization/string_utils.hpp"
 #include <png.h>
 
 exploder_point::exploder_point(const std::string &s)
 {
-	std::vector<std::string> items = config::split(s);
+	std::vector<std::string> items = utils::split(s);
 	if(items.size() != 2) {
 		x = y = 0;
 	} else {
@@ -29,7 +29,7 @@
 
 exploder_rect::exploder_rect(const std::string &s)
 {
-	std::vector<std::string> items = config::split(s);
+	std::vector<std::string> items = utils::split(s);
 	if(items.size() != 4) {
 		x = y = w = h = 0;
 	} else {
Index: wesnoth/src/unit.cpp
diff -u wesnoth/src/unit.cpp:1.121 wesnoth/src/unit.cpp:1.122
--- wesnoth/src/unit.cpp:1.121	Wed Feb  9 23:32:01 2005
+++ wesnoth/src/unit.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: unit.cpp,v 1.121 2005/02/09 23:32:01 ydirson Exp $ */
+/* $Id: unit.cpp,v 1.122 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -507,7 +507,7 @@
 		if(std::find(type.begin(),type.end(),',') != type.end() &&
 		   std::search(type.begin(),type.end(),this_type.begin(),
 			           this_type.end()) != type.end()) {
-			const std::vector<std::string>& vals = config::split(type);
+			const std::vector<std::string>& vals = utils::split(type);
 
 			if(std::find(vals.begin(),vals.end(),this_type) == vals.end()) {
 				return false;
@@ -535,7 +535,7 @@
 	if(side.empty() == false && this->side() != atoi(side.c_str()))
 	  {
 		if(std::find(side.begin(),side.end(),',') != side.end()) {
-			const std::vector<std::string>& vals = config::split(side);
+			const std::vector<std::string>& vals = utils::split(side);
 
 			std::ostringstream s;
 			s << (this->side());
@@ -694,7 +694,7 @@
 		}
 	}
 
-	overlays_ = config::split(cfg["overlays"]);
+	overlays_ = utils::split(cfg["overlays"]);
 	if(overlays_.size() == 1 && overlays_.front() == "") {
 		overlays_.clear();
 	}
@@ -764,7 +764,7 @@
 	cfg.add_child("variables",variables_);
 	cfg.add_child("status",status_flags);
 
-	cfg["overlays"] = config::join(overlays_);
+	cfg["overlays"] = utils::join(overlays_);
 
 	cfg["user_description"] = description_;
 	cfg["description"] = underlying_description_;
@@ -1005,7 +1005,7 @@
 		//see if the effect only applies to certain unit types
 		const std::string& type_filter = (**i.first)["unit_type"];
 		if(type_filter.empty() == false) {
-			const std::vector<std::string>& types = config::split(type_filter);
+			const std::vector<std::string>& types = utils::split(type_filter);
 			if(std::find(types.begin(),types.end(),this->type().name()) == types.end()) {
 				continue;
 			}
Index: wesnoth/src/unit_types.cpp
diff -u wesnoth/src/unit_types.cpp:1.79 wesnoth/src/unit_types.cpp:1.80
--- wesnoth/src/unit_types.cpp:1.79	Sat Feb 19 09:26:31 2005
+++ wesnoth/src/unit_types.cpp	Sun Feb 20 21:45:21 2005
@@ -1,4 +1,4 @@
-/* $Id: unit_types.cpp,v 1.79 2005/02/19 09:26:31 isaaccp Exp $ */
+/* $Id: unit_types.cpp,v 1.80 2005/02/20 21:45:21 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -146,7 +146,7 @@
 		if(dir == "") {
 			animation_.push_back(unit_animation(**an));
 		} else {
-			const std::vector<std::string>& directions = config::split(dir);
+			const std::vector<std::string>& directions = utils::split(dir);
 			for(std::vector<std::string>::const_iterator i = directions.begin(); i != directions.end(); ++i) {
 				const gamemap::location::DIRECTION d = gamemap::location::parse_direction(*i);
 				if(d != gamemap::location::NDIRECTIONS) {
@@ -569,7 +569,7 @@
 		gender_types_[unit_race::FEMALE] = new unit_type(*female_cfg,mv_types,races,traits);
 	}
 
-	const std::vector<std::string> genders = config::split(cfg["gender"]);
+	const std::vector<std::string> genders = utils::split(cfg["gender"]);
 	for(std::vector<std::string>::const_iterator i = genders.begin();
 	    i != genders.end(); ++i) {
 		if(*i == "male") {
@@ -591,7 +591,7 @@
 		race_ = &dummy_race;
 	}
 
-	abilities_ = config::split(cfg_["ability"]);
+	abilities_ = utils::split(cfg_["ability"]);
 
 	//if the string was empty, split will give us one empty string in the list,
 	//remove it.
@@ -868,7 +868,7 @@
 	if(val == "null" || val == "")
 		return std::vector<std::string>();
 	else
-		return config::split(val);
+		return utils::split(val);
 }
 
 const std::string& unit_type::usage() const
Index: wesnoth/src/widgets/button.cpp
diff -u wesnoth/src/widgets/button.cpp:1.53 wesnoth/src/widgets/button.cpp:1.54
--- wesnoth/src/widgets/button.cpp:1.53	Thu Jan 20 22:49:46 2005
+++ wesnoth/src/widgets/button.cpp	Sun Feb 20 21:45:22 2005
@@ -1,4 +1,4 @@
-/* $Id: button.cpp,v 1.53 2005/01/20 22:49:46 silene Exp $ */
+/* $Id: button.cpp,v 1.54 2005/02/20 21:45:22 silene Exp $ */
 /*
    Copyright (C) 2003 by David White <davidnwhite@xxxxxxxxxxxxxxx>
    Part of the Battle for Wesnoth Project http://wesnoth.whitevine.net
@@ -192,7 +192,7 @@
 
 	//if we have a list of items, use the first one that isn't an image
 	if (std::find(label_.begin(), label_.end(), COLUMN_SEPARATOR) != label_.end()) {
-		const std::vector<std::string>& items = config::split(label_, COLUMN_SEPARATOR);
+		const std::vector<std::string>& items = utils::split(label_, COLUMN_SEPARATOR);
 		const std::vector<std::string>::const_iterator i = std::find_if(items.begin(),items.end(),not_image);
 		if(i != items.end()) {
 			label_ = *i;
Index: wesnoth/src/widgets/menu.cpp
diff -u wesnoth/src/widgets/menu.cpp:1.76 wesnoth/src/widgets/menu.cpp:1.77
--- wesnoth/src/widgets/menu.cpp:1.76	Thu Dec  2 22:21:45 2004
+++ wesnoth/src/widgets/menu.cpp	Sun Feb 20 21:45:22 2005
@@ -36,7 +36,7 @@
 {
 	for(std::vector<std::string>::const_iterator item = items.begin();
 	    item != items.end(); ++item) {
-		items_.push_back(config::quoted_split(*item, COLUMN_SEPARATOR, !strip_spaces));
+		items_.push_back(utils::quoted_split(*item, COLUMN_SEPARATOR, !strip_spaces));
 
 		//make sure there is always at least one item
 		if(items_.back().empty())
@@ -64,7 +64,7 @@
 			if(std::find(j->begin(),j->end(),static_cast<char>(HELP_STRING_SEPARATOR)) == j->end()) {
 				help_.back().push_back("");
 			} else {
-				const std::vector<std::string>& items = config::split(*j,HELP_STRING_SEPARATOR,0);
+				const std::vector<std::string>& items = utils::split(*j, HELP_STRING_SEPARATOR, 0);
 				if(items.size() >= 2) {
 					*j = items.front();
 					help_.back().push_back(items.back());
@@ -329,7 +329,7 @@
 namespace {
 	SDL_Rect item_size(const std::string& item) {
 		SDL_Rect res = {0,0,0,0};
-		std::vector<std::string> img_text_items = config::split(item, IMG_TEXT_SEPARATOR);
+		std::vector<std::string> img_text_items = utils::split(item, IMG_TEXT_SEPARATOR);
 		for (std::vector<std::string>::const_iterator it = img_text_items.begin();
 			 it != img_text_items.end(); it++) {
 			if (res.w > 0 || res.h > 0) {
@@ -406,7 +406,7 @@
 	for(size_t i = 0; i != items_[item].size(); ++i) {
 		const int last_x = xpos;
 		std::string str = items_[item][i];
-		std::vector<std::string> img_text_items = config::split(str, IMG_TEXT_SEPARATOR);
+		std::vector<std::string> img_text_items = utils::split(str, IMG_TEXT_SEPARATOR);
 		for (std::vector<std::string>::const_iterator it = img_text_items.begin();
 			 it != img_text_items.end(); it++) {
 			str = *it;



You are on the gna.org mail server.

Generated by mhonarc, Tue Sep 20 16:46:54 2005