namespace lyx {
namespace support {
-///
-int compare_no_case(std::string const & s, std::string const & s2);
+/// Compare \p s and \p s2, ignoring the case.
+/// Does not depend on the locale.
int compare_no_case(docstring const & s, docstring const & s2);
-///
+/// Compare \p s and \p s2, ignoring the case of ASCII characters only.
int compare_ascii_no_case(std::string const & s, std::string const & s2);
-///
+/// Compare \p s and \p s2, ignoring the case of ASCII characters only.
int compare_ascii_no_case(docstring const & s, docstring const & s2);
-///
-int compare_no_case(std::string const & s, std::string const & s2, unsigned int len);
-
///
inline
int compare(char const * a, char const * b)
int hexToInt(lyx::docstring const & str);
-///
+/// is \p str pure ascii?
+bool isAscii(docstring const & str);
+
+/**
+ * Changes the case of \p c to lowercase.
+ * Don't use this for non-ASCII characters, since it depends on the locale.
+ * This overloaded function is only implemented because the char_type variant
+ * would be used otherwise, and we assert in this function that \p c is in
+ * the ASCII range.
+ */
char lowercase(char c);
-///
+/**
+ * Changes the case of \p c to uppercase.
+ * Don't use this for non-ASCII characters, since it depends on the locale.
+ * This overloaded function is only implemented because the char_type variant
+ * would be used otherwise, and we assert in this function that \p c is in
+ * the ASCII range.
+ */
char uppercase(char c);
-/// changes the case only if c is a one-byte char
+/// Changes the case of \p c to lowercase.
+/// Does not depend on the locale.
char_type lowercase(char_type c);
-/// changes the case only if c is a one-byte char
+/// Changes the case of \p c to uppercase.
+/// Does not depend on the locale.
char_type uppercase(char_type c);
/// same as lowercase(), but ignores locale
std::string const ascii_lowercase(std::string const &);
+docstring const ascii_lowercase(docstring const &);
-///
-std::string const lowercase(std::string const &);
+/// Changes the case of \p s to lowercase.
+/// Does not depend on the locale.
+docstring const lowercase(docstring const & s);
-///
-std::string const uppercase(std::string const &);
+/// Changes the case of \p s to uppercase.
+/// Does not depend on the locale.
+docstring const uppercase(docstring const & s);
+
+/// Does the string start with this prefix?
+bool prefixIs(docstring const &, char_type);
/// Does the std::string start with this prefix?
bool prefixIs(std::string const &, std::string const &);
-bool prefixIs(lyx::docstring const &, lyx::docstring const &);
+bool prefixIs(docstring const &, docstring const &);
/// Does the string end with this char?
bool suffixIs(std::string const &, char);
+bool suffixIs(docstring const &, char_type);
/// Does the std::string end with this suffix?
bool suffixIs(std::string const &, std::string const &);
/// Same as split but uses the last delim.
std::string const rsplit(std::string const & a, std::string & piece, char delim);
-/// Escapes non ASCII chars
+/// Escapes non ASCII chars and other problematic characters that cause
+/// problems in latex labels.
docstring const escape(docstring const & lab);
/// gives a vector of stringparts which have the delimiter delim
std::vector<std::string> const getVectorFromString(std::string const & str,
std::string const & delim = std::string(","));
+std::vector<docstring> const getVectorFromString(docstring const & str,
+ docstring const & delim = from_ascii(","));
// the same vice versa
std::string const getStringFromVector(std::vector<std::string> const & vec,