From 1fcfbcf1aba24259acbc6822a3feb5e38760a930 Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 25 Jul 2018 17:50:30 +0200 Subject: [PATCH] + move implementation of Base::ifstream and Base::ofstream to header and remove export macro. This is needed for VS 2013 to avoid that it exports methods of the base class and thus causing linker errors for modules that link FreeCADBase --- src/Base/Stream.cpp | 30 ------------------------------ src/Base/Stream.h | 31 +++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 36 deletions(-) diff --git a/src/Base/Stream.cpp b/src/Base/Stream.cpp index 095ca3a029..06a573f0d1 100644 --- a/src/Base/Stream.cpp +++ b/src/Base/Stream.cpp @@ -39,7 +39,6 @@ #include "Stream.h" #include "Swap.h" -#include "FileInfo.h" #include using namespace Base; @@ -785,32 +784,3 @@ Streambuf::seekpos(std::streambuf::pos_type pos, { return seekoff(pos, std::ios_base::beg); } - -// --------------------------------------------------------- - -Base::ofstream::ofstream(const FileInfo& fi, ios_base::openmode mode) -#ifdef _MSC_VER -: std::ofstream(fi.toStdWString().c_str(), mode) -#else -: std::ofstream(fi.filePath().c_str(), mode) -#endif -{ -} - -Base::ofstream::~ofstream() -{ -} - -Base::ifstream::ifstream(const FileInfo& fi, ios_base::openmode mode) -#ifdef _MSC_VER -: std::ifstream(fi.toStdWString().c_str(), mode) -#else -: std::ifstream(fi.filePath().c_str(), mode) -#endif -{ -} - -Base::ifstream::~ifstream() -{ -} - diff --git a/src/Base/Stream.h b/src/Base/Stream.h index 4312f32e16..464805c3de 100644 --- a/src/Base/Stream.h +++ b/src/Base/Stream.h @@ -35,6 +35,7 @@ #include #include #include +#include "FileInfo.h" class QByteArray; class QIODevice; @@ -302,12 +303,21 @@ class FileInfo; * while on Linux platforms the file name is UTF-8 encoded. * @author Werner Mayer */ -class BaseExport ofstream : public std::ofstream +class ofstream : public std::ofstream { public: ofstream(const FileInfo& fi, ios_base::openmode mode = - std::ios::out | std::ios::trunc); - virtual ~ofstream(); + std::ios::out | std::ios::trunc) +#ifdef _MSC_VER + : std::ofstream(fi.toStdWString().c_str(), mode) +#else + : std::ofstream(fi.filePath().c_str(), mode) +#endif + { + } + virtual ~ofstream() + { + } }; /** @@ -316,12 +326,21 @@ public: * while on Linux platforms the file name is UTF-8 encoded. * @author Werner Mayer */ -class BaseExport ifstream : public std::ifstream +class ifstream : public std::ifstream { public: ifstream(const FileInfo& fi, ios_base::openmode mode = - std::ios::in); - virtual ~ifstream(); + std::ios::in) +#ifdef _MSC_VER + : std::ifstream(fi.toStdWString().c_str(), mode) +#else + : std::ifstream(fi.filePath().c_str(), mode) +#endif + { + } + virtual ~ifstream() + { + } }; } // namespace Base