From f228e412032ef6e82121168863f4313fc82e440d Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 4 Sep 2003 01:44:16 +0000 Subject: [PATCH] Move #include "lyxlib.h" out of Path.h, move ctor, dtor out of line. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7657 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 4 ++++ src/Chktex.C | 5 +++-- src/converter.C | 1 + src/insets/insetexternal.C | 3 ++- src/lyx_cb.C | 3 ++- src/support/ChangeLog | 4 ++++ src/support/path.C | 23 +++++++++++++++++++++++ src/support/path.h | 21 ++++----------------- 8 files changed, 43 insertions(+), 21 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 20af09203c..4b6508609d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-09-04 Angus Leeming + + * Chktex.C, converter.C, lyx_cb.C: add #include "support/lyxlib.h". + 2003-09-03 Lars Gullik Bjønnes * lyxfunc.C (dispatch): if fitCursor did something be sure to diff --git a/src/Chktex.C b/src/Chktex.C index 5e2fe5ce6a..33e9d2e683 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -18,9 +18,10 @@ #include "support/FileInfo.h" #include "support/filetools.h" -#include "support/systemcall.h" -#include "support/path.h" #include "support/lstrings.h" +#include "support/lyxlib.h" +#include "support/path.h" +#include "support/systemcall.h" #include "support/BoostFormat.h" diff --git a/src/converter.C b/src/converter.C index f5a6c8ffde..a3e5c6518e 100644 --- a/src/converter.C +++ b/src/converter.C @@ -28,6 +28,7 @@ #include "support/filetools.h" #include "support/lyxfunctional.h" +#include "support/lyxlib.h" #include "support/path.h" #include "support/tostr.h" #include "support/systemcall.h" diff --git a/src/insets/insetexternal.C b/src/insets/insetexternal.C index 5681bd9a22..11c0eaec2c 100644 --- a/src/insets/insetexternal.C +++ b/src/insets/insetexternal.C @@ -36,6 +36,7 @@ #include "support/forkedcall.h" #include "support/lstrings.h" #include "support/lyxalgo.h" +#include "support/lyxlib.h" #include "support/path.h" #include "support/path_defines.h" #include "support/tostr.h" @@ -463,7 +464,7 @@ void InsetExternal::validate(LaTeXFeatures & features) const features.require(cit->second.requirement); } if (!cit->second.preamble.empty()) { - features.addExternalPreamble(cit->second.preamble + "\n"); + features.addExternalPreamble(cit->second.preamble); } } diff --git a/src/lyx_cb.C b/src/lyx_cb.C index 2699d8156d..79a930170b 100644 --- a/src/lyx_cb.C +++ b/src/lyx_cb.C @@ -38,10 +38,11 @@ #include "support/FileInfo.h" #include "support/filetools.h" #include "support/forkedcall.h" +#include "support/lstrings.h" +#include "support/lyxlib.h" #include "support/path.h" #include "support/path_defines.h" #include "support/systemcall.h" -#include "support/lstrings.h" #include #include diff --git a/src/support/ChangeLog b/src/support/ChangeLog index e1758f560d..0e21781ea9 100644 --- a/src/support/ChangeLog +++ b/src/support/ChangeLog @@ -1,3 +1,7 @@ +2003-09-04 Angus Leeming + + * path.C (ctor, dtor): move out of line. + 2003-09-03 Angus Leeming * filename.[Ch] (FileName): new c-tor takes abs_filename arg. diff --git a/src/support/path.C b/src/support/path.C index 92388d9aed..2d34711883 100644 --- a/src/support/path.C +++ b/src/support/path.C @@ -10,11 +10,34 @@ #include +// Needed to prevent the definition of the unnamed_Path macro in the header file. +#define PATH_C + #include "path.h" +#include "lyxlib.h" namespace lyx { namespace support { +Path::Path(string const & path) + : popped_(false) +{ + if (!path.empty()) { + pushedDir_ = getcwd(); + if (pushedDir_.empty() || chdir(path)) + /* FIXME: throw */; + } else { + popped_ = true; + } +} + + +Path::~Path() +{ + if (!popped_) pop(); +} + + int Path::pop() { if (popped_) { diff --git a/src/support/path.h b/src/support/path.h index 96a057cd16..640f2154b9 100644 --- a/src/support/path.h +++ b/src/support/path.h @@ -13,7 +13,6 @@ #define PATH_H #include "LString.h" -#include "lyxlib.h" #include namespace lyx { @@ -35,24 +34,10 @@ namespace support { class Path : boost::noncopyable { public: /// change to the given directory - explicit - Path(string const & path) - : popped_(false) - { - if (!path.empty()) { - pushedDir_ = getcwd(); - if (pushedDir_.empty() || chdir(path)) - /* FIXME: throw */; - } else { - popped_ = true; - } - } + explicit Path(string const & path); /// set cwd to the previous value if needed - ~Path() - { - if (!popped_) pop(); - } + ~Path(); /// set cwd to the previous value if needed int pop(); @@ -68,7 +53,9 @@ private: // Path p("/tmp"); // right // we add this macro: /// +#ifndef PATH_C #define Path(x) unnamed_Path; +#endif // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal } // namespace support -- 2.39.2