From 15459fca8639c355f1faed9c91a298b053f3fd48 Mon Sep 17 00:00:00 2001 From: Alexander van Gessel Date: Mon, 24 May 2010 02:45:45 +0100 Subject: [PATCH] Rename utils::paranthetical_split()... ...to utils::parenthetical_split(). Patch by Espreon --- src/ai/manager.cpp | 2 +- src/halo.cpp | 2 +- src/image.cpp | 4 ++-- src/serialization/string_utils.cpp | 12 ++++++------ src/serialization/string_utils.hpp | 10 +++++----- src/unit.cpp | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/ai/manager.cpp b/src/ai/manager.cpp index a47231ac26a..9117c87cc54 100644 --- a/src/ai/manager.cpp +++ b/src/ai/manager.cpp @@ -501,7 +501,7 @@ const std::string manager::internal_evaluate_command( side_number side, const st }; - std::vector< std::string > cmd = utils::paranthetical_split(str, ' ',"'","'"); + std::vector< std::string > cmd = utils::parenthetical_split(str, ' ',"'","'"); if (cmd.size()==3){ //!add_ai side file diff --git a/src/halo.cpp b/src/halo.cpp index 10dc708ef69..0f010e30af0 100644 --- a/src/halo.cpp +++ b/src/halo.cpp @@ -277,7 +277,7 @@ int add(int x, int y, const std::string& image, const map_location& loc, { const int id = halo_id++; animated::anim_description image_vector; - std::vector items = utils::paranthetical_split(image, ','); + std::vector items = utils::parenthetical_split(image, ','); std::vector::const_iterator itor = items.begin(); for(; itor != items.end(); ++itor) { const std::vector& items = utils::split(*itor, ':'); diff --git a/src/image.cpp b/src/image.cpp index 916f44896e1..0d67c03061c 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -450,10 +450,10 @@ surface locator::load_image_sub_file() const // Regular functors std::vector< image::function_base* > functor_queue; - const std::vector modlist = utils::paranthetical_split(val_.modifications_,'~'); + const std::vector modlist = utils::parenthetical_split(val_.modifications_,'~'); foreach(const std::string& s, modlist) { - const std::vector tmpmod = utils::paranthetical_split(s); + const std::vector tmpmod = utils::parenthetical_split(s); std::vector::const_iterator j = tmpmod.begin(); while(j!= tmpmod.end()){ const std::string function = *j++; diff --git a/src/serialization/string_utils.cpp b/src/serialization/string_utils.cpp index 7fa85166e7d..d83334a0f16 100644 --- a/src/serialization/string_utils.cpp +++ b/src/serialization/string_utils.cpp @@ -107,13 +107,13 @@ std::vector< std::string > split(std::string const &val, char c, int flags) return res; } -std::vector< std::string > paranthetical_split(std::string const &val, +std::vector< std::string > parenthetical_split(std::string const &val, const char separator, std::string const &left, std::string const &right,int flags) { std::vector< std::string > res; std::vector part; - bool in_paranthesis = false; + bool in_parenthesis = false; std::string::const_iterator i1 = val.begin(); std::string::const_iterator i2 = val.begin(); @@ -127,7 +127,7 @@ std::vector< std::string > paranthetical_split(std::string const &val, } while (i2 != val.end()) { - if(!in_paranthesis && separator && *i2 == separator){ + if(!in_parenthesis && separator && *i2 == separator){ std::string new_val(i1, i2); if (flags & STRIP_SPACES) strip(new_val); @@ -152,7 +152,7 @@ std::vector< std::string > paranthetical_split(std::string const &val, i1=i2; }else{ if (part.empty()) - in_paranthesis = false; + in_parenthesis = false; ++i2; } continue; @@ -178,7 +178,7 @@ std::vector< std::string > paranthetical_split(std::string const &val, if(!found){ ++i2; } else - in_paranthesis = true; + in_parenthesis = true; } std::string new_val(i1, i2); @@ -188,7 +188,7 @@ std::vector< std::string > paranthetical_split(std::string const &val, res.push_back(new_val); if(!part.empty()){ - ERR_GENERAL << "Mismatched paranthesis:\n"< split(std::string const &val, char c = ',', int flags = REMOVE_EMPTY | STRIP_SPACES); /** - * Splits a string based either on a separator where text within paranthesis + * Splits a string based either on a separator where text within parenthesis * is protected from splitting (Note that one can use the same character for - * both the left and right paranthesis. In this mode it usually makes only - * sense to have one character for the left and right paranthesis.) + * both the left and right parenthesis. In this mode it usually makes only + * sense to have one character for the left and right parenthesis.) * or if the separator == 0 it splits a string into an odd number of parts: * - The part before the first '(', * - the part between the first '(' @@ -75,10 +75,10 @@ std::vector< std::string > split(std::string const &val, char c = ',', int flags * an empty elements are never removed as they are placeholders. * hence REMOVE EMPTY only works for the separator split. * - * paranthetical_split("a(b)c{d}e(f{g})h",0,"({",")}") should return + * parenthetical_split("a(b)c{d}e(f{g})h",0,"({",")}") should return * a vector of <"a","b","c","d","e","f{g}","h"> */ -std::vector< std::string > paranthetical_split(std::string const &val, +std::vector< std::string > parenthetical_split(std::string const &val, const char separator = 0 , std::string const &left="(", std::string const &right=")",int flags = REMOVE_EMPTY | STRIP_SPACES); diff --git a/src/unit.cpp b/src/unit.cpp index ec8dde6ae5d..64f064140fb 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -294,7 +294,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) : underlying_id_ = lexical_cast_default(cfg["underlying_id"],0); set_underlying_id(); - overlays_ = utils::paranthetical_split(cfg["overlays"], ','); + overlays_ = utils::parenthetical_split(cfg["overlays"], ','); if(overlays_.size() == 1 && overlays_.front() == "") { overlays_.clear(); }