summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorReid <reidyaro@gmail.com>2011-08-24 22:42:17 +0200
committerReid <reidyaro@gmail.com>2011-08-24 22:42:17 +0200
commit43c19a8321bd0c4bcf36655d74e895397aff7eea (patch)
treec8f7933367ae1e757a3166a04772274896d58c9c /src/utils
parentc1ec2b921389cb5c44d9ae572ea4851891cf8bc9 (diff)
parent9505e3789cc9db6a10a68b9794a586604271b76f (diff)
downloadmanaverse-43c19a8321bd0c4bcf36655d74e895397aff7eea.tar.gz
manaverse-43c19a8321bd0c4bcf36655d74e895397aff7eea.tar.bz2
manaverse-43c19a8321bd0c4bcf36655d74e895397aff7eea.tar.xz
manaverse-43c19a8321bd0c4bcf36655d74e895397aff7eea.zip
Merge branch 'master' of gitorious.org:manaplus/manaplus
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mutex.h2
-rw-r--r--src/utils/stringutils.cpp17
-rw-r--r--src/utils/stringutils.h5
-rw-r--r--src/utils/xml.cpp2
4 files changed, 21 insertions, 5 deletions
diff --git a/src/utils/mutex.h b/src/utils/mutex.h
index f23ddc2aa..03dac2e7a 100644
--- a/src/utils/mutex.h
+++ b/src/utils/mutex.h
@@ -23,7 +23,7 @@
#ifndef MUTEX_H
#define MUTEX_H
-#include "log.h"
+#include "logger.h"
#include <SDL_thread.h>
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 13170092e..0243c4315 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -181,9 +181,9 @@ unsigned long findI(std::string str, std::string subStr)
return str.find(subStr);
}
-unsigned long findI(std::string str, std::vector<std::string> &list)
+unsigned long findI(std::string &text, std::vector<std::string> &list)
{
- str = toLower(str);
+ std::string str = toLower(text);
unsigned long idx;
for (std::vector<std::string>::iterator i = list.begin();
i != list.end(); ++i)
@@ -414,6 +414,19 @@ std::list<std::string> splitToStringList(const std::string &text,
return tokens;
}
+void splitToStringVector(std::vector<std::string> &tokens,
+ const std::string &text, char separator)
+{
+ std::stringstream ss(text);
+ std::string item;
+ while(std::getline(ss, item, separator))
+ {
+ item = trim(item);
+ if (!item.empty())
+ tokens.push_back(item);
+ }
+}
+
std::string combineDye(std::string file, std::string dye)
{
if (dye.empty())
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 94747d2fe..4fe6369e9 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -133,7 +133,7 @@ bool isWordSeparator(char chr);
unsigned long findI(std::string str, std::string subStr);
-unsigned long findI(std::string str, std::vector<std::string> &list);
+unsigned long findI(std::string &text, std::vector<std::string> &list);
const std::string encodeStr(unsigned int value, unsigned int size = 0);
@@ -176,6 +176,9 @@ std::list<int> splitToIntList(const std::string &text, char separator);
std::list<std::string> splitToStringList(const std::string &text,
char separator);
+void splitToStringVector(std::vector<std::string> &tokens,
+ const std::string &text, char separator);
+
std::string combineDye(std::string file, std::string dye);
std::string combineDye2(std::string file, std::string dye);
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index b31b60ee1..89457a4e8 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -22,7 +22,7 @@
#include "utils/xml.h"
-#include "log.h"
+#include "logger.h"
#include "resources/resourcemanager.h"