From: Angus Leeming Date: Thu, 5 Jun 2003 22:45:51 +0000 (+0000) Subject: If the graphics loader has a copy c-tor it should have copy assignment that does... X-Git-Tag: 1.6.10~16683 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=71f798da6e02de4e9e0b08e5699bc192c40faf2c;p=features.git If the graphics loader has a copy c-tor it should have copy assignment that does the same thing. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7112 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index d6078d495e..48e67610cb 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,6 +1,7 @@ 2003-06-04 Angus Leeming * GraphicsLoader.C (Loader copy c-tor): make it work as expected. ;-) + (operator=): if it has a copy c-tor, it should have this too. 2003-06-03 Angus Leeming diff --git a/src/graphics/GraphicsLoader.C b/src/graphics/GraphicsLoader.C index 3fe180f17d..391fac6ac5 100644 --- a/src/graphics/GraphicsLoader.C +++ b/src/graphics/GraphicsLoader.C @@ -29,7 +29,7 @@ namespace grfx { struct Loader::Impl : boost::signals::trackable { /// - Impl(Params const &); + Impl(); /// ~Impl(); /// @@ -67,26 +67,26 @@ private: Loader::Loader() - : pimpl_(new Impl(Params())) + : pimpl_(new Impl) {} Loader::Loader(string const & file, DisplayType type) - : pimpl_(new Impl(Params())) + : pimpl_(new Impl) { reset(file, type); } Loader::Loader(string const & file, Params const & params) - : pimpl_(new Impl(Params())) + : pimpl_(new Impl) { reset(file, params); } Loader::Loader(Loader const & other) - : pimpl_(new Impl(Params())) + : pimpl_(new Impl) { Params const & params = other.pimpl_->params(); reset(params.filename, params); @@ -97,6 +97,16 @@ Loader::~Loader() {} +Loader & Loader::operator=(Loader const & other) +{ + if (this != &other) { + Params const & params = other.pimpl_->params(); + reset(params.filename, params); + } + return *this; +} + + void Loader::reset(string const & file, DisplayType type) const { Params params; @@ -184,8 +194,8 @@ Image const * Loader::image() const } -Loader::Impl::Impl(Params const & params) - : status_(WaitingToLoad), params_(params) +Loader::Impl::Impl() + : status_(WaitingToLoad) { } diff --git a/src/graphics/GraphicsLoader.h b/src/graphics/GraphicsLoader.h index 6307ec1a02..c95a21430a 100644 --- a/src/graphics/GraphicsLoader.h +++ b/src/graphics/GraphicsLoader.h @@ -31,7 +31,6 @@ #include class Inset; -class BufferView; namespace grfx { @@ -52,6 +51,8 @@ public: /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy. ~Loader(); + Loader & operator=(Loader const &); + /// The file can be changed, or the display params, or both. void reset(string const & file_with_path, DisplayType = ColorDisplay) const; diff --git a/src/graphics/PreviewImage.h b/src/graphics/PreviewImage.h index 4c459756d0..cb1cb71b3d 100644 --- a/src/graphics/PreviewImage.h +++ b/src/graphics/PreviewImage.h @@ -16,7 +16,6 @@ #include class Inset; -class BufferView; namespace grfx {