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"
33 Converter(std::string const & f, std::string const & t, std::string const & c,
34 std::string const & l);
50 /// The converter is latex or its derivatives
52 /// The converter is xml
54 /// Do we need to run the converter in the original directory?
56 /// This converter needs the .aux files
58 /// If the converter put the result in a directory, then result_dir
59 /// is the name of the directory
60 std::string result_dir;
61 /// If the converter put the result in a directory, then result_file
62 /// is the name of the main file in that directory
63 std::string result_file;
64 /// Command to convert the program output to a LaTeX log file format
73 typedef std::vector<int> EdgePath; // to be removed SOON
75 typedef std::vector<Converter> ConverterList;
77 typedef ConverterList::const_iterator const_iterator;
79 Converter const & get(int i) const {
80 return converterlist_[i];
83 Converter const * getConverter(std::string const & from,
84 std::string const & to) const;
86 int getNumber(std::string const & from, std::string const & to) const;
88 void add(std::string const & from, std::string const & to,
89 std::string const & command, std::string const & flags);
91 void erase(std::string const & from, std::string const & to);
95 std::vector<Format const *> const
96 getReachableTo(std::string const & target, bool clear_visited);
98 std::vector<Format const *> const
99 getReachable(std::string const & from, bool only_viewable,
101 /// Does a conversion path from format \p from to format \p to exist?
102 bool isReachable(std::string const & from, std::string const & to);
104 Graph::EdgePath const getPath(std::string const & from, std::string const & to);
106 OutputParams::FLAVOR getFlavor(Graph::EdgePath const & path);
108 bool convert(Buffer const * buffer,
109 std::string const & from_file, std::string const & to_file_base,
110 std::string const & from_format, std::string const & to_format,
111 std::string & to_file, ErrorList & errorList,
112 bool try_default = false);
114 bool convert(Buffer const * buffer,
115 std::string const & from_file, std::string const & to_file_base,
116 std::string const & from_format, std::string const & to_format,
117 ErrorList & errorList, bool try_default = false);
119 void update(Formats const & formats);
121 void updateLast(Formats const & formats);
123 bool formatIsUsed(std::string const & format);
125 const_iterator begin() const {
126 return converterlist_.begin();
128 const_iterator end() const {
129 return converterlist_.end();
135 std::vector<Format const *> const
136 intToFormat(std::vector<int> const & input);
138 bool scanLog(Buffer const & buffer, std::string const & command,
139 std::string const & filename, ErrorList & errorList);
141 bool runLaTeX(Buffer const & buffer, std::string const & command,
142 OutputParams const &, ErrorList & errorList);
144 ConverterList converterlist_;
146 std::string latex_command_;
147 /// If \p from = /path/file.ext and \p to = /path2/file2.ext2 then
148 /// this method moves each /path/file*.ext file to /path2/file2*.ext2
149 bool move(std::string const & fmt,
150 std::string const & from, std::string const & to,
156 extern Converters converters;
158 extern Converters system_converters;