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
This commit is contained in:
Angus Leeming 2003-06-05 22:45:51 +00:00
parent aa7c2f32e1
commit 71f798da6e
4 changed files with 20 additions and 9 deletions

View File

@ -1,6 +1,7 @@
2003-06-04 Angus Leeming <leeming@lyx.org> 2003-06-04 Angus Leeming <leeming@lyx.org>
* GraphicsLoader.C (Loader copy c-tor): make it work as expected. ;-) * 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 <leeming@lyx.org> 2003-06-03 Angus Leeming <leeming@lyx.org>

View File

@ -29,7 +29,7 @@ namespace grfx {
struct Loader::Impl : boost::signals::trackable { struct Loader::Impl : boost::signals::trackable {
/// ///
Impl(Params const &); Impl();
/// ///
~Impl(); ~Impl();
/// ///
@ -67,26 +67,26 @@ private:
Loader::Loader() Loader::Loader()
: pimpl_(new Impl(Params())) : pimpl_(new Impl)
{} {}
Loader::Loader(string const & file, DisplayType type) Loader::Loader(string const & file, DisplayType type)
: pimpl_(new Impl(Params())) : pimpl_(new Impl)
{ {
reset(file, type); reset(file, type);
} }
Loader::Loader(string const & file, Params const & params) Loader::Loader(string const & file, Params const & params)
: pimpl_(new Impl(Params())) : pimpl_(new Impl)
{ {
reset(file, params); reset(file, params);
} }
Loader::Loader(Loader const & other) Loader::Loader(Loader const & other)
: pimpl_(new Impl(Params())) : pimpl_(new Impl)
{ {
Params const & params = other.pimpl_->params(); Params const & params = other.pimpl_->params();
reset(params.filename, 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 void Loader::reset(string const & file, DisplayType type) const
{ {
Params params; Params params;
@ -184,8 +194,8 @@ Image const * Loader::image() const
} }
Loader::Impl::Impl(Params const & params) Loader::Impl::Impl()
: status_(WaitingToLoad), params_(params) : status_(WaitingToLoad)
{ {
} }

View File

@ -31,7 +31,6 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
class Inset; class Inset;
class BufferView;
namespace grfx { namespace grfx {
@ -52,6 +51,8 @@ public:
/// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy. /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
~Loader(); ~Loader();
Loader & operator=(Loader const &);
/// The file can be changed, or the display params, or both. /// The file can be changed, or the display params, or both.
void reset(string const & file_with_path, void reset(string const & file_with_path,
DisplayType = ColorDisplay) const; DisplayType = ColorDisplay) const;

View File

@ -16,7 +16,6 @@
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
class Inset; class Inset;
class BufferView;
namespace grfx { namespace grfx {