]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
tiger support on mac snow leopard, include Qt4 frameworks, smart build script with...
[lyx.git] / src / support / lstrings.h
index 486244180c0f9a66953b1bbaa6731d581d4d5a02..5acd0d247d44abc18418b2bce82baebf5d327d5e 100644 (file)
@@ -44,6 +44,9 @@ bool isStrUnsignedInt(std::string const & str);
 ///
 bool isStrDbl(std::string const & str);
 
+/// does the string contain a digit?
+bool hasDigit(docstring const & str);
+
 bool isHex(docstring const & str);
 
 int hexToInt(docstring const & str);
@@ -202,7 +205,7 @@ std::string const ltrim(std::string const & a, char const * p = " ");
 docstring const ltrim(docstring const & a, char const * p = " ");
 
 /** Splits the string given in the first argument at the first occurence 
-    of the third argumnent, delim.
+    of the third argument, delim.
     What precedes delim is returned in the second argument, piece; this
     will be the whole of the string if no delimiter is found.
     The return value is what follows delim, if anything. So the return
@@ -221,6 +224,7 @@ std::string const split(std::string const & a, char delim);
 
 /// Same as split but uses the last delim.
 std::string const rsplit(std::string const & a, std::string & piece, char delim);
+docstring const rsplit(docstring const & a, char_type delim);
 
 /// Escapes non ASCII chars and other problematic characters that cause
 /// problems in latex labels.
@@ -237,6 +241,13 @@ docstring const escape(docstring const & lab);
 docstring wrap(docstring const & str, int const indent = 0,
                size_t const width = 80);
 
+/// Like the preceding, except it is intended to operate on strings
+/// that may contain embedded newlines.
+/// \param numlines Don't return more than numlines lines. If numlines
+///    is 0, we return everything.
+docstring wrapParas(docstring const & str, int const indent = 0,
+                    size_t const width = 80, size_t const maxlines = 10);
+
 /// gives a vector of stringparts which have the delimiter delim
 /// If \p keepempty is true, empty strings will be pushed to the vector as well
 std::vector<std::string> const getVectorFromString(std::string const & str,
@@ -245,9 +256,11 @@ std::vector<std::string> const getVectorFromString(std::string const & str,
 std::vector<docstring> const getVectorFromString(docstring const & str,
                docstring const & delim = from_ascii(","), bool keepempty = false);
 
-// the same vice versa
+/// the same vice versa
 std::string const getStringFromVector(std::vector<std::string> const & vec,
                                 std::string const & delim = std::string(","));
+docstring const getStringFromVector(std::vector<docstring> const & vec,
+                                docstring const & delim = from_ascii(","));
 
 /// Search \p search_token in \p str and return the position if it is
 /// found, else -1. The last item in \p str must be "".
@@ -272,6 +285,7 @@ template<> docstring bformat(docstring const & fmt, unsigned int arg1);
 template<> docstring bformat(docstring const & fmt, docstring arg1);
 template<> docstring bformat(docstring const & fmt, char * arg1);
 template<> docstring bformat(docstring const & fmt, docstring arg1, docstring arg2);
+template<> docstring bformat(docstring const & fmt, docstring arg1, int arg2);
 template<> docstring bformat(docstring const & fmt, char const * arg1, docstring arg2);
 template<> docstring bformat(docstring const & fmt, int arg1, int arg2);
 template<> docstring bformat(docstring const & fmt, docstring arg1, docstring arg2, docstring arg3);