--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// License (GPLv2+):
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at your
+// option) any later version.
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @file FileFilter.cpp
+ *
+ * @brief Implementation of FileFilter.
+ */
+// ID line follows -- this is updated by SVN
+// $Id$
+
+#include "stdafx.h"
+#include <vector>
+#include "pcre.h"
+#include "FileFilter.h"
+
+using std::vector;
+
+/**
+ * @brief Destructor, frees created filter lists.
+ */
+FileFilter::~FileFilter()
+{
+ EmptyFilterList(&filefilters);
+ EmptyFilterList(&dirfilters);
+}
+
+/**
+ * @brief Deletes items from filter list.
+ *
+ * @param [in] filterList List to empty.
+ */
+void FileFilter::EmptyFilterList(vector<FileFilterElement*> *filterList)
+{
+ while (!filterList->empty())
+ {
+ FileFilterElement *elem = filterList->back();
+ pcre_free(elem->pRegExp);
+ pcre_free(elem->pRegExpExtra);
+ delete elem;
+ filterList->pop_back();
+ }
+}
\ No newline at end of file
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// License (GPLv2+):
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+/////////////////////////////////////////////////////////////////////////////
+/**
+ * @file FileFilter.h
+ *
+ * @brief Declaration file for FileFilter
+ */
+// ID line follows -- this is updated by SVN
+// $Id$
+
+#include <vector>
+#include "pcre.h"
+
+/**
+ * @brief FileFilter rule.
+ *
+ * Contains one filtering element definition (rule). In addition to
+ * regular expression there is boolean value for defining if rule
+ * is inclusive or exclusive. File filters have global inclusive/exclusive
+ * selection but this per-rule setting overwrites it.
+ *
+ * We are using PCRE for regular expressions and pRegExp points to compiled
+ * regular expression. pRegExpExtra contains additional information about
+ * the expression used to optimize matching.
+ */
+struct FileFilterElement
+{
+ pcre *pRegExp; /**< Compiled regular expression */
+ pcre_extra *pRegExpExtra; /**< Additional information got from regex study */
+ FileFilterElement() : pRegExp(NULL), pRegExpExtra(NULL) { };
+};
+
+/**
+ * @brief One actual filter.
+ *
+ * For example, this might be a GNU C filter, excluding *.o files and CVS
+ * directories. That is to say, a filter is a set of file masks and
+ * directory masks. Usually FileFilter contains rules from one filter
+ * definition file. So it can be thought as filter file contents.
+ * @sa FileFilterList
+ */
+struct FileFilter
+{
+ bool default_include; /**< If true, filter rules are inclusive by default */
+ CString name; /**< Filter name (shown in UI) */
+ CString description; /**< Filter description text */
+ CString fullpath; /**< Full path to filter file */
+ std::vector<FileFilterElement*> filefilters; /**< List of rules for files */
+ std::vector<FileFilterElement*> dirfilters; /**< List of rules for directories */
+ FileFilter() : default_include(true) { }
+ ~FileFilter();
+
+ static void EmptyFilterList(std::vector<FileFilterElement*> *filterList);
+};
/////////////////////////////////////////////////////////////////////////////
-// FileFilterMgr.cpp : implementation file
-// see FileFilterMgr.h for description
-/////////////////////////////////////////////////////////////////////////////
// License (GPLv2+):
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
#include <string.h>
#include <vector>
#include "UnicodeString.h"
+#include "FileFilter.h"
#include "pcre.h"
#include "FileFilterMgr.h"
#include "UniFile.h"
using std::vector;
/**
- * @brief Deletes items from filter list.
- *
- * @param [in] filterList List to empty.
- */
-void EmptyFilterList(vector<FileFilterElement*> *filterList)
-{
- while (!filterList->empty())
- {
- FileFilterElement *elem = filterList->back();
- pcre_free(elem->pRegExp);
- pcre_free(elem->pRegExpExtra);
- delete elem;
- filterList->pop_back();
- }
-}
-
-/**
- * @brief One actual filter.
- *
- * For example, this might be a GNU C filter, excluding *.o files and CVS
- * directories. That is to say, a filter is a set of file masks and
- * directory masks. Usually FileFilter contains rules from one filter
- * definition file. So it can be thought as filter file contents.
- * @sa FileFilterList
- */
-struct FileFilter
-{
- bool default_include; /**< If true, filter rules are inclusive by default */
- CString name; /**< Filter name (shown in UI) */
- CString description; /**< Filter description text */
- CString fullpath; /**< Full path to filter file */
- vector<FileFilterElement*> filefilters; /**< List of rules for files */
- vector<FileFilterElement*> dirfilters; /**< List of rules for directories */
- FileFilter() : default_include(true) { }
- ~FileFilter();
-};
-
-/**
- * @brief Destructor, frees created filter lists.
- */
-FileFilter::~FileFilter()
-{
- EmptyFilterList(&filefilters);
- EmptyFilterList(&dirfilters);
-}
-
-/**
* @brief Destructor, frees all filters.
*/
FileFilterMgr::~FileFilterMgr()
#include "pcre.h"
struct FileFilterElement;
+struct FileFilter;
/**
* @brief Return values for many filter functions.
};
/**
- * @brief FileFilter rule.
- *
- * Contains one filtering element definition (rule). In addition to
- * regular expression there is boolean value for defining if rule
- * is inclusive or exclusive. File filters have global inclusive/exclusive
- * selection but this per-rule setting overwrites it.
- *
- * We are using PCRE for regular expressions and pRegExp points to compiled
- * regular expression. pRegExpExtra contains additional information about
- * the expression used to optimize matching.
- */
-struct FileFilterElement
-{
- pcre *pRegExp; /**< Compiled regular expression */
- pcre_extra *pRegExpExtra; /**< Additional information got from regex study */
- FileFilterElement() : pRegExp(NULL), pRegExpExtra(NULL) { };
-};
-
-struct FileFilter;
-
-/**
* @brief File filter manager for handling filefilters.
*
* The FileFilterMgr loads a collection of named file filters from disk,
</FileConfiguration>
</File>
<File
+ RelativePath="FileFilter.cpp">
+ <FileConfiguration
+ Name="UnicodeRelease|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="UnicodeDebug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BrowseInformation="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""
+ BrowseInformation="1"/>
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="1"
+ AdditionalIncludeDirectories=""
+ PreprocessorDefinitions=""/>
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="FileFilterHelper.cpp">
<FileConfiguration
Name="UnicodeRelease|Win32">
RelativePath="FileActionScript.h">
</File>
<File
+ RelativePath="FileFilter.h">
+ </File>
+ <File
RelativePath="FileFilterHelper.h">
</File>
<File
#include "Exceptions.h"
#include "RegKey.h"
#include "paths.h"
+#include "FileFilter.h"
#ifdef _DEBUG
#define new DEBUG_NEW
{
pArray->GetAt(i).m_lpDispatch->Release();
if (pArray->GetAt(i).m_filters)
- EmptyFilterList(pArray->GetAt(i).m_filters);
+ FileFilter::EmptyFilterList(pArray->GetAt(i).m_filters);
delete pArray->GetAt(i).m_filters;
}