3 * \file GraphicsConverter.h
4 * Read the file COPYING
6 * \author Angus Leeming
8 * Full author contact details are available in file CREDITS
10 * The controller of a conversion process from file AA of format A to
11 * file BB of format B.
12 * Once finished, a signal is emitted to inform any listeners (connected
13 * through the connect() method).
16 #ifndef GRAPHICSCONVERTER_H
17 #define GRAPHICSCONVERTER_H
24 #include <boost/signals/signal1.hpp>
25 #include <boost/scoped_ptr.hpp>
26 #include <boost/utility.hpp>
30 class Converter : boost::noncopyable {
32 /// Can the conversion be performed?
33 static bool isReachable(string const & from_format_name,
34 string const & to_format_name);
36 /** One Converter per conversion ensures that the (hidden) signal
37 * is always connected to the expected slot.
39 Converter(string const & from_file, string const & to_file_base,
40 string const & from_format, string const & to_format);
42 /// Define an empty d-tor out-of-line to keep boost::scoped_ptr happy.
45 /// We are explicit about when we begin the conversion process.
46 void startConversion() const;
48 /** Connect and you'll be informed when the conversion process has
50 * If the conversion is succesful, then the listener is passed \c true.
52 typedef boost::signal1<void, bool>::slot_type slot_type;
54 boost::signals::connection connect(slot_type const &) const;
56 /** If the conversion is succesful, this returns the name of the
58 * If conversion fails or has not been completed, however, it
59 * returns an empty string.
61 string const & convertedFile() const;
64 /// Use the Pimpl idiom to hide the internals.
67 /// The pointer never changes although *pimpl_'s contents may.
68 boost::scoped_ptr<Impl> const pimpl_;
73 #endif // GRAPHICSCONVERTER_H