]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.C
the freespacing patch from Kayvan, draw the math empty delim with onoffdash, asure...
[lyx.git] / src / support / lstrings.C
index 06875d2159097c8322a1233b83991582abdf5471..6ac6cbb2931d134151e8990b6487e66c445c3f7c 100644 (file)
@@ -1,8 +1,12 @@
 #include <config.h>
 
 #include <algorithm>
+
+#ifdef __GLIBCPP__
+#include <ctype.h>
+#else
 #include <cctype>
-#include <cstdio>
+#endif
 #include <cstdlib>
 
 #include "LString.h"
 
 using std::count;
 using std::transform;
+using std::tolower;
+using std::toupper;
 
+       
 int compare_no_case(string const & s, string const & s2)
 {
        // ANSI C
@@ -34,6 +41,7 @@ int compare_no_case(string const & s, string const & s2)
        return 1;
 }
 
+
 int compare_no_case(string const & s, string const & s2, unsigned int len)
 {
 //#warning verify this func please
@@ -56,6 +64,7 @@ int compare_no_case(string const & s, string const & s2, unsigned int len)
        return 1;
 }
 
+
 bool isStrInt(string const & str)
 {
        if (str.empty()) return false;
@@ -90,7 +99,15 @@ int  strToInt(string const & str)
 string lowercase(string const & a)
 {
        string tmp(a);
-       transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+//#ifdef __GLIBCPP__
+       string::iterator result = tmp.begin();
+       for (string::iterator first = tmp.begin();
+            first != tmp.end(); ++first, ++result) {
+               *result = tolower(*first);
+       }
+//#else
+//     transform(tmp.begin(), tmp.end(), tmp.begin(), tolower);
+//#endif
        return tmp;
 }
 
@@ -98,68 +115,19 @@ string lowercase(string const & a)
 string uppercase(string const & a)
 {
        string tmp(a);
-       transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+//#ifdef __GLIBCPP__
+       string::iterator result = tmp.begin();
+       for (string::iterator first = tmp.begin();
+            first != tmp.end(); ++first, ++result) {
+               *result = toupper(*first);
+       }
+//#else
+//     transform(tmp.begin(), tmp.end(), tmp.begin(), toupper);
+//#endif
        return tmp;
 }
 
 
-string tostr(long i)
-{
-       // should use string stream
-       char str[30];
-       sprintf(str, "%ld", i);
-       return string(str);
-}
-
-
-string tostr(unsigned long i)
-{
-       // should use string stream
-       char str[30];
-       sprintf(str, "%lu", i);
-       return string(str);
-}
-
-
-string tostr(void * v)
-{
-       return tostr(long(v));
-}
-
-
-string tostr(int i)
-{
-       return tostr(long(i));
-}
-
-
-string tostr(unsigned int ui)
-{
-       return tostr(long(ui));
-}
-
-
-string tostr(char c)
-{
-       return string(1, c);
-}
-
-
-string tostr(bool b)
-{
-       return b ? "true" : "false";
-}
-
-
-string tostr(double d)
-{
-       // should use string stream
-       char tmp[40];
-       sprintf(tmp, "%f", d);
-       return string(tmp);
-}
-
-
 bool prefixIs(string const & a, char const * pre)
 {
        unsigned int l = strlen(pre);