1 /////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation; either version 2 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 /////////////////////////////////////////////////////////////////////////////
20 * @brief Declaration file for FileFilter
22 // ID line follows -- this is updated by SVN
26 #include <Poco/RegularExpression.h>
27 #include "UnicodeString.h"
30 * @brief FileFilter rule.
32 * Contains one filtering element definition (rule). In addition to
33 * regular expression there is boolean value for defining if rule
34 * is inclusive or exclusive. File filters have global inclusive/exclusive
35 * selection but this per-rule setting overwrites it.
37 * We are using PCRE for regular expressions and pRegExp points to compiled
38 * regular expression. pRegExpExtra contains additional information about
39 * the expression used to optimize matching.
41 struct FileFilterElement
43 Poco::RegularExpression regexp; /**< Compiled regular expression */
44 FileFilterElement(const std::string ®ex, int reOpts) : regexp(regex, reOpts)
50 * @brief One actual filter.
52 * For example, this might be a GNU C filter, excluding *.o files and CVS
53 * directories. That is to say, a filter is a set of file masks and
54 * directory masks. Usually FileFilter contains rules from one filter
55 * definition file. So it can be thought as filter file contents.
60 bool default_include; /**< If true, filter rules are inclusive by default */
61 String name; /**< Filter name (shown in UI) */
62 String description; /**< Filter description text */
63 String fullpath; /**< Full path to filter file */
64 std::vector<FileFilterElement*> filefilters; /**< List of rules for files */
65 std::vector<FileFilterElement*> dirfilters; /**< List of rules for directories */
66 FileFilter() : default_include(true) { }
69 static void EmptyFilterList(std::vector<FileFilterElement*> *filterList);