#include "graphics/Previews.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
#include "support/forkedcontr.h"
-#include "support/globbing.h"
#include "support/path_defines.h"
#include "support/tostr.h"
#include "support/types.h"
+2004-11-25 Angus Leeming <leeming@lyx.org>
+
+ * BufferView_pimpl.C:
+ * lyx_cb.C:
+ * lyxfunc.C: s/globbing.h/filefilterlist.h/ in #includes.
+
2004-11-24 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* lyxfunc.C (getStatus, dispatch): use FuncStatus::message; only
+2004-11-25 Angus Leeming <leeming@lyx.org>
+
+ * ControlBibtex.C:
+ * ControlExternal.C:
+ * ControlGraphics.C:
+ * ControlInclude.C:
+ * ControlPrefs.C:
+ * ControlPrint.C: s/globbing.h/filefilterlist.h/ in #includes.
+
+ * helper_funcs.C: remove #include "globbing.h".
+
2004-11-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* ControlSpellchecker.C (check): update the view when setting the
#include "tex_helpers.h"
#include "gettext.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/globbing.h"
using std::pair;
using std::string;
#include "insets/ExternalSupport.h"
#include "insets/ExternalTemplate.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/globbing.h"
#include "support/tostr.h"
using std::advance;
#include "insets/insetgraphics.h"
#include "support/FileInfo.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/globbing.h"
#include "support/path_defines.h"
#include "support/tostr.h"
#include "support/types.h"
#include "insets/insetinclude.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/globbing.h"
#include <utility>
#include "funcrequest.h"
#include "LColor.h"
-#include "support/globbing.h"
+#include "support/filefilterlist.h"
#include <sstream>
#include "PrinterParams.h"
#include "support/tostr.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
-#include "support/globbing.h"
using std::string;
#include "support/filetools.h"
#include "support/path_defines.h"
-#include "support/globbing.h"
using std::pair;
using std::vector;
+2004-11-25 Angus Leeming <leeming@lyx.org>
+
+ * FileDialog.C:
+ * FileDialog_private.C: s/globbing.h/filefilterlist.h/ in #includes.
+
2004-11-22 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* lengthvalidator.[Ch]: add GlueLength validator
#include "debug.h"
#include "gettext.h"
-#include "support/globbing.h"
+#include "support/filefilterlist.h"
/** when this is defined, the code will use
* QFileDialog::getOpenFileName and friends to create filedialogs.
#include "FileDialog_private.h"
#include "qt_helpers.h"
-#include "support/globbing.h"
+#include "support/filefilterlist.h"
#include "support/lstrings.h"
#include <qapplication.h>
+2004-11-25 Angus Leeming <leeming@lyx.org>
+
+ * FileDialog.C: s/globbing.h/filefilterlist.h/ in #includes.
+ * FormFileDialog.C: add #include "filefilterlist.h"
+ * FormBibtex.C: remove #include "globbing.h".
+
2004-11-16 Lars Gullik Bjonnes <larsbj@gullik.net>
* Layoutengine.[Ch]: Break up circular dependency between Box and
#include "debug.h"
#include "gettext.h"
-#include "support/globbing.h"
+#include "support/filefilterlist.h"
#include "support/lstrings.h"
using lyx::support::rsplit;
#include "xformsBC.h"
#include "support/filetools.h"
-#include "support/globbing.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
#include "frontends/Dialogs.h"
#include "support/FileInfo.h"
+#include "support/filefilterlist.h"
#include "support/filetools.h"
#include "support/globbing.h"
#include "support/lstrings.h"
#include "frontends/lyx_gui.h"
#include "frontends/LyXView.h"
+#include "support/filefilterlist.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/forkedcall.h"
-#include "support/globbing.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/path.h"
#include "frontends/Menubar.h"
#include "frontends/Toolbars.h"
+#include "support/filefilterlist.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/forkedcontr.h"
-#include "support/globbing.h"
#include "support/lstrings.h"
#include "support/path.h"
#include "support/path_defines.h"
+2004-11-25 Angus Leeming <leeming@lyx.org>
+
+ * filefilterlist.[Ch]:
+ * globbing.[Ch]: split FileFilterList into its own .[Ch] files.
+
+ * Makefile.am: add filefilterlist.[Ch].
+
2004-11-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* textutils.h (isKommaChar): remove
copied_ptr.h \
cow_ptr.h \
debugstream.h \
+ filefilterlist.C \
+ filefilterlist.h \
filename.C \
filename.h \
filetools.C \
--- /dev/null
+/**
+ * \file filefilterlist.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/filefilterlist.h"
+#include "support/globbing.h"
+#include "support/lstrings.h"
+
+// FIXME Interface violation
+#include "gettext.h"
+
+#include <boost/regex.hpp>
+
+#include </usr/include/glob.h>
+
+#include <sstream>
+
+using std::distance;
+using std::ostringstream;
+using std::string;
+using std::vector;
+
+
+namespace lyx {
+namespace support {
+
+FileFilterList::FileFilterList(string const & qt_style_filter)
+{
+ string const filter = qt_style_filter
+ + (qt_style_filter.empty() ? string() : ";;")
+ + _("All files (*)");
+
+ // Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
+ // into individual filters.
+ static boost::regex const separator_re(";;");
+
+ string::const_iterator it = filter.begin();
+ string::const_iterator const end = filter.end();
+ while (true) {
+ boost::match_results<string::const_iterator> what;
+
+ if (!boost::regex_search(it, end, what, separator_re)) {
+ parse_filter(string(it, end));
+ break;
+ }
+
+ // Everything from the start of the input to
+ // the start of the match.
+ parse_filter(string(what[-1].first, what[-1].second));
+
+ // Increment the iterator to the end of the match.
+ it += distance(it, what[0].second);
+ }
+}
+
+
+void FileFilterList::parse_filter(string const & filter)
+{
+ // Matches "TeX documents (*.tex)",
+ // storing "TeX documents " as group 1 and "*.tex" as group 2.
+ static boost::regex const filter_re("([^(]*)\\(([^)]+)\\) *$");
+
+ boost::match_results<string::const_iterator> what;
+ if (!boost::regex_search(filter, what, filter_re)) {
+ // Just a glob, no description.
+ filters_.push_back(Filter(string(), trim(filter)));
+ } else {
+ string const desc = string(what[1].first, what[1].second);
+ string const globs = string(what[2].first, what[2].second);
+ filters_.push_back(Filter(trim(desc), trim(globs)));
+ }
+}
+
+
+string const FileFilterList::str(bool expand) const
+{
+ ostringstream ss;
+
+ vector<Filter>::const_iterator const begin = filters_.begin();
+ vector<Filter>::const_iterator const end = filters_.end();
+ vector<Filter>::const_iterator it = begin;
+ for (; it != end; ++it) {
+ string const globs = expand ?
+ convert_brace_glob(it->globs()) : it->globs();
+ if (it != begin)
+ ss << ";;";
+ bool const has_description = !it->description().empty();
+ if (has_description)
+ ss << it->description() << " (";
+ ss << globs;
+ if (has_description)
+ ss << ')';
+ }
+
+ return ss.str();
+}
+
+} // namespace support
+} // namespace lyx
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file filefilterlist.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef FILE_FILTER_LIST_H
+#define FILE_FILTER_LIST_H
+
+#include <string>
+#include <vector>
+
+namespace lyx {
+namespace support {
+
+/** \c FileFilterList parses a Qt-style list of available file filters
+ * to generate the corresponding vector.
+ * For example "TeX documents (*.tex);;LyX Documents (*.lyx)"
+ * will be parsed to fill a vector of size 2, whilst "*.{p[bgp]m} *.pdf"
+ * will result in a vector of size 1 in which the description field is empty.
+ */
+class FileFilterList {
+public:
+ class Filter {
+ std::string desc_;
+ 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 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_; }
+
+ /** \param expand pass each glob through \c convert_brace_glob.
+ * \returns the equivalent of the string passed to the c-tor.
+ */
+ std::string const str(bool expand) const;
+
+private:
+ void parse_filter(std::string const & filter);
+ std::vector<Filter> filters_;
+};
+
+} // namespace support
+} // namespace lyx
+
+#endif // NOT FILE_FILTER_LIST_H
#include "support/lstrings.h"
#include "support/path.h"
-// FIXME Interface violation
-#include "gettext.h"
-
#include <boost/regex.hpp>
#include <boost/tokenizer.hpp>
#include <glob.h>
-#include <sstream>
-
using std::distance;
-using std::ostringstream;
using std::string;
using std::vector;
return matches;
}
-
-FileFilterList::FileFilterList(string const & qt_style_filter)
-{
- string const filter = qt_style_filter
- + (qt_style_filter.empty() ? string() : ";;")
- + _("All files (*)");
-
- // Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)"
- // into individual filters.
- static boost::regex const separator_re(";;");
-
- string::const_iterator it = filter.begin();
- string::const_iterator const end = filter.end();
- while (true) {
- boost::match_results<string::const_iterator> what;
-
- if (!boost::regex_search(it, end, what, separator_re)) {
- parse_filter(string(it, end));
- break;
- }
-
- // Everything from the start of the input to
- // the start of the match.
- parse_filter(string(what[-1].first, what[-1].second));
-
- // Increment the iterator to the end of the match.
- it += distance(it, what[0].second);
- }
-}
-
-
-void FileFilterList::parse_filter(string const & filter)
-{
- // Matches "TeX documents (*.tex)",
- // storing "TeX documents " as group 1 and "*.tex" as group 2.
- static boost::regex const filter_re("([^(]*)\\(([^)]+)\\) *$");
-
- boost::match_results<string::const_iterator> what;
- if (!boost::regex_search(filter, what, filter_re)) {
- // Just a glob, no description.
- filters_.push_back(Filter(string(), trim(filter)));
- } else {
- string const desc = string(what[1].first, what[1].second);
- string const globs = string(what[2].first, what[2].second);
- filters_.push_back(Filter(trim(desc), trim(globs)));
- }
-}
-
-
-string const FileFilterList::str(bool expand) const
-{
- ostringstream ss;
-
- vector<Filter>::const_iterator const begin = filters_.begin();
- vector<Filter>::const_iterator const end = filters_.end();
- vector<Filter>::const_iterator it = begin;
- for (; it != end; ++it) {
- string const globs = expand ?
- convert_brace_glob(it->globs()) : it->globs();
- if (it != begin)
- ss << ";;";
- bool const has_description = !it->description().empty();
- if (has_description)
- ss << it->description() << " (";
- ss << globs;
- if (has_description)
- ss << ')';
- }
-
- return ss.str();
-}
-
} // namespace support
} // namespace lyx
expand_globs(std::string const & mask,
std::string const & directory = std::string());
-
-/** \c FileFilterList parses a Qt-style list of available file filters
- * to generate the corresponding vector.
- * For example "TeX documents (*.tex);;LyX Documents (*.lyx)"
- * will be parsed to fill a vector of size 2, whilst "*.{p[bgp]m} *.pdf"
- * will result in a vector of size 1 in which the description field is empty.
- */
-class FileFilterList {
-public:
- class Filter {
- std::string desc_;
- 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 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_; }
-
- /** \param expand pass each glob through \c convert_brace_glob.
- * \returns the equivalent of the string passed to the c-tor.
- */
- std::string const str(bool expand) const;
-
-private:
- void parse_filter(std::string const & filter);
- std::vector<Filter> filters_;
-};
-
} // namespace support
} // namespace lyx