Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-05-26 16:34:39 +0000
committerStijn Buys <ingar@osirion.org>2008-05-26 16:34:39 +0000
commitf71901eeab126bb4b7e2552dd2edf0b34632c683 (patch)
tree32e13b554bb5415d6f54d88a0826c52ec73e3801 /src/auxiliary
parentf7283b2b9a9bf305ac110ef00cd5c21d5304bfbb (diff)
radar, aux text functions, restore original frustum, documentation update
Diffstat (limited to 'src/auxiliary')
-rw-r--r--src/auxiliary/functions.cc32
-rw-r--r--src/auxiliary/functions.h7
2 files changed, 39 insertions, 0 deletions
diff --git a/src/auxiliary/functions.cc b/src/auxiliary/functions.cc
index b417a4a..e9861ac 100644
--- a/src/auxiliary/functions.cc
+++ b/src/auxiliary/functions.cc
@@ -64,6 +64,38 @@ size_t text_length(const std::string &text)
return len;
}
+const std::string text_strip(const std::string &text)
+{
+ const char *c = text.c_str();
+ std::string r;
+ while (*c) {
+ if (is_color_code(c)) {
+ c++;
+ } else {
+ r += *c;
+ }
+ c++;
+ }
+
+ return r;
+}
+
+const std::string text_strip_lowercase(const std::string &text)
+{
+ const char *c = text.c_str();
+ std::string r;
+ while (*c) {
+ if (is_color_code(c)) {
+ c++;
+ } else {
+ r += tolower(*c);
+ }
+ c++;
+ }
+
+ return r;
+}
+
const std::string spaces(const std::string &text,size_t n)
{
size_t l = text_length(text);
diff --git a/src/auxiliary/functions.h b/src/auxiliary/functions.h
index 2202b87..90eb2ed 100644
--- a/src/auxiliary/functions.h
+++ b/src/auxiliary/functions.h
@@ -42,6 +42,13 @@ void to_lowercase(std::string &text);
/// return text, converted to lowercase
const std::string lowercase(const std::string &text);
+
+/// return text, stripped of color codes
+const std::string text_strip(const std::string &text);
+
+/// return text, stripped of color codes and converted to lowercase
+const std::string text_strip_lowercase(const std::string &text);
+
}
#endif // __INCLUDED_AUX_FUNCTIONS_H__