Index: src/ch/TSubTaskBase.cpp =================================================================== diff -u --- src/ch/TSubTaskBase.cpp (revision 0) +++ src/ch/TSubTaskBase.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,37 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskBase.cpp +/// @date 2010/09/19 +/// @brief Contains implementation of some common subtask elements. +// ============================================================================ +#include "stdafx.h" +#include "TSubTaskBase.h" + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskBase + +TSubTaskBase::TSubTaskBase(TSubTaskContext& rContext, TSubTaskProgressInfo& rProgressInfo) : + m_rContext(rContext), + m_rProgressInfo(rProgressInfo) +{ +} + +TSubTaskBase::~TSubTaskBase() +{ +} Index: src/ch/TSubTaskBase.h =================================================================== diff -u --- src/ch/TSubTaskBase.h (revision 0) +++ src/ch/TSubTaskBase.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,45 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskBase.h +/// @date 2010/09/18 +/// @brief Contains declarations of common elements of sub-operations. +// ============================================================================ +#ifndef __TSUBTASKBASE_H__ +#define __TSUBTASKBASE_H__ + +class TSubTaskContext; +class TSubTaskProgressInfo; + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskBase + +class TSubTaskBase +{ +public: + TSubTaskBase(TSubTaskContext& rContext, TSubTaskProgressInfo& rProgressInfo); + virtual ~TSubTaskBase(); + + virtual void Exec() = 0; + +private: + TSubTaskContext& m_rContext; + TSubTaskProgressInfo& m_rProgressInfo; +}; + +#endif Index: src/ch/TSubTaskContext.cpp =================================================================== diff -u --- src/ch/TSubTaskContext.cpp (revision 0) +++ src/ch/TSubTaskContext.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,36 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskContext.cpp +/// @date 2010/09/19 +/// @brief Contains implementation of classes related to subtask context. +// ============================================================================ +#include "stdafx.h" +#include "TSubTaskContext.h" + +TSubTaskContext::TSubTaskContext(CClipboardArray& rSourcePaths, const CDestPath& rDestinationPath, TTaskConfiguration& rConfig) : + m_rSourcePaths(rSourcePaths), + m_rPathDestination(rDestinationPath), + m_rConfig(rConfig), + m_tFiles(rSourcePaths) +{ +} + +TSubTaskContext::~TSubTaskContext() +{ +} Index: src/ch/TSubTaskContext.h =================================================================== diff -u --- src/ch/TSubTaskContext.h (revision 0) +++ src/ch/TSubTaskContext.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,54 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskContext.h +/// @date 2010/09/19 +/// @brief Contains declaration of subtask context class. +// ============================================================================ +#ifndef __TSUBTASKCONTEXT_H__ +#define __TSUBTASKCONTEXT_H__ + +#include "FileInfo.h" + +class CClipboardArray; +class CDestPath; +class TTaskConfiguration; + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskContext + +class TSubTaskContext +{ +public: + TSubTaskContext(CClipboardArray& rSourcePaths, const CDestPath& rDestinationPath, TTaskConfiguration& rConfig); + ~TSubTaskContext(); + +private: + // input data + CClipboardArray& m_rSourcePaths; ///< Contains source paths to be processed + const CDestPath& m_rPathDestination; ///< Contains destination path for the data to be processed to + + // configuration data + TTaskConfiguration& m_rConfig; + + // data on which to operate + CFileInfoArray m_tFiles; +}; + + +#endif // __TSUBTASKCONTEXT_H__ \ No newline at end of file Index: src/ch/TSubTaskCopyMove.cpp =================================================================== diff -u --- src/ch/TSubTaskCopyMove.cpp (revision 0) +++ src/ch/TSubTaskCopyMove.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,24 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskCopyMove.cpp +/// @date 2010/09/19 +/// @brief Contains implementations of classes responsible for copy and move sub-operation. +// ============================================================================ +#include "stdafx.h" +#include "TSubTaskCopyMove.h" Index: src/ch/TSubTaskCopyMove.h =================================================================== diff -u --- src/ch/TSubTaskCopyMove.h (revision 0) +++ src/ch/TSubTaskCopyMove.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,26 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskCopyMove.h +/// @date 2010/09/18 +/// @brief Contains declarations of classes responsible for copy and move sub-operation. +// ============================================================================ +#ifndef __TSUBTASKCOPYMOVE_H__ +#define __TSUBTASKCOPYMOVE_H__ + +#endif Index: src/ch/TSubTaskDelete.cpp =================================================================== diff -u --- src/ch/TSubTaskDelete.cpp (revision 0) +++ src/ch/TSubTaskDelete.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,25 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskDelete.cpp +/// @date 2010/09/19 +/// @brief Contains implementation of classes responsible for delete sub-operation. +// ============================================================================ +#include "stdafx.h" +#include "TSubTaskDelete.h" + Index: src/ch/TSubTaskDelete.h =================================================================== diff -u --- src/ch/TSubTaskDelete.h (revision 0) +++ src/ch/TSubTaskDelete.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,27 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskDelete.h +/// @date 2010/09/18 +/// @brief Contains declarations of classes responsible for delete sub-operation. +// ============================================================================ +#ifndef __TSUBTASKDELETE_H__ +#define __TSUBTASKDELETE_H__ + + +#endif Index: src/ch/TSubTaskScanDirectory.cpp =================================================================== diff -u --- src/ch/TSubTaskScanDirectory.cpp (revision 0) +++ src/ch/TSubTaskScanDirectory.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,25 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskScanDirectory.cpp +/// @date 2010/09/18 +/// @brief Contains implementation of classes related to scan directory subtask. +// ============================================================================ +#include "stdafx.h" +#include "TSubTaskScanDirectory.h" + Index: src/ch/TSubTaskScanDirectory.h =================================================================== diff -u --- src/ch/TSubTaskScanDirectory.h (revision 0) +++ src/ch/TSubTaskScanDirectory.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TSubTaskScanDirectory.h +/// @date 2010/09/18 +/// @brief Contains declarations of classes responsible for directory scan sub-operation. +// ============================================================================ +#ifndef __TSUBTASKSCANDIRECTORY_H__ +#define __TSUBTASKSCANDIRECTORY_H__ + +#include "TSubTaskBase.h" + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskScanDirectories + +class TSubTaskScanDirectories : public TSubTaskBase +{ +public: + TSubTaskScanDirectories(); + virtual ~TSubTaskScanDirectories(); + + virtual void Exec(); +}; + +#endif Index: src/ch/TTaskConfiguration.cpp =================================================================== diff -u --- src/ch/TTaskConfiguration.cpp (revision 0) +++ src/ch/TTaskConfiguration.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,223 @@ +// ============================================================================ +// Copyright (C) 2001-2010 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. +// ============================================================================ +/// @file TTaskConfiguration.cpp +/// @date 2010/09/18 +/// @brief Contains implementation of class TTaskConfiguration. +// ============================================================================ +#include "stdafx.h" +#include "TTaskConfiguration.h" + + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskCommonConfig + +TSubTaskCommonConfig::TSubTaskCommonConfig() : + m_nPriority(THREAD_PRIORITY_NORMAL), + m_bDeleteAllFilesAfterAllCopyings(true), + m_bIgnoreReadOnlyAttributes(false) +{ +} + +TSubTaskCommonConfig::~TSubTaskCommonConfig() +{ +} + +void TSubTaskCommonConfig::SetPriority(int iPriority) +{ + boost::unique_lock lock(m_lock); + m_nPriority = iPriority; +} + +int TSubTaskCommonConfig::GetPriority() const +{ + boost::shared_lock lock(m_lock); + return m_nPriority; +} + +void TSubTaskCommonConfig::SetDeleteAllFilesAfterAllCopyings(bool bSeparateDelete) +{ + boost::unique_lock lock(m_lock); + m_bDeleteAllFilesAfterAllCopyings = bSeparateDelete; +} + +bool TSubTaskCommonConfig::GetDeleteAllFilesAfterAllCopyings() const +{ + boost::shared_lock lock(m_lock); + return m_bDeleteAllFilesAfterAllCopyings; +} + +void TSubTaskCommonConfig::SetIgnoreReadOnlyAttributes(bool bIgnoreReadOnlyAttributes) +{ + boost::unique_lock lock(m_lock); + m_bIgnoreReadOnlyAttributes = bIgnoreReadOnlyAttributes; +} + +bool TSubTaskCommonConfig::GetIgnoreReadOnlyAttributes() const +{ + boost::shared_lock lock(m_lock); + return m_bIgnoreReadOnlyAttributes; +} + +//////////////////////////////////////////////////////////////////////////// +// class TSubTaskScanDirectoriesConfig + +TSubTaskScanDirectoriesConfig::TSubTaskScanDirectoriesConfig() +{ +} + +TSubTaskScanDirectoriesConfig::~TSubTaskScanDirectoriesConfig() +{ +} + +void TSubTaskScanDirectoriesConfig::SetFilters(const CFiltersArray& rFilters) +{ + boost::unique_lock lock(m_lock); + m_afFilters = rFilters; +} + +//////////////////////////////////////////////////////////////////////////// +// class TSubTaskCopyMoveConfig + +TSubTaskCopyMoveConfig::TSubTaskCopyMoveConfig() : + m_bDisableSystemBuffering(false), + m_ullMinSizeToDisableBuffering(0), + m_bPreserveFileDateTime(false), + m_bPreserveFileAttributes(false), + m_bIgnoreDirectories(false), + m_bCreateEmptyFiles(false), + m_bCreateOnlyDirectories(false) +{ + m_bsSizes.m_uiDefaultSize = 0; + m_bsSizes.m_uiOneDiskSize = 0; + m_bsSizes.m_uiTwoDisksSize = 0; + m_bsSizes.m_uiCDSize = 0; + m_bsSizes.m_uiLANSize = 0; + m_bsSizes.m_bOnlyDefault = false; +} + +TSubTaskCopyMoveConfig::~TSubTaskCopyMoveConfig() +{ +} + +void TSubTaskCopyMoveConfig::SetDisableSystemBuffering(bool bDisableBuffering) +{ + boost::unique_lock lock(m_lock); + m_bDisableSystemBuffering = bDisableBuffering; +} + +bool TSubTaskCopyMoveConfig::GetDisableSystemBuffering() const +{ + boost::shared_lock lock(m_lock); + return m_bDisableSystemBuffering; +} + +void TSubTaskCopyMoveConfig::SetMinSizeToDisableBuffering(unsigned long long ullMinSize) +{ + boost::unique_lock lock(m_lock); + m_ullMinSizeToDisableBuffering = ullMinSize; +} + +unsigned long long TSubTaskCopyMoveConfig::GetMinSizeToDisableBuffering() const +{ + boost::shared_lock lock(m_lock); + return m_ullMinSizeToDisableBuffering; +} + +void TSubTaskCopyMoveConfig::SetPreserveFileDateTime(bool bPreserve) +{ + boost::unique_lock lock(m_lock); + m_bPreserveFileDateTime = bPreserve; +} + +bool TSubTaskCopyMoveConfig::GetPreserveFileDateTime() const +{ + boost::shared_lock lock(m_lock); + return m_bPreserveFileDateTime; +} + +void TSubTaskCopyMoveConfig::SetPreserveFileAttributes(bool bPreserve) +{ + boost::unique_lock lock(m_lock); + m_bPreserveFileAttributes = bPreserve; +} + +bool TSubTaskCopyMoveConfig::GetPreserveFileAttributes() const +{ + boost::shared_lock lock(m_lock); + return m_bPreserveFileAttributes; +} + +void TSubTaskCopyMoveConfig::SetBufferSizes(const BUFFERSIZES& bsSizes) +{ + boost::unique_lock lock(m_lock); + m_bsSizes = bsSizes; +} + +BUFFERSIZES TSubTaskCopyMoveConfig::GetBufferSizes() const +{ + boost::shared_lock lock(m_lock); + return m_bsSizes; +} + +void TSubTaskCopyMoveConfig::SetIgnoreDirectories(bool bIgnore) +{ + boost::unique_lock lock(m_lock); + m_bIgnoreDirectories = bIgnore; +} + +bool TSubTaskCopyMoveConfig::GetIgnoreDirectories() const +{ + boost::shared_lock lock(m_lock); + return m_bIgnoreDirectories; +} + +void TSubTaskCopyMoveConfig::SetCreateEmptyFiles(bool bCreateEmpty) +{ + boost::unique_lock lock(m_lock); + m_bCreateEmptyFiles = bCreateEmpty; +} + +bool TSubTaskCopyMoveConfig::GetCreateEmptyFiles() const +{ + boost::shared_lock lock(m_lock); + return m_bCreateEmptyFiles; +} + +void TSubTaskCopyMoveConfig::SetCreateOnlyDirectories(bool bCreateOnlyDirs) +{ + boost::unique_lock lock(m_lock); + m_bCreateOnlyDirectories = bCreateOnlyDirs; +} + +bool TSubTaskCopyMoveConfig::GetCreateOnlyDirectories() const +{ + boost::shared_lock lock(m_lock); + return m_bCreateOnlyDirectories; +} + +//////////////////////////////////////////////////////////////////////////// +// class TTaskConfiguration + +TTaskConfiguration::TTaskConfiguration() +{ +} + +TTaskConfiguration::~TTaskConfiguration() +{ +} Index: src/ch/TTaskConfiguration.h =================================================================== diff -u --- src/ch/TTaskConfiguration.h (revision 0) +++ src/ch/TTaskConfiguration.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,193 @@ +// ============================================================================ +// Copyright (C) 2001-2010 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. +// ============================================================================ +/// @file TTaskConfiguration.h +/// @date 2010/09/18 +/// @brief Contains class responsible for keeping task configuration. +// ============================================================================ +#ifndef __TTASKCONFIGURATION_H__ +#define __TTASKCONFIGURATION_H__ + +#include "FileInfo.h" +#include "FileFilter.h" +#include "DataBuffer.h" + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskCommonConfig +class TSubTaskCommonConfig +{ +public: + TSubTaskCommonConfig(); + ~TSubTaskCommonConfig(); + + void SetPriority(int iPriority); + int GetPriority() const; + + void SetDeleteAllFilesAfterAllCopyings(bool bSeparateDelete); + bool GetDeleteAllFilesAfterAllCopyings() const; + + void SetIgnoreReadOnlyAttributes(bool bIgnoreReadOnlyAttributes); + bool GetIgnoreReadOnlyAttributes() const; + + template + void load(Archive& ar) + { + boost::unique_lock lock(m_lock); + + ar >> m_nPriority; + ar >> m_bDeleteAllFilesAfterAllCopyings; + ar >> m_bIgnoreReadOnlyAttributes; + } + + template + void save(Archive& ar) + { + boost::shared_lock lock(m_lock); + + ar << m_nPriority; + ar << m_bDeleteAllFilesAfterAllCopyings; + ar << m_bIgnoreReadOnlyAttributes; + } + + BOOST_SERIALIZATION_SPLIT_MEMBER(); + +private: + int m_nPriority; // task priority (really processing thread priority) + bool m_bDeleteAllFilesAfterAllCopyings; ///< Delete mode; true means that deleting files is a separate sub-operation launched after copying, false states that file is deleted immediately after being copied + bool m_bIgnoreReadOnlyAttributes; // ignore read-only attributes on files (delete/overwrite) -> this should be handled by feedback requests probably + + mutable boost::shared_mutex m_lock; +}; + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskScanDirectoriesConfig + +class TSubTaskScanDirectoriesConfig +{ +public: + TSubTaskScanDirectoriesConfig(); + ~TSubTaskScanDirectoriesConfig(); + + // filtering rules + void SetFilters(const CFiltersArray& rFilters); + const CFiltersArray& GetFilters() const { return m_afFilters; } + + template + void load(Archive& ar) + { + boost::unique_lock lock(m_lock); + ar >> m_afFilters; + } + + template + void save(Archive& ar) + { + boost::shared_lock lock(m_lock); + ar << m_afFilters; + } + + BOOST_SERIALIZATION_SPLIT_MEMBER(); + +private: + CFiltersArray m_afFilters; // filtering settings for files (will be filtered according to the rules inside when searching for files) + + mutable boost::shared_mutex m_lock; +}; + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskCopyMoveConfig + +class TSubTaskCopyMoveConfig +{ +public: + TSubTaskCopyMoveConfig(); + ~TSubTaskCopyMoveConfig(); + + void SetDisableSystemBuffering(bool bDisableBuffering); + bool GetDisableSystemBuffering() const; + + void SetMinSizeToDisableBuffering(unsigned long long ullMinSize); + unsigned long long GetMinSizeToDisableBuffering() const; + + void SetPreserveFileDateTime(bool bPreserve); + bool GetPreserveFileDateTime() const; + + void SetPreserveFileAttributes(bool bPreserve); + bool GetPreserveFileAttributes() const; + + void SetBufferSizes(const BUFFERSIZES& bsSizes); + BUFFERSIZES GetBufferSizes() const; + + void SetIgnoreDirectories(bool bIgnore); + bool GetIgnoreDirectories() const; + + void SetCreateEmptyFiles(bool bCreateEmpty); + bool GetCreateEmptyFiles() const; + + void SetCreateOnlyDirectories(bool bCreateOnlyDirs); + bool GetCreateOnlyDirectories() const; + +private: + bool m_bDisableSystemBuffering; ///< Disables system buffering of files + unsigned long long m_ullMinSizeToDisableBuffering; ///< Minimal file size to disable system buffering + + bool m_bPreserveFileDateTime; + bool m_bPreserveFileAttributes; + + BUFFERSIZES m_bsSizes; // sizes of buffers used to copy + + bool m_bIgnoreDirectories; + bool m_bCreateEmptyFiles; + bool m_bCreateOnlyDirectories; + + mutable boost::shared_mutex m_lock; +}; + +/////////////////////////////////////////////////////////////////////////// +// TSubTaskDeleteConfig + +/* +class TSubTaskDeleteConfig +{ +private: + mutable boost::shared_mutex m_lock; +}; +*/ + +/////////////////////////////////////////////////////////////////////////// +// TTaskConfiguration + +class TTaskConfiguration +{ +public: + TTaskConfiguration(); + ~TTaskConfiguration(); + + const TSubTaskCommonConfig& GetCommonConfig() const { return m_tCommonConfig; } + const TSubTaskScanDirectoriesConfig& GetScanDirectoriesConfig() const { return m_tScanDirectoriesConfig; } + const TSubTaskCopyMoveConfig& GetCopyMoveConfig() const { return m_tCopyMoveConfig; } +// const TSubTaskDeleteConfig& GetDeleteConfig() const { return m_tDeleteConfig; } + +private: + TSubTaskCommonConfig m_tCommonConfig; + TSubTaskScanDirectoriesConfig m_tScanDirectoriesConfig; + TSubTaskCopyMoveConfig m_tCopyMoveConfig; +// TSubTaskDeleteConfig m_tDeleteConfig; +}; + +#endif Index: src/ch/TTaskDefinition.cpp =================================================================== diff -u --- src/ch/TTaskDefinition.cpp (revision 0) +++ src/ch/TTaskDefinition.cpp (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,98 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TTaskDefinition.cpp +/// @date 2010/09/18 +/// @brief Contains implementation of class representing task input data. +// ============================================================================ +#include "stdafx.h" +#include +#include +#include +#include +#include "TTaskDefinition.h" + +TTaskDefinition::TTaskDefinition() : + m_bNeedsSaving(false), + m_strTaskUniqueID() +{ + boost::uuids::random_generator gen; + boost::uuids::uuid u = gen(); + m_strTaskUniqueID = boost::lexical_cast(u); +} + +TTaskDefinition::~TTaskDefinition() +{ +} + +// initialize object with data (get/set, from cfg file?, from string(cmd line options)) +void TTaskDefinition::AddSourcePath(const CString& strPath) +{ + CClipboardEntryPtr spEntry(boost::make_shared()); + spEntry->SetPath(strPath); + + m_arrSourcePaths.Add(spEntry); +} + +CString TTaskDefinition::GetSourcePathAt(size_t stIndex) const +{ + CClipboardEntryPtr spEntry = m_arrSourcePaths.GetAt(stIndex); + if(spEntry) + return spEntry->GetPath(); + return CString(); +} + +size_t TTaskDefinition::GetSourcePathCount() const +{ + return m_arrSourcePaths.GetSize(); +} + +void TTaskDefinition::ClearSourcePaths() +{ + m_arrSourcePaths.RemoveAll(); +} + +void TTaskDefinition::SetDestinationPath(const CString& strPath) +{ + m_tDestinationPath.SetPath(strPath); +} + +CString TTaskDefinition::GetDestinationPath() const +{ + return m_tDestinationPath.GetPath(); +} + +void TTaskDefinition::SetOperationType(EOperationType eOperation) +{ + m_tOperationPlan.SetOperationType(eOperation); +} + +EOperationType TTaskDefinition::GetOperationType() const +{ + return m_tOperationPlan.GetOperationType(); +} + +TTaskConfiguration& TTaskDefinition::GetConfiguration() +{ + return m_tOperationConfiguration; +} + +const TTaskConfiguration& TTaskDefinition::GetConfiguration() const +{ + return m_tOperationConfiguration; +} Index: src/ch/TTaskDefinition.h =================================================================== diff -u --- src/ch/TTaskDefinition.h (revision 0) +++ src/ch/TTaskDefinition.h (revision b7709acbab26fdb108b77d3e08d3872f54248af2) @@ -0,0 +1,96 @@ +// ============================================================================ +// Copyright (C) 2001-2009 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. +// ============================================================================ +/// @file TTaskDefinition.h +/// @date 2010/09/18 +/// @brief Contains declaration of class representing task input data. +// ============================================================================ +#ifndef __TTASKDEFINITION_H__ +#define __TTASKDEFINITION_H__ + +#include "TTaskOperationPlan.h" +#include "TTaskConfiguration.h" + +/////////////////////////////////////////////////////////////////////////// +// TTaskDefinition + +class TTaskDefinition +{ +public: + TTaskDefinition(); + ~TTaskDefinition(); + + // initialize object with data (get/set, from cfg file?, from string(cmd line options)) + void AddSourcePath(const CString& strPath); + CString GetSourcePathAt(size_t stIndex) const; + size_t GetSourcePathCount() const; + void ClearSourcePaths(); + + void SetDestinationPath(const CString& strPath); + CString GetDestinationPath() const; + + void SetOperationType(EOperationType eOperation); + EOperationType GetOperationType() const; + + TTaskConfiguration& GetConfiguration(); + const TTaskConfiguration& GetConfiguration() const; + + // serialize (from/to xml) + template + void load(Archive& ar) + { + ar & m_strTaskUniqueID; + ar & m_arrSourcePaths; + ar & m_tDestinationPath; + ar & m_tOperationPlan; + ar & m_tOperationConfiguration; + + m_bNeedsSaving = false; + } + + template + void save(Archive& ar) + { + ar & m_strTaskUniqueID; + ar & m_arrSourcePaths; + ar & m_tDestinationPath; + ar & m_tOperationPlan; + ar & m_tOperationConfiguration; + + m_bNeedsSaving = false; + } + + BOOST_SERIALIZATION_SPLIT_MEMBER(); + +private: + std::wstring m_strTaskUniqueID; ///< Unique ID of the task that will process this request (generated automatically) + + // basic information + CClipboardArray m_arrSourcePaths; ///< Contains source paths to be processed + CDestPath m_tDestinationPath; ///< Contains destination path for the data to be processed to + + TOperationPlan m_tOperationPlan; ///< Describes the operation along with sub-operations to be performed on the task input data + + // Global task settings + TTaskConfiguration m_tOperationConfiguration; + + // Other info (volatile, not to be saved to xml) + bool m_bNeedsSaving; ///< Some parameters has been modified and this object needs to be serialized again +}; + +#endif // __TTASKDEFINITION_H__