4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
16 #include "outputparams.h"
36 Converter(std::string const & f, std::string const & t, std::string const & c,
37 std::string const & l);
53 /// The converter is latex or its derivatives
55 /// The converter is xml
57 /// Do we need to run the converter in the original directory?
59 /// This converter needs the .aux files
61 /// If the converter put the result in a directory, then result_dir
62 /// is the name of the directory
63 std::string result_dir;
64 /// If the converter put the result in a directory, then result_file
65 /// is the name of the main file in that directory
66 std::string result_file;
67 /// Command to convert the program output to a LaTeX log file format
76 typedef std::vector<int> EdgePath; // to be removed SOON
78 typedef std::vector<Converter> ConverterList;
80 typedef ConverterList::const_iterator const_iterator;
82 Converter const & get(int i) const {
83 return converterlist_[i];
86 Converter const * getConverter(std::string const & from,
87 std::string const & to) const;
89 int getNumber(std::string const & from, std::string const & to) const;
91 void add(std::string const & from, std::string const & to,
92 std::string const & command, std::string const & flags);
94 void erase(std::string const & from, std::string const & to);
98 std::vector<Format const *> const
99 getReachableTo(std::string const & target, bool clear_visited);
101 std::vector<Format const *> const
102 getReachable(std::string const & from, bool only_viewable,
104 /// Does a conversion path from format \p from to format \p to exist?
105 bool isReachable(std::string const & from, std::string const & to);
107 Graph::EdgePath const getPath(std::string const & from, std::string const & to);
109 OutputParams::FLAVOR getFlavor(Graph::EdgePath const & path);
110 /// Flags for converting files
111 enum ConversionFlags {
114 /// Use the default converter if no converter is defined
115 try_default = 1 << 0,
116 /// Get the converted file from cache if possible
120 bool convert(Buffer const * buffer,
121 std::string const & from_file, std::string const & to_file,
122 std::string const & orig_from,
123 std::string const & from_format, std::string const & to_format,
124 ErrorList & errorList, int conversionflags = none);
126 void update(Formats const & formats);
128 void updateLast(Formats const & formats);
130 bool formatIsUsed(std::string const & format);
132 const_iterator begin() const {
133 return converterlist_.begin();
135 const_iterator end() const {
136 return converterlist_.end();
142 std::vector<Format const *> const
143 intToFormat(std::vector<int> const & input);
145 bool scanLog(Buffer const & buffer, std::string const & command,
146 std::string const & filename, ErrorList & errorList);
148 bool runLaTeX(Buffer const & buffer, std::string const & command,
149 OutputParams const &, ErrorList & errorList);
151 ConverterList converterlist_;
153 std::string latex_command_;
154 /// If \p from = /path/file.ext and \p to = /path2/file2.ext2 then
155 /// this method moves each /path/file*.ext file to /path2/file2*.ext2
156 bool move(std::string const & fmt,
157 std::string const & from, std::string const & to,
163 extern Converters converters;
165 extern Converters system_converters;