string extension_;
};
+
+class FormatPrettyNameEqual : public unary_function<Format, bool> {
+public:
+ FormatPrettyNameEqual(string const & prettyname)
+ : prettyname_(prettyname) {}
+ bool operator()(Format const & f) const
+ {
+ return f.prettyname() == prettyname_;
+ }
+private:
+ string prettyname_;
+};
+
} //namespace anon
bool operator<(Format const & a, Format const & b)
{
- // use the compare_ascii_no_case instead of compare_no_case,
- // because in turkish, 'i' is not the lowercase version of 'I',
- // and thus turkish locale breaks parsing of tags.
-
- return compare_ascii_no_case(a.prettyname(), b.prettyname()) < 0;
+ return _(a.prettyname()) < _(b.prettyname());
}
}
+string Formats::getFormatFromPrettyName(string const & prettyname) const
+{
+ if (!prettyname.empty()) {
+ Formats::const_iterator cit =
+ find_if(formatlist.begin(), formatlist.end(),
+ FormatPrettyNameEqual(prettyname));
+ if (cit != formats.end())
+ return cit->name();
+ }
+ return string();
+}
+
+
/// Used to store last timestamp of file and whether it is (was) zipped
struct ZippedInfo {
bool zipped;