]> git.lyx.org Git - lyx.git/blobdiff - src/support/lstrings.C
another safety belt
[lyx.git] / src / support / lstrings.C
index b0ca602de3762a13961ebd25276cb7b8d59197ce..b3d87cedaa21332d7b497a7c7ee8f77e2eb5502a 100644 (file)
@@ -447,8 +447,8 @@ bool regexMatch(string const & a, string const & pattern)
        string regex(pattern);
        regex = subst(regex, ".", "\\.");
        regex = subst(regex, "*", ".*");
-       boost::regex reg(regex);
-       return boost::regex_match(a, reg);
+       boost::regex reg(STRCONV(regex));
+       return boost::regex_match(STRCONV(a), reg);
 }
 
 
@@ -616,7 +616,10 @@ string const escape(string const & lab)
 vector<string> const getVectorFromString(string const & str,
                                         string const & delim)
 {
-#if 0
+// Lars would like this code to go, but for now his replacement (below)
+// doesn't fullfil the same function. I have, therefore, reactivated the
+// old code for now. Angus 11 Nov 2002.
+#if 1
        vector<string> vec;
        if (str.empty())
                return vec;
@@ -637,7 +640,20 @@ vector<string> const getVectorFromString(string const & str,
 #else
        boost::char_separator<char> sep(delim.c_str());
        boost::tokenizer<boost::char_separator<char> > tokens(str, sep);
+#ifndef USE_INCLUDED_STRING
        return vector<string>(tokens.begin(), tokens.end());
+#else
+       vector<string> vec;
+       using boost::tokenizer;
+       using boost::char_separator;
+
+       tokenizer<char_separator<char> >::iterator it = tokens.begin();
+       tokenizer<char_separator<char> >::iterator end = tokens.end();
+       for (; it != end; ++it) {
+               vec.push_back(STRCONV((*it)));
+       }
+       return vec;
+#endif
 #endif
 }