]> git.lyx.org Git - features.git/commitdiff
Move tex2lyx dummy implementations in their own file.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 21 Aug 2013 10:20:20 +0000 (12:20 +0200)
committerVincent van Ravesteijn <vfr@lyx.org>
Sun, 29 Sep 2013 13:26:13 +0000 (15:26 +0200)
Also try to document their use.

src/tex2lyx/Makefile.am
src/tex2lyx/dummy_impl.cpp [new file with mode: 0644]
src/tex2lyx/tex2lyx.cpp

index 2cbe65808254c09eecf77f97481148549afdfaff..5b933a8d2f414b313a6305fc41bb62e931239a51 100644 (file)
@@ -97,6 +97,7 @@ tex2lyx_SOURCES = \
        boost.cpp \
        Context.cpp \
        Context.h \
+       dummy_impl.cpp \
        math.cpp \
        Parser.cpp \
        Parser.h \
diff --git a/src/tex2lyx/dummy_impl.cpp b/src/tex2lyx/dummy_impl.cpp
new file mode 100644 (file)
index 0000000..b20db6d
--- /dev/null
@@ -0,0 +1,125 @@
+/**
+ * \file dummy_impl.cpp
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Jean-Marc Lasgouttes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+/**
+ * This file contains dummy implementation of some methods that are
+ * needed byclasses used by tex2lyx. This allows to reduce the number
+ * of classes we have to link against.
+*/
+
+// {[(
+
+#include <config.h>
+
+#include "Format.h"
+#include "LaTeXFeatures.h"
+#include "LyXRC.h"
+
+#include "support/Messages.h"
+
+#include <iostream>
+
+using namespace std;
+
+namespace lyx {
+
+//
+// Dummy Alert support (needed by TextClass)
+//
+
+
+namespace frontend {
+namespace Alert {
+       void warning(docstring const & title, docstring const & message,
+                                bool const &)
+       {
+               cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
+       }
+}
+}
+
+
+//
+// Dummy TexRow support (needed by docstream)
+//
+
+
+void TexRow::newline()
+{}
+
+
+void TexRow::newlines(int)
+{}
+
+
+//
+// Dummy LyXRC support
+//
+
+LyXRC lyxrc;
+
+/** Note that some variables are not initialized correctly. Hopefully
+ * they are not used in our code (currently valgrind does not complain).
+ * Linking against the full LyXRC.cpp forces us to pull too much
+ * stuff.
+ */
+LyXRC::LyXRC()
+{}
+
+
+//
+// Dummy translation support (needed at many places)
+//
+
+
+Messages messages_;
+Messages const & getMessages(string const &)
+{
+       return messages_;
+}
+
+
+Messages const & getGuiMessages()
+{
+       return messages_;
+}
+
+
+//
+// Dummy formats support (needed by Lexer)
+//
+
+Formats formats;
+
+bool Formats::isZippedFile(support::FileName const&) const
+{
+       return false;
+}
+
+
+//
+// Dummy features support (needed by ModuleList)
+//
+
+
+bool LaTeXFeatures::isAvailable(string const &)
+{
+       return true;
+}
+
+
+//
+// Keep the linker happy on Windows
+//
+
+void lyx_exit(int)
+{}
+
+}
index f750f424c26846748ccf8ba34f3afcfb003f0bd1..8772d6bea735e3630ab04782ebfd6f435b28b68b 100644 (file)
@@ -17,8 +17,6 @@
 
 #include "Context.h"
 #include "Encoding.h"
-#include "Format.h"
-#include "LaTeXFeatures.h"
 #include "Layout.h"
 #include "LayoutFile.h"
 #include "LayoutModuleList.h"
@@ -31,7 +29,6 @@
 #include "support/filetools.h"
 #include "support/lassert.h"
 #include "support/lstrings.h"
-#include "support/Messages.h"
 #include "support/os.h"
 #include "support/Package.h"
 #include "support/Systemcall.h"
@@ -50,69 +47,6 @@ using namespace lyx::support::os;
 
 namespace lyx {
 
-namespace frontend {
-namespace Alert {
-       void warning(docstring const & title, docstring const & message,
-                                bool const &)
-       {
-               cerr << to_utf8(title) << "\n" << to_utf8(message) << endl;
-       }
-}
-}
-
-
-// Dummy texrow support
-void TexRow::newline()
-{}
-
-
-void TexRow::newlines(int)
-{}
-
-
-// Dummy LyXRC support
-class LyXRC {
-public:
-       string icon_set;
-} lyxrc;
-
-
-// Dummy translation support
-Messages messages_;
-Messages const & getMessages(string const &)
-{
-       return messages_;
-}
-
-
-Messages const & getGuiMessages()
-{
-       return messages_;
-}
-
-
-// tex2lyx does not read lyxrc and therefore can't really check for
-// zipped formats (Used by lexer)
-
-Formats formats;
-
-bool Formats::isZippedFile(FileName const&) const
-{
-       return false;
-}
-
-
-bool LaTeXFeatures::isAvailable(string const &)
-{
-       return true;
-}
-
-
-// Keep the linker happy on Windows
-void lyx_exit(int)
-{}
-
-
 string const trimSpaceAndEol(string const & a)
 {
        return trim(a, " \t\n\r");