3 * \file filefilterlist.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
12 #ifndef FILE_FILTER_LIST_H
13 #define FILE_FILTER_LIST_H
21 /** \c FileFilterList parses a Qt-style list of available file filters
22 * to generate the corresponding vector.
23 * For example "TeX documents (*.tex);;LyX Documents (*.lyx)"
24 * will be parsed to fill a vector of size 2, whilst "*.{p[bgp]m} *.pdf"
25 * will result in a vector of size 1 in which the description field is empty.
27 class FileFilterList {
33 Filter(std::string const & d, std::string const & g)
34 : desc_(d), globs_(g) {}
35 std::string const & description() const { return desc_; }
36 std::string const & globs() const { return globs_; }
39 /** \param qt_style_filter a list of available file filters.
40 * Eg. "TeX documents (*.tex);;LyX Documents (*.lyx)".
41 * The "All files (*)" filter is always added to the list.
43 explicit FileFilterList(std::string const & qt_style_filter = std::string());
44 std::vector<Filter> const & filters() const { return filters_; }
46 /** \param expand pass each glob through \c convert_brace_glob.
47 * \returns the equivalent of the string passed to the c-tor.
49 std::string const str(bool expand) const;
52 void parse_filter(std::string const & filter);
53 std::vector<Filter> filters_;
56 } // namespace support
59 #endif // NOT FILE_FILTER_LIST_H