- // Read the flags
- string flag_list(flags);
- while (!flag_list.empty()) {
- string flag_name, flag_value;
- flag_list = split(flag_list, flag_value, ',');
- flag_value = split(flag_value, flag_name, '=');
- if (flag_name == "*") {
- if (it != commands.end()) {
- Com = *it;
- Com.command = command;
- }
- }
- else if (flag_name == "importer")
- Com.importer = true;
- else if (flag_name == "latex")
- Com.latex = true;
- else if (flag_name == "originaldir")
- Com.original_dir = true;
- else if (flag_name == "needaux")
- Com.need_aux = true;
- else if (flag_name == "resultdir")
- Com.result_dir = (flag_value.empty())
- ? "$$BaseName" : flag_value;
- else if (flag_name == "resultfile")
- Com.result_file = flag_value;
- else if (flag_name == "parselog")
- Com.parselog = flag_value;
- else if (flag_name == "disable") {
- while (!flag_value.empty()) {
- string tmp;
- flag_value = split(flag_value, tmp, '&');
- Com.disable.push_back(tmp);
- }
- }
+
+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);
+}
+
+
+// This method updates the pointers From and To in all the converters.
+// The code is not very efficient, but it doesn't matter as the number
+// of formats and converters is small.
+// Furthermore, this method is called only on startup, or after
+// adding/deleting a format in FormPreferences (the latter calls can be
+// eliminated if the formats in the Formats class are stored using a map or
+// a list (instead of a vector), but this will cause other problems).
+void Converters::Update(Formats const & formats)
+{
+ for (ConverterList::iterator it = converterlist.begin();
+ it != converterlist.end(); ++it) {
+ it->From = formats.GetFormat(it->from);
+ it->To = formats.GetFormat(it->to);