]> git.lyx.org Git - lyx.git/blobdiff - src/Format.cpp
tex2lyx/text.cpp: fix 2 typos
[lyx.git] / src / Format.cpp
index 2ef745e50d12a9d38f03ee0c52f35c50414ff85f..1ae3960163de695bcb9457bf14bec40842ecf342 100644 (file)
@@ -77,6 +77,19 @@ private:
        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
 
 
@@ -192,6 +205,19 @@ string Formats::getFormatFromExtension(string const & ext) const
 }
 
 
+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;