]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
Fix bugs #6078 and #9364
[lyx.git] / src / support / lstrings.h
index 576a5b921df363639c09e6cbc13d21b4123a1445..395e18e04d3f633e867a740cfa132faf2c42233c 100644 (file)
@@ -28,6 +28,9 @@ namespace support {
 /// Does not depend on the locale.
 int compare_no_case(docstring const & s, docstring const & s2);
 
+/// Compare \p s and \p s2 using the collating rules of the current locale.
+int compare_locale(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);
 
@@ -196,6 +199,14 @@ int count_char(std::string const & str, char chr);
 /// Count all occurences of char \a chr inside \a str
 int count_char(docstring const & str, docstring::value_type chr);
 
+/** Count all occurences of binary chars inside \a str.
+    It is assumed that \a str is utf-8 encoded and that a binary char
+    belongs to the unicode class names Zl, Zp, Cc, Cf, Cs, Co, or Cn
+    (excluding white space characters such as '\t', '\n', '\v', '\f', '\r').
+    See http://www.unicode.org/Public/6.2.0/ucd/UnicodeData.txt
+*/
+int count_bin_chars(std::string const & str);
+
 /** Trims characters off the end and beginning of a string.
     \code
     trim("ccabccc", "c") == "ab".
@@ -291,6 +302,15 @@ docstring const getStringFromVector(std::vector<docstring> const & vec,
 /// found, else -1. The last item in \p str must be "".
 int findToken(char const * const str[], std::string const & search_token);
 
+
+/// Format a floating point number with at least 6 siginificant digits, but
+/// without scientific notation.
+/// Scientific notation would be invalid in some contexts, such as lengths for
+/// LaTeX. Simply using std::ostream with std::fixed would produce results
+/// like "1000000.000000", and precision control would not be that easy either.
+std::string formatFPNumber(double);
+
+
 template <class Arg1>
 docstring bformat(docstring const & fmt, Arg1);