]> git.lyx.org Git - lyx.git/blobdiff - src/support/filefilterlist.h
hopefully fix tex2lyx linking.
[lyx.git] / src / support / filefilterlist.h
index 984d1398f87de91b82b439995390430609633cba..bdb4725ddc9c7a6df09fdfd9208a5fe53d3a2ffe 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef FILE_FILTER_LIST_H
 #define FILE_FILTER_LIST_H
 
+#include "support/docstring.h"
+
 #include <string>
 #include <vector>
 
@@ -26,27 +28,44 @@ namespace support {
  */
 class FileFilterList {
 public:
+       // FIXME UNICODE: globs_ should be unicode...
        class Filter {
-               std::string desc_;
-               std::string globs_;
+               lyx::docstring desc_;
+               std::vector<std::string> globs_;
        public:
-               Filter(std::string const & d, std::string const & g)
-                       : desc_(d), globs_(g) {}
-               std::string const & description() const { return desc_; }
-               std::string const & globs() const { return globs_; }
+               /* \param description text describing the filters.
+                * \param one or more wildcard patterns, separated by
+                * whitespace.
+                */
+               Filter(lyx::docstring const & description,
+                      std::string const & globs);
+
+               lyx::docstring const & description() const { return desc_; }
+
+               typedef std::vector<std::string>::const_iterator glob_iterator;
+               glob_iterator begin() const { return globs_.begin(); }
+               glob_iterator end() const { return globs_.end(); }
        };
 
        /** \param qt_style_filter a list of available file filters.
         *  Eg. "TeX documents (*.tex);;LyX Documents (*.lyx)".
         *  The "All files (*)" filter is always added to the list.
         */
-       explicit FileFilterList(std::string const & qt_style_filter = std::string());
-       std::vector<Filter> const & filters() const { return filters_; }
+       explicit FileFilterList(lyx::docstring const & qt_style_filter =
+                               lyx::docstring());
+
+       typedef std::vector<Filter>::size_type size_type;
+
+       bool empty() const { return filters_.empty(); }
+       size_type size() const { return filters_.size(); }
+       Filter & operator[](size_type i) { return filters_[i]; }
+       Filter const & operator[](size_type i) const { return filters_[i]; }
 
-       /** \param expand pass each glob through \c convert_brace_glob.
-        *  \returns the equivalent of the string passed to the c-tor.
+       /** \returns the equivalent of the string passed to the c-tor
+        *  although any brace expressions are expanded.
+        *  (E.g. "*.{png,jpg}" -> "*.png *.jpg")
         */
-       std::string const str(bool expand) const;
+       lyx::docstring const as_string() const;
 
 private:
        void parse_filter(std::string const & filter);