+ ConverterList::const_iterator cit =
+ find_if(converterlist.begin(), converterlist.end(),
+ compare_Converter(from, to));
+ if (cit != converterlist.end())
+ return cit - converterlist.begin();
+ else
+ return -1;
+}
+
+
+void Converters::Add(string const & from, string const & to,
+ string const & command, string const & flags)
+{
+ formats.Add(from);
+ formats.Add(to);
+ ConverterList::iterator it = find_if(converterlist.begin(),
+ converterlist.end(),
+ compare_Converter(from, to));
+
+ Converter converter(from, to, command, flags);
+ if (it != converterlist.end() && !flags.empty() && flags[0] == '*') {
+ converter = *it;
+ converter.command = command;
+ converter.flags = flags;
+ }
+ converter.ReadFlags();
+
+ if (converter.latex && (latex_command.empty() || to == "dvi"))
+ latex_command = subst(command, token_from, "");
+ // If we have both latex & pdflatex, we set latex_command to latex.
+ // The latex_command is used to update the .aux file when running
+ // a converter that uses it.
+
+ if (it == converterlist.end())
+ converterlist.push_back(converter);
+ else {
+ converter.From = it->From;
+ converter.To = it->To;
+ *it = converter;
+ }
+}
+
+
+void Converters::Delete(string const & from, string const & to)
+{
+ ConverterList::iterator it = find_if(converterlist.begin(),
+ converterlist.end(),
+ compare_Converter(from, to));
+ if (it != converterlist.end())
+ converterlist.erase(it);
+}
+