Rename utils::paranthetical_split()...

...to utils::parenthetical_split(). Patch by Espreon
This commit is contained in:
Alexander van Gessel 2010-05-24 02:45:45 +01:00
parent 191856f4ef
commit 15459fca86
6 changed files with 16 additions and 16 deletions

View file

@ -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

View file

@ -277,7 +277,7 @@ int add(int x, int y, const std::string& image, const map_location& loc,
{
const int id = halo_id++;
animated<image::locator>::anim_description image_vector;
std::vector<std::string> items = utils::paranthetical_split(image, ',');
std::vector<std::string> items = utils::parenthetical_split(image, ',');
std::vector<std::string>::const_iterator itor = items.begin();
for(; itor != items.end(); ++itor) {
const std::vector<std::string>& items = utils::split(*itor, ':');

View file

@ -450,10 +450,10 @@ surface locator::load_image_sub_file() const
// Regular functors
std::vector< image::function_base* > functor_queue;
const std::vector<std::string> modlist = utils::paranthetical_split(val_.modifications_,'~');
const std::vector<std::string> modlist = utils::parenthetical_split(val_.modifications_,'~');
foreach(const std::string& s, modlist) {
const std::vector<std::string> tmpmod = utils::paranthetical_split(s);
const std::vector<std::string> tmpmod = utils::parenthetical_split(s);
std::vector<std::string>::const_iterator j = tmpmod.begin();
while(j!= tmpmod.end()){
const std::string function = *j++;

View file

@ -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<char> 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"<<val<<"\n";;
ERR_GENERAL << "Mismatched parenthesis:\n"<<val<<"\n";;
}
return res;

View file

@ -59,10 +59,10 @@ enum { REMOVE_EMPTY = 0x01, /**< REMOVE_EMPTY : remove empty elements. */
std::vector< std::string > 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);

View file

@ -294,7 +294,7 @@ unit::unit(const config &cfg, bool use_traits, game_state* state) :
underlying_id_ = lexical_cast_default<size_t>(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();
}