]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
fix typo that put too many include paths for most people
[lyx.git] / src / support / lstrings.h
index 2477b1fff6ff1928a0f103e24df68d90340d6dae..7f78c374a82834b9f6ef6f328c23540cb3d21110 100644 (file)
@@ -17,7 +17,7 @@
 #endif
 
 //#include <cstring>
-#include <cctype>
+//#include <cctype>
 
 #include "Lsstream.h"
 
@@ -27,6 +27,9 @@
 ///
 int compare_no_case(string const & s, string const & s2);
 
+///
+int compare_ascii_no_case(string const & s, string const & s2);
+
 ///
 int compare_no_case(string const & s, string const & s2, unsigned int len);
 
@@ -38,7 +41,7 @@ int compare(char const * a, char const * b)
        return std::strcmp(a, b);
 #else
        return strcmp(a, b);
-#endif 
+#endif
 }
 
 ///
@@ -49,7 +52,7 @@ int compare(char const * a, char const * b, unsigned int len)
        return std::strncmp(a, b, len);
 #else
        return strncmp(a, b, len);
-#endif 
+#endif
 }
 
 ///
@@ -70,10 +73,10 @@ bool isStrDbl(string const & str);
 ///
 double strToDbl(string const & str);
 
-/// 
+///
 char lowercase(char c);
 
-/// 
+///
 char uppercase(char c);
 
 ///
@@ -85,7 +88,7 @@ string const uppercase(string const &);
 /// convert \a T to string
 template<typename T>
 inline
-string const tostr(T const & t) 
+string const tostr(T const & t)
 {
        ostringstream ostr;
        ostr << t;
@@ -142,6 +145,19 @@ bool contains(string const & a, char b);
 ///
 bool contains(char const * a, char const * b);
 
+/// This should probably we rewritten to be more general.
+class contains_functor {
+public:
+       typedef string first_argument_type;
+       typedef string second_argument_type;
+       typedef bool result_type;
+
+       bool operator()(string const & haystack, string const & needle) const {
+               return contains(haystack, needle);
+       }
+};
+
+
 ///
 bool containsOnly(string const &, char const *);
 
@@ -154,9 +170,6 @@ bool containsOnly(char const *, char const *);
 ///
 bool containsOnly(char const *, string const &);
 
-/// Counts how many of character c there is in a
-string::size_type countChar(string const & a, char c);
-
 /** Extracts a token from this string at the nth delim.
     Doesn't modify the original string. Similar to strtok.
     Example:
@@ -170,7 +183,7 @@ string const token(string const & a, char delim, int n);
 
 /** Search a token in this string using the delim.
     Doesn't modify the original string. Returns -1 in case of
-    failure. 
+    failure.
     Example:
     \code
     "a;bc;d".tokenPos(';', "bc") == 1;
@@ -234,4 +247,7 @@ string const split(string const & a, char delim);
 /// Same as split but uses the last delim.
 string const rsplit(string const & a, string & piece, char delim);
 
+/// Escapes non ASCII chars
+string const escape(string const & lab);
+
 #endif