]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
fixes because of SUN CC warnings, bmtable now compiled with C compilator, countChar...
[lyx.git] / src / support / lstrings.h
index 1a06b945f9f14389b1760fafb69703f879af7dba..f1110316585ca268279ba6d4ec98c1560ffc334a 100644 (file)
@@ -10,6 +10,8 @@
 
 #include <cstring>
 
+#include "LAssert.h"
+
 //#warning verify this please. Lgb
 ///
 template<class T>
@@ -38,40 +40,12 @@ T * lstrchr(T const * t, int c)
 #include <cctype>
 #include "LString.h"
 
+
 ///
-inline int compare_no_case(string const & s, string const & s2)
-{
-       // ANSI C
-       string::const_iterator p = s.begin();
-       string::const_iterator p2 = s2.begin();
-
-       while (p != s.end() && p2 != s2.end()) {
-               if (tolower(*p) != tolower(*p2))
-                       return (tolower(*p) < tolower(*p2)) ? -1 : 1;
-               ++p;
-               ++p2;
-       }
-
-       return s.size() - s2.size();
-}
+int compare_no_case(string const & s, string const & s2);
 
 ///
-inline int compare_no_case(string const & s, string const & s2,
-                          unsigned int len)
-{
-//#warning verify this func please
-       string::const_iterator p = s.begin();
-       string::const_iterator p2 = s2.begin();
-       unsigned int i = 0;
-       while (i < len && p != s.end() && p2 != s2.end()) {
-               if (tolower(*p) != tolower(*p2))
-                       return (tolower(*p) < tolower(*p2)) ? -1 : 1;
-               ++i;
-               ++p;
-               ++p2;
-       }
-       return s.size() - s2.size();
-}
+int compare_no_case(string const & s, string const & s2, unsigned int len);
 
 ///
 inline int compare(char const * a, char const * b)
@@ -79,12 +53,14 @@ inline int compare(char const * a, char const * b)
        return strcmp(a, b);
 }
 
+
 ///
 inline int compare(char const * a, char const * b, unsigned int len)
 {
        return strncmp(a, b, len);
 }
 
+
 ///
 bool isStrInt(string const & str);
 
@@ -94,6 +70,9 @@ int strToInt(string const & str);
 ///
 string lowercase(string const &);
 
+///
+string uppercase(string const &);
+
 /// int to string
 string tostr(int i);
 
@@ -109,8 +88,8 @@ string tostr(unsigned long l);
 ///
 string tostr(char c);
 
-/// void* to string
-string tostr(void* v);
+/// void * to string
+string tostr(void * v);
 
 /// bool to string
 string tostr(bool b);
@@ -140,7 +119,7 @@ bool contains(string const & a, string const & b);
 bool contains(char const * a, char const * b);
 
 /// Counts how many of character c there is in a
-int countChar(string const & a, char const c);
+unsigned int countChar(string const & a, char const c);
 
 /** Extracts a token from this string at the nth delim.
   Doesn't modify the original string. Similar to strtok.
@@ -171,7 +150,7 @@ string subst(string const & a, char oldchar, char newchar);
 
 /// Substitutes all instances of oldstr with newstr
 string subst(string const & a,
-             char const * oldstr, string const & newstr);
+            char const * oldstr, string const & newstr);
 
 /** Strips characters off the end of a string.
   #"abccc".strip('c') = "ab".#