lyx_mirror/src/Compare.cpp
Abdelrazak Younes 1ff6b1122b Fix gcc warnings.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31830 a592a061-630c-0410-9148-cb99ea01b6c8
2009-11-02 15:20:36 +00:00

94 lines
1.5 KiB
C++

/**
* \file Compare.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Vincent van Ravesteijn
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "Compare.h"
#include "Buffer.h"
#include "BufferParams.h"
using namespace std;
using namespace lyx::support;
namespace lyx {
/**
* The implementation of the algorithm that does the comparison
* between two documents.
*/
class Compare::Impl {
public:
///
Impl(Compare const & compare)
: abort_(false), compare_(compare)
{}
///
~Impl() {}
/// Set to true to abort the algorithm
bool abort_;
private:
/// The thread object, used to emit signals to the GUI
Compare const & compare_;
};
Compare::Compare(Buffer const * new_buf, Buffer const * old_buf,
Buffer * const dest_buf, CompareOptions const & options)
: new_buffer(new_buf), old_buffer(old_buf), dest_buffer(dest_buf),
options_(options), pimpl_(new Impl(*this))
{
}
void Compare::run()
{
if (!dest_buffer || !new_buffer || !old_buffer) {
error();
return;
}
// Copy the buffer params to the new buffer
dest_buffer->params() = options_.settings_from_new
? new_buffer->params() : old_buffer->params();
// do the real work
if (!doCompare())
error();
else
finished(pimpl_->abort_);
return;
}
void Compare::abort()
{
pimpl_->abort_ = true;
condition_.wakeOne();
wait();
pimpl_->abort_ = false;
}
int Compare::doCompare()
{
return 0;
}
#include "moc_Compare.cpp"
} // namespace lyx