Jean-Marc Lasgouttes wrote:

>>>>>> "Georg" == Georg Baum
>>>>>> <[EMAIL PROTECTED]>
>>>>>> writes:
>
> Georg> I prefer that.
> 
> OK, could you do it?

See attached. That goes in later today if nobody objects. I'll do the 1.4
backport then at once.


Georg

Log:

Move quoteArg to LyXLex so that it can be used e.g. for writing viewers to
preferences
        * src/lyxfunc.C
        (quoteArg): move to LyXLex
        (LyXFunc::dispatch): adjust to the change above

        * src/lyxlex.[Ch]
        (quoteString): new, moved from lyxfunc.C
Index: src/lyxlex.h
===================================================================
--- src/lyxlex.h	(Revision 14612)
+++ src/lyxlex.h	(Arbeitskopie)
@@ -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;
 	///
Index: src/lyxfunc.C
===================================================================
--- src/lyxfunc.C	(Revision 14612)
+++ src/lyxfunc.C	(Arbeitskopie)
@@ -199,15 +199,6 @@ Change::Type lookupChangeType(DocIterato
 	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
 					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: src/lyxlex.C
===================================================================
--- src/lyxlex.C	(Revision 14612)
+++ src/lyxlex.C	(Arbeitskopie)
@@ -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();
+}

Reply via email to