]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
add onoff support for "inset-modify changetype xxx" in include inset
[lyx.git] / src / support / lstrings.h
index 9130f687c8b1c564faaa38c5d6c7c5eef929fdb0..67e840be32cada15a00184756263cc2c9d2dd6d7 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  * \author Jean-Marc Lasgouttes
  *
  * Full author contact details are available in file CREDITS.
@@ -107,7 +107,7 @@ bool suffixIs(docstring const &, char_type);
 bool suffixIs(std::string const &, std::string const &);
 bool suffixIs(docstring const &, docstring const &);
 
-///
+/// Is b contained in a?
 inline bool contains(std::string const & a, std::string const & b)
 {
        return a.find(b) != std::string::npos;
@@ -226,6 +226,24 @@ std::string const rsplit(std::string const & a, std::string & piece, char delim)
 /// problems in latex labels.
 docstring const escape(docstring const & lab);
 
+/// Word-wraps the provided docstring, returning a line-broken string
+/// of width no wider than width, with the string broken at spaces. 
+/// If the string cannot be broken appropriately, it returns something 
+/// with "..." at the end, again no wider than width.
+/// We assume here that str does not contain newlines.
+/// If indent is positive, then the first line is indented that many 
+/// spaces. If it is negative, then successive lines are indented, as
+/// if the first line were "outdented".
+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,
@@ -234,21 +252,16 @@ 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 "".
 int findToken(char const * const str[], std::string const & search_token);
 
-/// Convert internal line endings to line endings as expected by the OS
-docstring const externalLineEnding(docstring const & str);
-
-/// Convert line endings in any formnat to internal line endings
-docstring const internalLineEnding(docstring const & str);
-
-
 template <class Arg1>
 docstring bformat(docstring const & fmt, Arg1);