]> git.lyx.org Git - features.git/commitdiff
Move quoteArg to LyXLex so that it can be used e.g. for writing viewers to
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 12 Aug 2006 10:39:12 +0000 (10:39 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 12 Aug 2006 10:39:12 +0000 (10:39 +0000)
preferences
        * src/lyxfunc.C
        (quoteArg): move to LyXLex
        (LyXFunc::dispatch): adjust to the change above

        * src/lyxlex.[Ch]
        (quoteString): new, moved from lyxfunc.C

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14620 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxfunc.C
src/lyxlex.C
src/lyxlex.h

index 9f2a418c9ce0f1c265e261ad10f2d627faeab444..eff30115100cfb46d06f28c5a5de4c5afb402b4d 100644 (file)
@@ -199,15 +199,6 @@ Change::Type lookupChangeType(DocIterator const & dit, bool outer = false)
        return Change::UNCHANGED;
 }
 
-
-/// quotes a string for use as an argument of the "log" dialog
-string const quoteArg(string const & arg)
-{
-       ostringstream os;
-       os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"';
-       return os.str();
-}
-
 }
 
 LyXFunc::LyXFunc(LyXView * lv)
@@ -1184,11 +1175,11 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                        data = "literate ";
                                        break;
                                }
-                               data += quoteArg(logfile.second);
+                               data += LyXLex::quoteString(logfile.second);
                                owner->getDialogs().show("log", data);
                        } else if (name == "vclog") {
                                string const data = "vc " +
-                                       quoteArg(owner->buffer()->lyxvc().getLogFile());
+                                       LyXLex::quoteString(owner->buffer()->lyxvc().getLogFile());
                                owner->getDialogs().show("log", data);
                        } else
                                owner->getDialogs().show(name, data);
index 6758dc167d767a3632e2525785e5a0a6eaa6c6b4..4a84d7fcbe63bb1a307f0b2c3f7c24e1e720720f 100644 (file)
@@ -21,6 +21,8 @@
 #include "support/convert.h"
 #include "support/lstrings.h"
 
+#include <sstream>
+
 using lyx::support::compare_ascii_no_case;
 using lyx::support::isStrDbl;
 using lyx::support::isStrInt;
@@ -293,3 +295,12 @@ LyXLex & LyXLex::operator>>(bool & s)
        }
        return *this;
 }
+
+
+/// quotes a string, e.g. for use in preferences files or as an argument of the "log" dialog
+string const LyXLex::quoteString(string const & arg)
+{
+       std::ostringstream os;
+       os << '"' << subst(subst(arg, "\\", "\\\\"), "\"", "\\\"") << '"';
+       return os.str();
+}
index dc16b52b1a7a7a19c3f1764d72dbb123e70c02fa..384a03b4ad007f2be1dfe3ee7e68436c0a46b851 100644 (file)
@@ -140,6 +140,10 @@ public:
        /// extract bool
        LyXLex & operator>>(bool &);
 
+       /// Quotes a string so that reading it again with LyXLex::next(true)
+       /// gets the original string
+       static std::string const quoteString(std::string const &);
+
 private:
        class Pimpl;
        ///