Index: src/ch/CustomCopyDlg.cpp =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/ch/CustomCopyDlg.cpp (.../CustomCopyDlg.cpp) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -278,7 +278,7 @@ lvc.cx=static_cast(0.1*rc.Width()); m_ctlFilters.InsertColumn(6, &lvc); - chcore::TFiltersArray afFilters; + chcore::TFileFiltersArray afFilters; chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration(), afFilters); m_bFilters = !afFilters.IsEmpty(); @@ -379,7 +379,7 @@ m_ctlFilters.InsertColumn(6, &lvc); // refresh the entries in filters' list - chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFileFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); m_ctlFilters.DeleteAllItems(); for(size_t stIndex = 0; stIndex < afFilters.GetSize(); ++stIndex) { @@ -593,7 +593,7 @@ CFilterDlg dlg; chcore::TString strData; - chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFileFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); for (size_t i = 0; i < afFilters.GetSize(); i++) { const chcore::TFileFilter* pFilter = afFilters.GetAt(i); @@ -760,7 +760,7 @@ void CCustomCopyDlg::OnRemovefilterButton() { - chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFileFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); POSITION pos; int iItem; @@ -821,7 +821,7 @@ POSITION pos = m_ctlFilters.GetFirstSelectedItemPosition(); if(pos != NULL) { - chcore::TFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); + chcore::TFileFiltersArray afFilters = chcore::GetTaskPropValue(m_tTaskDefinition.GetConfiguration()); int iItem = m_ctlFilters.GetNextSelectedItem(pos); CFilterDlg dlg; Index: src/ch/CustomCopyDlg.h =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/CustomCopyDlg.h (.../CustomCopyDlg.h) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -20,7 +20,7 @@ #define __CUSTOMCOPYDLG_H__ #include "../libchcore/DataBuffer.h" -#include "../libchcore/FileFilter.h" +#include "../libchcore/TFileFilter.h" #include "../libchcore/TTaskDefinition.h" ///////////////////////////////////////////////////////////////////////////// Index: src/ch/FilterDlg.cpp =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/ch/FilterDlg.cpp (.../FilterDlg.cpp) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/ch/FilterDlg.cpp (.../FilterDlg.cpp) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -18,7 +18,7 @@ ***************************************************************************/ #include "stdafx.h" #include "../libchcore/TFileInfo.h" -#include "../libchcore/FileFilter.h" +#include "../libchcore/TFileFilter.h" #include "ch.h" #include "FilterDlg.h" Fisheye: tag 25b3c85ea493809ee084271d5101a015d349da95 is not in file src/libchcore/TFileFilter.cpp Fisheye: Tag ba802caea92ee56a154d1da3fe89a4b2f7875f0e refers to a dead (removed) revision in file `src/libchcore/FileFilter.cpp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: tag 25b3c85ea493809ee084271d5101a015d349da95 is not in file src/libchcore/TFileFilter.h Fisheye: Tag ba802caea92ee56a154d1da3fe89a4b2f7875f0e refers to a dead (removed) revision in file `src/libchcore/FileFilter.h'. Fisheye: No comparison available. Pass `N' to diff? Index: src/libchcore/TFileFiltersArray.cpp =================================================================== diff -u --- src/libchcore/TFileFiltersArray.cpp (revision 0) +++ src/libchcore/TFileFiltersArray.cpp (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -0,0 +1,144 @@ +/*************************************************************************** +* Copyright (C) 2001-2008 by Jozef Starosczyk * +* ixen@copyhandler.com * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU Library General Public License * +* (version 2) as published by the Free Software Foundation; * +* * +* 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 Library General Public * +* License along with this program; if not, write to the * +* Free Software Foundation, Inc., * +* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * +***************************************************************************/ +#include "stdafx.h" +#include "TFileFiltersArray.h" +#include "TFileInfo.h" +#include "TConfig.h" +#include "TBinarySerializer.h" +#include "SerializationHelpers.h" + +BEGIN_CHCORE_NAMESPACE + +TFileFiltersArray& TFileFiltersArray::operator=(const TFileFiltersArray& rSrc) +{ + if(this != &rSrc) + { + m_vFilters = rSrc.m_vFilters; + } + + return *this; +} + +bool TFileFiltersArray::Match(const TFileInfoPtr& spInfo) const +{ + if(m_vFilters.empty()) + return true; + + // if only one of the filters matches - return true + for(std::vector::const_iterator iterFilter = m_vFilters.begin(); iterFilter != m_vFilters.end(); iterFilter++) + { + if((*iterFilter).Match(spInfo)) + return true; + } + + return false; +} + +void TFileFiltersArray::StoreInConfig(TConfig& rConfig, PCTSTR pszNodeName) const +{ + rConfig.DeleteNode(pszNodeName); + BOOST_FOREACH(const TFileFilter& rFilter, m_vFilters) + { + TConfig cfgNode; + rFilter.StoreInConfig(cfgNode); + rConfig.AddSubConfig(TString(pszNodeName) + _T(".FilterDefinition"), cfgNode); + } +} + +bool TFileFiltersArray::ReadFromConfig(const TConfig& rConfig, PCTSTR pszNodeName) +{ + m_vFilters.clear(); + + TConfigArray vConfigs; + if(!rConfig.ExtractMultiSubConfigs(pszNodeName, vConfigs)) + return false; + + for(size_t stIndex = 0; stIndex < vConfigs.GetCount(); ++stIndex) + { + const TConfig& rCfg = vConfigs.GetAt(stIndex); + TFileFilter tFilter; + tFilter.ReadFromConfig(rCfg); + + m_vFilters.push_back(tFilter); + } + return true; +} + +void TFileFiltersArray::Serialize(TReadBinarySerializer& rSerializer) +{ + using Serializers::Serialize; + Serialize(rSerializer, m_vFilters); +} + +void TFileFiltersArray::Serialize(TWriteBinarySerializer& rSerializer) const +{ + using Serializers::Serialize; + Serialize(rSerializer, m_vFilters); +} + +bool TFileFiltersArray::IsEmpty() const +{ + return m_vFilters.empty(); +} + +void TFileFiltersArray::Add(const TFileFilter& rFilter) +{ + m_vFilters.push_back(rFilter); +} + +bool TFileFiltersArray::SetAt(size_t stIndex, const TFileFilter& rNewFilter) +{ + BOOST_ASSERT(stIndex < m_vFilters.size()); + if(stIndex < m_vFilters.size()) + { + TFileFilter& rFilter = m_vFilters.at(stIndex); + rFilter = rNewFilter; + return true; + } + else + return false; +} + +const TFileFilter* TFileFiltersArray::GetAt(size_t stIndex) const +{ + BOOST_ASSERT(stIndex < m_vFilters.size()); + if(stIndex < m_vFilters.size()) + return &m_vFilters.at(stIndex); + else + return NULL; +} + +bool TFileFiltersArray::RemoveAt(size_t stIndex) +{ + BOOST_ASSERT(stIndex < m_vFilters.size()); + if(stIndex < m_vFilters.size()) + { + m_vFilters.erase(m_vFilters.begin() + stIndex); + return true; + } + else + return false; +} + +size_t TFileFiltersArray::GetSize() const +{ + return m_vFilters.size(); +} + +END_CHCORE_NAMESPACE Index: src/libchcore/TFileFiltersArray.h =================================================================== diff -u --- src/libchcore/TFileFiltersArray.h (revision 0) +++ src/libchcore/TFileFiltersArray.h (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2001-2008 by Jozef Starosczyk * + * ixen@copyhandler.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Library General Public License * + * (version 2) as published by the Free Software Foundation; * + * * + * 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 Library General Public * + * License along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef __TFILEFILTERSARRAY_H__ +#define __TFILEFILTERSARRAY_H__ + +#include "libchcore.h" +#include "TFileFilter.h" + +BEGIN_CHCORE_NAMESPACE + +class TConfig; +class TFileInfo; +typedef boost::shared_ptr TFileInfoPtr; +class TReadBinarySerializer; +class TWriteBinarySerializer; + +class LIBCHCORE_API TFileFiltersArray +{ +public: + TFileFiltersArray() {} + ~TFileFiltersArray() {} + + TFileFiltersArray& operator=(const TFileFiltersArray& rSrc); + bool Match(const TFileInfoPtr& spInfo) const; + + void StoreInConfig(TConfig& rConfig, PCTSTR pszNodeName) const; + bool ReadFromConfig(const TConfig& rConfig, PCTSTR pszNodeName); + + void Serialize(TReadBinarySerializer& rSerializer); + void Serialize(TWriteBinarySerializer& rSerializer) const; + + bool IsEmpty() const; + + void Add(const TFileFilter& rFilter); + bool SetAt(size_t stIndex, const TFileFilter& rNewFilter); + const TFileFilter* GetAt(size_t stIndex) const; + bool RemoveAt(size_t stIndex); + size_t GetSize() const; + +private: +#pragma warning(push) +#pragma warning(disable: 4251) + std::vector m_vFilters; +#pragma warning(pop) +}; + +END_CHCORE_NAMESPACE + +CONFIG_MEMBER_SERIALIZATION(TFileFiltersArray) + +#endif Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -68,7 +68,7 @@ rFilesCache.Clear(); // read filtering options - TFiltersArray afFilters; + TFileFiltersArray afFilters; GetTaskPropValue(rTaskDefinition.GetConfiguration(), afFilters); // enter some data to rFilesCache @@ -224,7 +224,7 @@ return eSubResult_Continue; } -int TSubTaskScanDirectories::ScanDirectory(TSmartPath pathDirName, size_t stSrcIndex, bool bRecurse, bool bIncludeDirs, TFiltersArray& afFilters) +int TSubTaskScanDirectories::ScanDirectory(TSmartPath pathDirName, size_t stSrcIndex, bool bRecurse, bool bIncludeDirs, TFileFiltersArray& afFilters) { TFileInfoArray& rFilesCache = GetContext().GetFilesCache(); TTaskDefinition& rTaskDefinition = GetContext().GetTaskDefinition(); Index: src/libchcore/TSubTaskScanDirectory.h =================================================================== diff -u -r4d20d0e58f37f06ac91287015b960308db54d47e -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision 4d20d0e58f37f06ac91287015b960308db54d47e) +++ src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -26,10 +26,11 @@ #include "libchcore.h" #include "TSubTaskBase.h" #include "TPath.h" -#include "FileFilter.h" BEGIN_CHCORE_NAMESPACE +class TFileFiltersArray; + /////////////////////////////////////////////////////////////////////////// // TSubTaskScanDirectories @@ -42,7 +43,7 @@ virtual ESubOperationResult Exec(); private: - int ScanDirectory(TSmartPath pathDirName, size_t stSrcIndex, bool bRecurse, bool bIncludeDirs, TFiltersArray& afFilters); + int ScanDirectory(TSmartPath pathDirName, size_t stSrcIndex, bool bRecurse, bool bIncludeDirs, TFileFiltersArray& afFilters); }; END_CHCORE_NAMESPACE Index: src/libchcore/TTask.h =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/libchcore/TTask.h (.../TTask.h) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/libchcore/TTask.h (.../TTask.h) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -63,7 +63,7 @@ size_t m_stSize; TSmartPath m_pathDstPath; - TFiltersArray* m_pafFilters; + TFileFiltersArray* m_pafFilters; ETaskCurrentState m_eTaskState; EOperationType m_eOperationType; @@ -224,7 +224,7 @@ TTaskLocalStats m_localStats; // local statistics // task settings - TFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files) + TFileFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files) bool m_bForce; // if the continuation of tasks should be independent of max concurrently running task limit bool m_bContinue; // allows task to continue Index: src/libchcore/TTaskConfiguration.h =================================================================== diff -u -r4d20d0e58f37f06ac91287015b960308db54d47e -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/libchcore/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision 4d20d0e58f37f06ac91287015b960308db54d47e) +++ src/libchcore/TTaskConfiguration.h (.../TTaskConfiguration.h) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -25,7 +25,7 @@ #include "libchcore.h" #include "TConfig.h" -#include "FileFilter.h" +#include "TFileFiltersArray.h" BEGIN_CHCORE_NAMESPACE @@ -119,7 +119,7 @@ TASK_PROPERTY(eTO_CreateDirectoriesRelativeToRoot, bool, _T("Operation.CreateDirectoriesRelativeToRoot"), false); TASK_PROPERTY(eTO_IgnoreDirectories, bool, _T("Operation.IgnoreDirectories"), false); -TASK_PROPERTY(eTO_Filters, chcore::TFiltersArray, _T("Operation.Filtering"), chcore::TFiltersArray()); +TASK_PROPERTY(eTO_Filters, chcore::TFileFiltersArray, _T("Operation.Filtering"), chcore::TFileFiltersArray()); // Naming settings TASK_PROPERTY(eTO_AlternateFilenameFormatString_First, TString, _T("Naming.AlternateFilenameFormatFirst"), _T("Copy of %name")); Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -r25b3c85ea493809ee084271d5101a015d349da95 -rba802caea92ee56a154d1da3fe89a4b2f7875f0e --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision 25b3c85ea493809ee084271d5101a015d349da95) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision ba802caea92ee56a154d1da3fe89a4b2f7875f0e) @@ -348,34 +348,42 @@ > + + + +