Common: Eliminated side-effect version of split

This commit is contained in:
Paul Beckingham 2015-12-20 16:39:49 -05:00
parent 1e6412bcb1
commit d4d3ec4988
3 changed files with 1 additions and 22 deletions

View file

@ -127,8 +127,7 @@ Color::Color (const std::string& spec)
: _value (0) : _value (0)
{ {
// Split spec into words. // Split spec into words.
std::vector <std::string> words; std::vector <std::string> words = split (spec, ' ');
split (words, spec, ' ');
// Construct the color as two separate colors, then blend them later. This // Construct the color as two separate colors, then blend them later. This
// make it possible to declare a color such as "color1 on black", and have // make it possible to declare a color such as "color1 on black", and have

View file

@ -47,25 +47,6 @@ std::vector <std::string> split (const std::string& input, const char delimiter)
return results; return results;
} }
////////////////////////////////////////////////////////////////////////////////
void split (
std::vector<std::string>& results,
const std::string& input,
const char delimiter)
{
results.clear ();
std::string::size_type start = 0;
std::string::size_type i;
while ((i = input.find (delimiter, start)) != std::string::npos)
{
results.push_back (input.substr (start, i - start));
start = i + 1;
}
if (input.length ())
results.push_back (input.substr (start));
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
const std::string format (std::string& value) const std::string format (std::string& value)
{ {

View file

@ -33,7 +33,6 @@
// text.cpp, Non-UTF-8 aware. // text.cpp, Non-UTF-8 aware.
std::vector <std::string> split (const std::string&, const char); std::vector <std::string> split (const std::string&, const char);
void split (std::vector<std::string>&, const std::string&, const char);
const std::string format (std::string&); const std::string format (std::string&);
const std::string format (const char*); const std::string format (const char*);
const std::string formatHex (int); const std::string formatHex (int);