]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.h
Check return value of regex_match instead of looking at first match
[lyx.git] / src / support / lstrings.h
index ac310c59c43dcc598e6a6016c447e91a0bc274d2..36ba09fcb973b95fb5f8a4856b6dc75e9dbb957f 100644 (file)
@@ -151,8 +151,11 @@ inline bool contains(docstring const & a, char_type b)
        return a.find(b) != docstring::npos;
 }
 
-///
+/// Returns true if the first argument is made of ascii chars given in the
+/// second argument.
 bool containsOnly(std::string const &, std::string const &);
+///
+bool containsOnly(docstring const &, std::string const &);
 
 /** Extracts a token from this string at the nth delim.
     Doesn't modify the original string. Similar to strtok.
@@ -266,6 +269,10 @@ docstring const rsplit(docstring const & a, char_type delim);
 /// problems in latex labels.
 docstring const escape(docstring const & lab);
 
+/// Group contents of an argument if needed
+docstring const protectArgument(docstring & arg, char const l = '[',
+                         char const r = ']');
+
 /// Truncates a string with an ellipsis at the end.  Leaves str unchanged and
 /// returns false if it is shorter than len. Otherwise resizes str to len, with
 /// U+2026 HORIZONTAL ELLIPSIS at the end, and returns true.
@@ -342,33 +349,20 @@ int findToken(char const * const str[], std::string const & search_token);
 std::string formatFPNumber(double);
 
 
-template <class Arg1>
-docstring bformat(docstring const & fmt, Arg1);
-
-template <class Arg1, class Arg2>
-docstring bformat(docstring const & fmt, Arg1, Arg2);
-
-template <class Arg1, class Arg2, class Arg3>
-docstring bformat(docstring const & fmt, Arg1, Arg2, Arg3);
-
-template <class Arg1, class Arg2, class Arg3, class Arg4>
-docstring bformat(docstring const & fmt, Arg1, Arg2, Arg3, Arg4);
-
-
-template<> docstring bformat(docstring const & fmt, int arg1);
-template<> docstring bformat(docstring const & fmt, long arg1);
+docstring bformat(docstring const & fmt, int arg1);
+docstring bformat(docstring const & fmt, long arg1);
 #ifdef LYX_USE_LONG_LONG
-template<> docstring bformat(docstring const & fmt, long long arg1);
+docstring bformat(docstring const & fmt, long long arg1);
 #endif
-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);
-template<> docstring bformat(docstring const & fmt, docstring arg1, docstring arg2, docstring arg3, docstring arg4);
+docstring bformat(docstring const & fmt, unsigned int arg1);
+docstring bformat(docstring const & fmt, docstring const & arg1);
+docstring bformat(docstring const & fmt, char * arg1);
+docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2);
+docstring bformat(docstring const & fmt, docstring const & arg1, int arg2);
+docstring bformat(docstring const & fmt, char const * arg1, docstring const & arg2);
+docstring bformat(docstring const & fmt, int arg1, int arg2);
+docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2, docstring const & arg3);
+docstring bformat(docstring const & fmt, docstring const & arg1, docstring const & arg2, docstring const & arg3, docstring const & arg4);
 
 
 } // namespace support