]> git.lyx.org Git - lyx.git/blob - src/graphics/GraphicsConverter.h
Remove unnecessary `c_str`
[lyx.git] / src / graphics / GraphicsConverter.h
1 // -*- C++ -*-
2 /**
3  * \file GraphicsConverter.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Angus Leeming
8  *
9  * Full author contact details are available in file CREDITS.
10  *
11  * The controller of a conversion process from file AA of format A to
12  * file BB of format B.
13  * Once finished, a signal is emitted to inform any listeners (connected
14  * through the connect() method).
15  */
16
17 #ifndef GRAPHICSCONVERTER_H
18 #define GRAPHICSCONVERTER_H
19
20 #include "support/signals.h"
21
22
23 namespace lyx {
24
25 namespace support { class FileName; }
26
27 namespace graphics {
28
29 class Converter {
30 public:
31         /// Can the conversion be performed?
32         static bool isReachable(std::string const & from_format_name,
33                                 std::string const & to_format_name);
34
35         /** One Converter per conversion ensures that the (hidden) signal
36          *  is always connected to the expected slot.
37          */
38         Converter(support::FileName const & doc_fname,
39                   support::FileName const & from_file, std::string const & to_file_base,
40                   std::string const & from_format, std::string const & to_format);
41
42         /// Needed for the pimpl
43         ~Converter();
44
45         /// We are explicit about when we begin the conversion process.
46         void startConversion() const;
47
48         /** Connect and you'll be informed when the conversion process has
49          *  finished.
50          *  If the conversion is successful, then the listener is passed \c true.
51          *  The connection is closed when this is destroyed.
52          */
53         typedef signals2::signal<void(bool)> sig_type;
54         typedef sig_type::slot_type slot_type;
55         ///
56         signals2::connection connect(slot_type const &) const;
57
58         /** If the conversion is successful, this returns the name of the
59          *  resulting file.
60          *  If conversion fails or has not been completed, however, it
61          *  returns an empty string.
62          */
63         support::FileName const & convertedFile() const;
64
65 private:
66         /// noncopyable
67         Converter(Converter const &);
68         void operator=(Converter const &);
69
70         /// Use the Pimpl idiom to hide the internals.
71         class Impl;
72         /// The pointer never changes although *pimpl_'s contents may.
73         Impl * const pimpl_;
74 };
75
76 } // namespace graphics
77 } // namespace lyx
78
79 #endif // GRAPHICSCONVERTER_H