mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-09-23 08:39:07 +00:00
f643df79a8
the boost::signals into the relevant Impl classes and creating new, publicly-accessible connect() methods. * Const-ify all publicly-accessible methods, reflecting the fact that each class contains only a const pimpl_ member variable. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4687 a592a061-630c-0410-9148-cb99ea01b6c8
75 lines
2.0 KiB
C++
75 lines
2.0 KiB
C++
// -*- C++ -*-
|
|
/**
|
|
* \file GraphicsConverter.h
|
|
* Copyright 2002 the LyX Team
|
|
* Read the file COPYING
|
|
*
|
|
* \author Angus Leeming <leeming@lyx.org>
|
|
*
|
|
* The controller of a conversion process from file AA of format A to
|
|
* file BB of format B.
|
|
* Once finished, the signal finishdConversion is emitted to inform the
|
|
* instigator where to find file BB.
|
|
* If the conversion is unsuccessful, then finishedConversion will pass
|
|
* an empty string.
|
|
*/
|
|
|
|
#ifndef GRAPHICSCONVERTER_H
|
|
#define GRAPHICSCONVERTER_H
|
|
|
|
#ifdef __GNUG__
|
|
#pragma interface
|
|
#endif
|
|
|
|
#include "LString.h"
|
|
#include <boost/signals/signal1.hpp>
|
|
#include <boost/scoped_ptr.hpp>
|
|
#include <boost/utility.hpp>
|
|
|
|
namespace grfx {
|
|
|
|
class Converter : boost::noncopyable {
|
|
public:
|
|
/// Can the conversion be performed?
|
|
static bool isReachable(string const & from_format_name,
|
|
string const & to_format_name);
|
|
|
|
/** One Converter per conversion ensures that finishedConversion
|
|
* is always connected to the expected slot.
|
|
*/
|
|
Converter(string const & from_file, string const & to_file_base,
|
|
string const & from_format, string const & to_format);
|
|
|
|
/// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
|
|
~Converter();
|
|
|
|
/// We are explicit about when we begin the conversion process.
|
|
void startConversion() const;
|
|
|
|
/** Connect and you'll be informed when the conversion process has
|
|
* finished.
|
|
* If the conversion is succesful, then the slot is passed \c true.
|
|
*/
|
|
typedef boost::signal1<void, bool>::slot_type slot_type;
|
|
///
|
|
boost::signals::connection connect(slot_type const &) const;
|
|
|
|
/** If the conversion is succesful, this returns the name of the
|
|
* resulting file.
|
|
* If conversion fails or has not been completed, however, it
|
|
* returns an empty string.
|
|
*/
|
|
string const & convertedFile() const;
|
|
|
|
private:
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
class Impl;
|
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
|
boost::scoped_ptr<Impl> const pimpl_;
|
|
};
|
|
|
|
} // namespace grfx
|
|
|
|
#endif // GRAPHICSCONVERTER_H
|