Index: src/ch/FilterDlg.cpp =================================================================== diff -u -r63369021254e8b67ffeef5a9ece1b5a70df881c4 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/ch/FilterDlg.cpp (.../FilterDlg.cpp) (revision 63369021254e8b67ffeef5a9ece1b5a70df881c4) +++ src/ch/FilterDlg.cpp (.../FilterDlg.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -360,7 +360,7 @@ m_ffFilter.SetSize2(static_cast(m_uiSize2)*static_cast(GetMultiplier(m_ctlSize2Multi.GetCurSel()))); // date - m_ffFilter.SetDateType((chengine::TFileFilter::EDateType)m_ctlDateType.GetCurSel()); + m_ffFilter.SetDateType((chengine::EDateType)m_ctlDateType.GetCurSel()); m_ffFilter.SetDateCmpType1((chengine::ECompareType)m_ctlDateType1.GetCurSel()); m_ffFilter.SetDateCmpType2((chengine::ECompareType)m_ctlDateType2.GetCurSel()); Index: src/libchengine/ECompareTypeMapper.cpp =================================================================== diff -u --- src/libchengine/ECompareTypeMapper.cpp (revision 0) +++ src/libchengine/ECompareTypeMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,37 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "ECompareTypeMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetCompareTypeMapper() + { + static serializer::DataMapper compareTypeMapper = { + { eCmp_Less, L"less" }, + { eCmp_LessOrEqual, L"less-equal" }, + { eCmp_Equal, L"equal" }, + { eCmp_GreaterOrEqual, L"greater-equal" }, + { eCmp_Greater, L"greater" }, + { eCmp_NotEqual, L"not-equal" } + }; + + return compareTypeMapper; + } +} Index: src/libchengine/ECompareTypeMapper.h =================================================================== diff -u --- src/libchengine/ECompareTypeMapper.h (revision 0) +++ src/libchengine/ECompareTypeMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "ECompareType.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetCompareTypeMapper(); +} + +template<> +inline string::TString MapEnum(chengine::ECompareType eValue) +{ + return chengine::GetCompareTypeMapper().Map(eValue); +} + +template<> +inline chengine::ECompareType UnmapEnum(const string::TString& strValue) +{ + return chengine::GetCompareTypeMapper().Unmap(strValue); +} Index: src/libchengine/EDateType.h =================================================================== diff -u --- src/libchengine/EDateType.h (revision 0) +++ src/libchengine/EDateType.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,29 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +namespace chengine +{ + enum EDateType + { + eDateType_Created = 0, + eDateType_Modified = 1, + eDateType_LastAccessed = 2 + }; +} Index: src/libchengine/EDateTypeMapper.cpp =================================================================== diff -u --- src/libchengine/EDateTypeMapper.cpp (revision 0) +++ src/libchengine/EDateTypeMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,34 @@ +{ // ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "EDateTypeMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetDateTypeMapper() + { + static serializer::DataMapper compareTypeMapper = { + { eDateType_Created, L"created"}, + { eDateType_Modified, L"modified"}, + { eDateType_LastAccessed, L"last-accessed"} + }; + + return compareTypeMapper; + } +} Index: src/libchengine/EDateTypeMapper.h =================================================================== diff -u --- src/libchengine/EDateTypeMapper.h (revision 0) +++ src/libchengine/EDateTypeMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "EDateType.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetDateTypeMapper(); +} + +template<> +inline string::TString MapEnum(chengine::EDateType eValue) +{ + return chengine::GetDateTypeMapper().Map(eValue); +} + +template<> +inline chengine::EDateType UnmapEnum(const string::TString& strValue) +{ + return chengine::GetDateTypeMapper().Unmap(strValue); +} Index: src/libchengine/EFeedbackResultMapper.cpp =================================================================== diff -u --- src/libchengine/EFeedbackResultMapper.cpp (revision 0) +++ src/libchengine/EFeedbackResultMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "EFeedbackResultMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetFeedbackResultMapper() + { + static serializer::DataMapper compareTypeMapper = { + { eResult_Unknown, L"unknown" }, + { eResult_Overwrite, L"overwrite" }, + { eResult_CopyRest, L"resume" }, + { eResult_Skip, L"skip" }, + { eResult_Cancel, L"cancel" }, + { eResult_Pause, L"pause" }, + { eResult_Retry, L"retry" }, + { eResult_Ignore, L"ignore" }, + { eResult_Rename, L"rename" } + }; + + return compareTypeMapper; + } +} Index: src/libchengine/EFeedbackResultMapper.h =================================================================== diff -u --- src/libchengine/EFeedbackResultMapper.h (revision 0) +++ src/libchengine/EFeedbackResultMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "EFeedbackResult.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetFeedbackResultMapper(); +} + +template<> +inline string::TString MapEnum(chengine::EFeedbackResult eValue) +{ + return chengine::GetFeedbackResultMapper().Map(eValue); +} + +template<> +inline chengine::EFeedbackResult UnmapEnum(const string::TString& strValue) +{ + return chengine::GetFeedbackResultMapper().Unmap(strValue); +} Index: src/libchengine/EFileErrorMapper.cpp =================================================================== diff -u --- src/libchengine/EFileErrorMapper.cpp (revision 0) +++ src/libchengine/EFileErrorMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,41 @@ +{ // ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "EFileErrorMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetFileErrorMapper() + { + static serializer::DataMapper compareTypeMapper = { + { eDeleteError, L"delete" }, + { eSeekError, L"seek" }, + { eResizeError, L"resize" }, + { eReadError, L"read" }, + { eWriteError, L"write" }, + { eFinalizeError, L"finalize" }, + { eFastMoveError, L"fast-move" }, + { eCreateError, L"create" }, + { eCheckForFreeSpace, L"check-free-space" }, + { eRetrieveFileInfo, L"retrieve-file-info" }, + }; + + return compareTypeMapper; + } +} Index: src/libchengine/EFileErrorMapper.h =================================================================== diff -u --- src/libchengine/EFileErrorMapper.h (revision 0) +++ src/libchengine/EFileErrorMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "EFileError.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetFileErrorMapper(); +} + +template<> +inline string::TString MapEnum(chengine::EFileError eValue) +{ + return chengine::GetFileErrorMapper().Map(eValue); +} + +template<> +inline chengine::EFileError UnmapEnum(const string::TString& strValue) +{ + return chengine::GetFileErrorMapper().Unmap(strValue); +} Index: src/libchengine/EOperationEventMapper.cpp =================================================================== diff -u --- src/libchengine/EOperationEventMapper.cpp (revision 0) +++ src/libchengine/EOperationEventMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,33 @@ +{ // ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "EOperationEventMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetOperationEventMapper() + { + static serializer::DataMapper compareTypeMapper = { + { eOperationEvent_Finished, L"finished" }, + { eOperationEvent_Error, L"error" }, + }; + + return compareTypeMapper; + } +} Index: src/libchengine/EOperationEventMapper.h =================================================================== diff -u --- src/libchengine/EOperationEventMapper.h (revision 0) +++ src/libchengine/EOperationEventMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "EOperationEvent.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetOperationEventMapper(); +} + +template<> +inline string::TString MapEnum(chengine::EOperationEvent eValue) +{ + return chengine::GetOperationEventMapper().Map(eValue); +} + +template<> +inline chengine::EOperationEvent UnmapEnum(const string::TString& strValue) +{ + return chengine::GetOperationEventMapper().Unmap(strValue); +} Index: src/libchengine/EOperationTypesMapper.cpp =================================================================== diff -u --- src/libchengine/EOperationTypesMapper.cpp (revision 0) +++ src/libchengine/EOperationTypesMapper.cpp (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,33 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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 "EOperationTypesMapper.h" + +namespace chengine +{ + const serializer::DataMapper& GetCompareTypeMapper() + { + static serializer::DataMapper compareTypeMapper = { + { EOperationType::eOperation_Copy, L"copy" }, + { EOperationType::eOperation_Move, L"move" } + }; + + return compareTypeMapper; + } +} Index: src/libchengine/EOperationTypesMapper.h =================================================================== diff -u --- src/libchengine/EOperationTypesMapper.h (revision 0) +++ src/libchengine/EOperationTypesMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,40 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include "../libserializer/DataMapper.h" +#include "EOperationTypes.h" +#include "../libstring/TString.h" + +namespace chengine +{ + const serializer::DataMapper& GetCompareTypeMapper(); +} + +template<> +inline string::TString MapEnum(chengine::EOperationType eValue) +{ + return chengine::GetCompareTypeMapper().Map(eValue); +} + +template<> +inline chengine::EOperationType UnmapEnum(const string::TString& strValue) +{ + return chengine::GetCompareTypeMapper().Unmap(strValue); +} Index: src/libchengine/FeedbackAlreadyExistsRule.cpp =================================================================== diff -u -r3401d5079f33b29a7783b65bfad5f34d89a33ba5 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/FeedbackAlreadyExistsRule.cpp (.../FeedbackAlreadyExistsRule.cpp) (revision 3401d5079f33b29a7783b65bfad5f34d89a33ba5) +++ src/libchengine/FeedbackAlreadyExistsRule.cpp (.../FeedbackAlreadyExistsRule.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -2,6 +2,8 @@ #include "FeedbackAlreadyExistsRule.h" #include "../libstring/TString.h" #include "../libstring/TStringArray.h" +#include "ECompareTypeMapper.h" +#include "EFeedbackResultMapper.h" using namespace serializer; using namespace string; @@ -211,43 +213,36 @@ SetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), m_spaExcludeMask.Get().ToSerializedStringArray()); SetConfigValue(rConfig, _T("DateCompare.Use"), m_bUseDateCompare.Get()); - SetConfigValue(rConfig, _T("DateCompare.CompareType"), m_cmpLastModified.Get()); + SetConfigValue(rConfig, _T("DateCompare.CompareType"), MapEnum(m_cmpLastModified.Get())); - SetConfigValue(rConfig, _T("SizeCompare.Use"), m_bUseDateCompare.Get()); - SetConfigValue(rConfig, _T("SizeCompare.CompareType"), m_cmpLastModified.Get()); + SetConfigValue(rConfig, _T("SizeCompare.Use"), m_bUseSizeCompare.Get()); + SetConfigValue(rConfig, _T("SizeCompare.CompareType"), MapEnum(m_cmpSize.Get())); - SetConfigValue(rConfig, _T("Result"), m_eResult.Get()); + SetConfigValue(rConfig, _T("Result"), MapEnum(m_eResult.Get())); } void FeedbackAlreadyExistsRule::ReadFromConfig(const TConfig& rConfig) { - if(!GetConfigValue(rConfig, _T("IncludeMask.Use"), m_bUseMask.Modify())) - m_bUseMask = false; + m_bUseMask = GetConfigValueDef(rConfig, _T("IncludeMask.Use"), false); TStringArray arrMask; m_spaMask.Modify().Clear(); GetConfigValue(rConfig, _T("IncludeMask.MaskList.Mask"), arrMask); m_spaMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("ExcludeMask.Use"), m_bUseExcludeMask.Modify())) - m_bUseExcludeMask = false; + m_bUseExcludeMask = GetConfigValueDef(rConfig, _T("ExcludeMask.Use"), false); m_spaExcludeMask.Modify().Clear(); GetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), arrMask); m_spaExcludeMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("DateCompare.Use"), m_bUseDateCompare.Modify())) - m_bUseDateCompare = false; - if(!GetConfigValue(rConfig, _T("DateCompare.CompareType"), *(int*)m_cmpLastModified.Modify())) - m_cmpLastModified = eCmp_Equal; + m_bUseDateCompare = GetConfigValueDef(rConfig, _T("DateCompare.Use"), false); + m_cmpLastModified = UnmapEnum(GetConfigValueDef(rConfig, _T("DateCompare.CompareType"), TString(L"equal"))); - if(!GetConfigValue(rConfig, _T("SizeCompare.Use"), m_bUseSizeCompare.Modify())) - m_bUseSizeCompare = false; - if(!GetConfigValue(rConfig, _T("SizeCompare.CompareType"), *(int*)m_cmpSize.Modify())) - m_cmpSize = eCmp_Equal; + m_bUseSizeCompare = GetConfigValueDef(rConfig, _T("SizeCompare.Use"), false); + m_cmpSize = UnmapEnum(GetConfigValueDef(rConfig, _T("SizeCompare.CompareType"), TString(L"equal"))); - if(!GetConfigValue(rConfig, _T("Result"), *(int*)m_eResult.Modify())) - m_eResult = eResult_Unknown; + m_eResult = UnmapEnum(GetConfigValueDef(rConfig, _T("Result"), TString(L"unknown"))); } bool FeedbackAlreadyExistsRule::HaveSameCondition(const FeedbackAlreadyExistsRule& rSrc) const Index: src/libchengine/FeedbackErrorRule.cpp =================================================================== diff -u -r3401d5079f33b29a7783b65bfad5f34d89a33ba5 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/FeedbackErrorRule.cpp (.../FeedbackErrorRule.cpp) (revision 3401d5079f33b29a7783b65bfad5f34d89a33ba5) +++ src/libchengine/FeedbackErrorRule.cpp (.../FeedbackErrorRule.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -3,6 +3,8 @@ #include "../libstring/TString.h" #include "../libstring/TStringArray.h" #include "../libchcore/TPath.h" +#include "EFileErrorMapper.h" +#include "EFeedbackResultMapper.h" using namespace serializer; using namespace string; @@ -214,43 +216,36 @@ SetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), m_spaExcludeMask.Get().ToSerializedStringArray()); SetConfigValue(rConfig, _T("ErrorType.Use"), m_bUseErrorType.Get()); - SetConfigValue(rConfig, _T("ErrorType.Value"), m_eErrorType.Get()); + SetConfigValue(rConfig, _T("ErrorType.Value"), MapEnum(m_eErrorType.Get())); SetConfigValue(rConfig, _T("SystemErrorNo.Use"), m_bUseSystemErrorNo.Get()); SetConfigValue(rConfig, _T("SystemErrorNo.Value"), m_ulSystemErrorNo.Get()); - SetConfigValue(rConfig, _T("Result"), m_eResult.Get()); + SetConfigValue(rConfig, _T("Result"), MapEnum(m_eResult.Get())); } void FeedbackErrorRule::ReadFromConfig(const TConfig& rConfig) { - if(!GetConfigValue(rConfig, _T("IncludeMask.Use"), m_bUseMask.Modify())) - m_bUseMask = false; + m_bUseMask = GetConfigValueDef(rConfig, _T("IncludeMask.Use"), false); TStringArray arrMask; m_spaMask.Modify().Clear(); GetConfigValue(rConfig, _T("IncludeMask.MaskList.Mask"), arrMask); m_spaMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("ExcludeMask.Use"), m_bUseExcludeMask.Modify())) - m_bUseExcludeMask = false; + m_bUseExcludeMask = GetConfigValueDef(rConfig, _T("ExcludeMask.Use"), false); m_spaExcludeMask.Modify().Clear(); GetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), arrMask); m_spaExcludeMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("ErrorType.Use"), m_bUseErrorType.Modify())) - m_bUseErrorType = false; - if(!GetConfigValue(rConfig, _T("ErrorType.Value"), *(int*)m_eErrorType.Modify())) - m_eErrorType = EFileError::eDeleteError; + m_bUseErrorType = GetConfigValueDef(rConfig, _T("ErrorType.Use"), false); + m_eErrorType = UnmapEnum(GetConfigValueDef(rConfig, _T("ErrorType.Value"), TString(L"delete"))); - if(!GetConfigValue(rConfig, _T("SystemErrorNo.Use"), m_bUseSystemErrorNo.Modify())) - m_bUseSystemErrorNo = false; - if(!GetConfigValue(rConfig, _T("SystemErrorNo.Value"), m_ulSystemErrorNo.Modify())) - m_ulSystemErrorNo = 0UL; + m_bUseSystemErrorNo = GetConfigValueDef(rConfig, _T("SystemErrorNo.Use"), false); + m_ulSystemErrorNo = GetConfigValueDef(rConfig, _T("SystemErrorNo.Value"), (unsigned int)0); - if(!GetConfigValue(rConfig, _T("Result"), *(int*)m_eResult.Modify())) - m_eResult = eResult_Unknown; + m_eResult = UnmapEnum(GetConfigValueDef(rConfig, _T("Result"), TString(L"unknown"))); } bool FeedbackErrorRule::HaveSameCondition(const FeedbackErrorRule& rSrc) const Index: src/libchengine/FeedbackNotEnoughSpaceRule.cpp =================================================================== diff -u -r3401d5079f33b29a7783b65bfad5f34d89a33ba5 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/FeedbackNotEnoughSpaceRule.cpp (.../FeedbackNotEnoughSpaceRule.cpp) (revision 3401d5079f33b29a7783b65bfad5f34d89a33ba5) +++ src/libchengine/FeedbackNotEnoughSpaceRule.cpp (.../FeedbackNotEnoughSpaceRule.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -3,6 +3,7 @@ #include "../libstring/TString.h" #include "../libstring/TStringArray.h" #include "../libchcore/TPath.h" +#include "EFeedbackResultMapper.h" using namespace serializer; using namespace string; @@ -160,28 +161,25 @@ SetConfigValue(rConfig, _T("ExcludeMask.Use"), m_bUseExcludeMask.Get()); SetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), m_spaExcludeMask.Get().ToSerializedStringArray()); - SetConfigValue(rConfig, _T("Result"), m_eResult.Get()); + SetConfigValue(rConfig, _T("Result"), MapEnum(m_eResult.Get())); } void FeedbackNotEnoughSpaceRule::ReadFromConfig(const TConfig& rConfig) { - if(!GetConfigValue(rConfig, _T("IncludeMask.Use"), m_bUseMask.Modify())) - m_bUseMask = false; + m_bUseMask = GetConfigValueDef(rConfig, _T("IncludeMask.Use"), false); TStringArray arrMask; m_spaMask.Modify().Clear(); GetConfigValue(rConfig, _T("IncludeMask.MaskList.Mask"), arrMask); m_spaMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("ExcludeMask.Use"), m_bUseExcludeMask.Modify())) - m_bUseExcludeMask = false; + m_bUseExcludeMask = GetConfigValueDef(rConfig, _T("ExcludeMask.Use"), false); m_spaExcludeMask.Modify().Clear(); GetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), arrMask); m_spaExcludeMask.Modify().FromSerializedStringArray(arrMask); - if(!GetConfigValue(rConfig, _T("Result"), *(int*)m_eResult.Modify())) - m_eResult = eResult_Unknown; + m_eResult = UnmapEnum(GetConfigValueDef(rConfig, _T("Result"), TString(L"unknown"))); } bool FeedbackNotEnoughSpaceRule::HaveSameCondition(const FeedbackNotEnoughSpaceRule& rSrc) const Index: src/libchengine/FeedbackOperationEventRule.cpp =================================================================== diff -u -rf8b6de9c28b2957db0b4e71efa11df8632e41261 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/FeedbackOperationEventRule.cpp (.../FeedbackOperationEventRule.cpp) (revision f8b6de9c28b2957db0b4e71efa11df8632e41261) +++ src/libchengine/FeedbackOperationEventRule.cpp (.../FeedbackOperationEventRule.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -3,6 +3,8 @@ #include "../libstring/TString.h" #include "../libstring/TStringArray.h" #include "../libchcore/TPath.h" +#include "EOperationEventMapper.h" +#include "EFeedbackResultMapper.h" using namespace serializer; using namespace string; @@ -124,20 +126,16 @@ void FeedbackOperationEventRule::StoreInConfig(TConfig& rConfig) const { SetConfigValue(rConfig, _T("OperationEvent.Use"), m_bUseOperationEvent.Get()); - SetConfigValue(rConfig, _T("OperationEvent.Value"), m_eOperationEvent.Get()); + SetConfigValue(rConfig, _T("OperationEvent.Value"), MapEnum(m_eOperationEvent.Get())); SetConfigValue(rConfig, _T("Result"), m_eResult.Get()); } void FeedbackOperationEventRule::ReadFromConfig(const TConfig& rConfig) { - if(!GetConfigValue(rConfig, _T("OperationEvent.Use"), m_bUseOperationEvent.Modify())) - m_bUseOperationEvent = false; - if(!GetConfigValue(rConfig, _T("OperationEvent.Value"), *(int*)m_eOperationEvent.Modify())) - m_eOperationEvent = eOperationEvent_Finished; - - if(!GetConfigValue(rConfig, _T("Result"), *(int*)m_eResult.Modify())) - m_eResult = eResult_Unknown; + m_bUseOperationEvent = GetConfigValueDef(rConfig, _T("OperationEvent.Use"), false); + m_eOperationEvent = UnmapEnum(GetConfigValueDef(rConfig, _T("OperationEvent.Value"), TString(L"finished"))); + m_eResult = UnmapEnum(GetConfigValueDef(rConfig, _T("Result"), TString(L"unknown"))); } bool FeedbackOperationEventRule::HaveSameCondition(const FeedbackOperationEventRule& rSrc) const Index: src/libchengine/TFileFilter.cpp =================================================================== diff -u -r3401d5079f33b29a7783b65bfad5f34d89a33ba5 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/TFileFilter.cpp (.../TFileFilter.cpp) (revision 3401d5079f33b29a7783b65bfad5f34d89a33ba5) +++ src/libchengine/TFileFilter.cpp (.../TFileFilter.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -21,6 +21,8 @@ #include "TFileInfo.h" #include "TConfig.h" #include "../libstring/TStringArray.h" +#include "ECompareTypeMapper.h" +#include "EDateTypeMapper.h" using namespace chcore; using namespace string; @@ -219,21 +221,21 @@ SetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), m_astrExcludeMask.Get().ToSerializedStringArray()); SetConfigValue(rConfig, _T("SizeA.Use"), m_bUseSize1.Get()); - SetConfigValue(rConfig, _T("SizeA.FilteringType"), m_eSizeCmpType1.Get()); + SetConfigValue(rConfig, _T("SizeA.FilteringType"), MapEnum(m_eSizeCmpType1.Get())); SetConfigValue(rConfig, _T("SizeA.Value"), m_ullSize1.Get()); SetConfigValue(rConfig, _T("SizeB.Use"), m_bUseSize2.Get()); - SetConfigValue(rConfig, _T("SizeB.FilteringType"), m_eSizeCmpType2.Get()); + SetConfigValue(rConfig, _T("SizeB.FilteringType"), MapEnum(m_eSizeCmpType2.Get())); SetConfigValue(rConfig, _T("SizeB.Value"), m_ullSize2.Get()); SetConfigValue(rConfig, _T("DateA.Use"), m_bUseDateTime1.Get()); SetConfigValue(rConfig, _T("DateA.Type"), m_eDateType.Get()); // created/last modified/last accessed - SetConfigValue(rConfig, _T("DateA.FilteringType"), m_eDateCmpType1.Get()); // before/after + SetConfigValue(rConfig, _T("DateA.FilteringType"), MapEnum(m_eDateCmpType1.Get())); // before/after SetConfigValue(rConfig, _T("DateA.EnableDatePart"), m_bUseDate1.Get()); SetConfigValue(rConfig, _T("DateA.EnableTimePart"), m_bUseTime1.Get()); SetConfigValue(rConfig, _T("DateA.DateTimeValue"), m_tDateTime1.Get()); SetConfigValue(rConfig, _T("DateB.Type"), m_bUseDateTime2.Get()); - SetConfigValue(rConfig, _T("DateB.FilteringType"), m_eDateCmpType2.Get()); + SetConfigValue(rConfig, _T("DateB.FilteringType"), MapEnum(m_eDateCmpType2.Get())); SetConfigValue(rConfig, _T("DateB.EnableDatePart"), m_bUseDate2.Get()); SetConfigValue(rConfig, _T("DateB.EnableTimePart"), m_bUseTime2.Get()); SetConfigValue(rConfig, _T("DateB.DateTimeValue"), m_tDateTime2.Get()); @@ -248,73 +250,56 @@ void TFileFilter::ReadFromConfig(const TConfig& rConfig) { - if (!GetConfigValue(rConfig, _T("IncludeMask.Use"), m_bUseMask.Modify())) - m_bUseMask = false; + m_bUseMask = GetConfigValueDef(rConfig, _T("IncludeMask.Use"), false); TStringArray arrMask; m_astrMask.Modify().Clear(); GetConfigValue(rConfig, _T("IncludeMask.MaskList.Mask"), arrMask); m_astrMask.Modify().FromSerializedStringArray(arrMask); - if (!GetConfigValue(rConfig, _T("ExcludeMask.Use"), m_bUseExcludeMask.Modify())) - m_bUseExcludeMask = false; + m_bUseExcludeMask = GetConfigValueDef(rConfig, _T("ExcludeMask.Use"), false); m_astrExcludeMask.Modify().Clear(); GetConfigValue(rConfig, _T("ExcludeMask.MaskList.Mask"), arrMask); m_astrExcludeMask.Modify().FromSerializedStringArray(arrMask); - if (!GetConfigValue(rConfig, _T("SizeA.Use"), m_bUseSize1.Modify())) - m_bUseSize1 = false; - if (!GetConfigValue(rConfig, _T("SizeA.FilteringType"), *(int*)m_eSizeCmpType1.Modify())) - m_eSizeCmpType1 = eCmp_Equal; - if (!GetConfigValue(rConfig, _T("SizeA.Value"), m_ullSize1.Modify())) - m_ullSize1 = 0; - if (!GetConfigValue(rConfig, _T("SizeB.Use"), m_bUseSize2.Modify())) - m_bUseSize2 = false; - if (!GetConfigValue(rConfig, _T("SizeB.FilteringType"), *(int*)m_eSizeCmpType2.Modify())) - m_eSizeCmpType2 = eCmp_Equal; - if (!GetConfigValue(rConfig, _T("SizeB.Value"), m_ullSize2.Modify())) - m_ullSize2 = 0; + m_bUseSize1 = GetConfigValueDef(rConfig, _T("SizeA.Use"), false); + m_eSizeCmpType1 = UnmapEnum(GetConfigValueDef(rConfig, _T("SizeA.FilteringType"), TString(L"eq"))); - if (!GetConfigValue(rConfig, _T("DateA.Use"), m_bUseDateTime1.Modify())) - m_bUseDateTime1 = false; + m_ullSize1 = GetConfigValueDef(rConfig, _T("SizeA.Value"), 0); - if (!GetConfigValue(rConfig, _T("DateA.Type"), *(int*)m_eDateType.Modify())) // created/last modified/last accessed - m_eDateType = eDateType_Created; - if (!GetConfigValue(rConfig, _T("DateA.FilteringType"), *(int*)m_eDateCmpType1.Modify())) // before/after - m_eDateCmpType1 = eCmp_Equal; - if (!GetConfigValue(rConfig, _T("DateA.EnableDatePart"), m_bUseDate1.Modify())) - m_bUseDate1 = false; - if (!GetConfigValue(rConfig, _T("DateA.EnableTimePart"), m_bUseTime1.Modify())) - m_bUseTime1 = false; + m_bUseSize2 = GetConfigValueDef(rConfig, _T("SizeB.Use"), false); + m_eSizeCmpType2 = UnmapEnum(GetConfigValueDef(rConfig, _T("SizeB.FilteringType"), TString(L"eq"))); + m_ullSize2 = GetConfigValueDef(rConfig, _T("SizeB.Value"), 0); + + m_bUseDateTime1 = GetConfigValueDef(rConfig, _T("DateA.Use"), false); + + m_eDateType = UnmapEnum(GetConfigValueDef(rConfig, _T("DateA.Type"), TString(L"created"))); + + m_eDateCmpType1 = UnmapEnum(GetConfigValueDef(rConfig, _T("DateA.FilteringType"), TString(L"eq"))); + + m_bUseDate1 = GetConfigValueDef(rConfig, _T("DateA.EnableDatePart"), false); + m_bUseTime1 = GetConfigValueDef(rConfig, _T("DateA.EnableTimePart"), false); + if (!GetConfigValue(rConfig, _T("DateA.DateTimeValue"), m_tDateTime1.Modify())) m_tDateTime1.Modify().Clear(); - if (!GetConfigValue(rConfig, _T("DateB.Type"), m_bUseDateTime2.Modify())) - m_bUseDateTime2 = false; - if (!GetConfigValue(rConfig, _T("DateB.FilteringType"), *(int*)m_eDateCmpType2.Modify())) - m_eDateCmpType2 = eCmp_Equal; - if (!GetConfigValue(rConfig, _T("DateB.EnableDatePart"), m_bUseDate2.Modify())) - m_bUseDate2 = false; + m_bUseDateTime2 = GetConfigValueDef(rConfig, _T("DateB.Type"), false); + m_eDateCmpType2 = UnmapEnum(GetConfigValueDef(rConfig, _T("DateB.FilteringType"), TString(L"eq"))); + m_bUseDate2 = GetConfigValueDef(rConfig, _T("DateB.EnableDatePart"), false); + if (!GetConfigValue(rConfig, _T("DateB.DateTimeValue"), m_tDateTime2.Modify())) m_tDateTime2.Modify().Clear(); - if (!GetConfigValue(rConfig, _T("DateB.EnableTimePart"), m_bUseTime2.Modify())) - m_bUseTime2 = false; + m_bUseTime2 = GetConfigValueDef(rConfig, _T("DateB.EnableTimePart"), false); - if (!GetConfigValue(rConfig, _T("Attributes.Use"), m_bUseAttributes.Modify())) - m_bUseAttributes = false; - if (!GetConfigValue(rConfig, _T("Attributes.Archive"), m_iArchive.Modify())) - m_iArchive = 0; - if (!GetConfigValue(rConfig, _T("Attributes.ReadOnly"), m_iReadOnly.Modify())) - m_iReadOnly = 0; - if (!GetConfigValue(rConfig, _T("Attributes.Hidden"), m_iHidden.Modify())) - m_iHidden = 0; - if (!GetConfigValue(rConfig, _T("Attributes.System"), m_iSystem.Modify())) - m_iSystem = 0; - if (!GetConfigValue(rConfig, _T("Attributes.Directory"), m_iDirectory.Modify())) - m_iDirectory = 0; + m_bUseAttributes = GetConfigValueDef(rConfig, _T("Attributes.Use"), false); + m_iArchive = GetConfigValueDef(rConfig, _T("Attributes.Archive"), 0); + m_iReadOnly = GetConfigValueDef(rConfig, _T("Attributes.ReadOnly"), 0); + m_iHidden = GetConfigValueDef(rConfig, _T("Attributes.Hidden"), 0); + m_iSystem = GetConfigValueDef(rConfig, _T("Attributes.System"), 0); + m_iDirectory = GetConfigValueDef(rConfig, _T("Attributes.Directory"), 0); } bool TFileFilter::Match(const TFileInfoPtr& spInfo) const @@ -761,12 +746,12 @@ m_ullSize2 = ullSize2; } - TFileFilter::EDateType TFileFilter::GetDateType() const + EDateType TFileFilter::GetDateType() const { return m_eDateType; } - void TFileFilter::SetDateType(TFileFilter::EDateType eDateType) + void TFileFilter::SetDateType(EDateType eDateType) { m_eDateType = eDateType; } Index: src/libchengine/TFileFilter.h =================================================================== diff -u -r63369021254e8b67ffeef5a9ece1b5a70df881c4 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/TFileFilter.h (.../TFileFilter.h) (revision 63369021254e8b67ffeef5a9ece1b5a70df881c4) +++ src/libchengine/TFileFilter.h (.../TFileFilter.h) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -25,6 +25,7 @@ #include "../libserializer/TSharedModificationTracker.h" #include "ECompareType.h" #include "../libserializer/SerializableObject.h" +#include "EDateType.h" namespace chengine { @@ -74,14 +75,6 @@ class LIBCHENGINE_API TFileFilter : public serializer::SerializableObject { public: - enum EDateType - { - eDateType_Created = 0, - eDateType_Modified = 1, - eDateType_LastAccessed = 2 - }; - - public: TFileFilter(); TFileFilter(const TFileFilter& rFilter); TFileFilter& operator=(const TFileFilter& rFilter); @@ -142,8 +135,8 @@ void SetSize2(unsigned long long ullSize2); // dates - TFileFilter::EDateType GetDateType() const; - void SetDateType(TFileFilter::EDateType eDateType); + EDateType GetDateType() const; + void SetDateType(EDateType eDateType); // date 1 bool GetUseDateTime1() const; Index: src/libchengine/TTaskDefinition.cpp =================================================================== diff -u -r08717141ce5f6926116c298cbc9442094a45bb67 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision 08717141ce5f6926116c298cbc9442094a45bb67) +++ src/libchengine/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -27,6 +27,7 @@ #include #include "TTaskDefinition.h" #include "../libchcore/TCoreException.h" +#include "EOperationTypesMapper.h" #define CURRENT_TASK_VERSION 1 @@ -184,11 +185,12 @@ m_pathDestinationPath.AppendSeparatorIfDoesNotExist(); // type of the operation - int iOperation = eOperation_None; - if (!rDataSrc.GetValue(_T("TaskDefinition.OperationType"), iOperation)) + TString strOperation = L"copy"; + if(!GetConfigValue(rDataSrc, _T("TaskDefinition.OperationType"), strOperation)) throw TCoreException(eErr_MissingXmlData, L"Missing TaskDefinition.OperationType", LOCATION); - m_tOperationPlan.SetOperationType((EOperationType)iOperation); + EOperationType eOperation = UnmapEnum(strOperation); + m_tOperationPlan.SetOperationType(eOperation); // and version of the task if (!GetConfigValue(rDataSrc, _T("TaskDefinition.Version"), m_ullTaskVersion)) @@ -247,8 +249,7 @@ SetConfigValue(rConfig, _T("TaskDefinition.Filters"), m_afFilters); SetConfigValue(rConfig, _T("TaskDefinition.DestinationPath"), m_pathDestinationPath); - int iOperation = m_tOperationPlan.GetOperationType(); - SetConfigValue(rConfig, _T("TaskDefinition.OperationType"), iOperation); + SetConfigValue(rConfig, _T("TaskDefinition.OperationType"), MapEnum(m_tOperationPlan.GetOperationType())); SetConfigValue(rConfig, _T("TaskDefinition.Version"), m_ullTaskVersion); Index: src/libchengine/libchengine.vcxproj =================================================================== diff -u -r08717141ce5f6926116c298cbc9442094a45bb67 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/libchengine.vcxproj (.../libchengine.vcxproj) (revision 08717141ce5f6926116c298cbc9442094a45bb67) +++ src/libchengine/libchengine.vcxproj (.../libchengine.vcxproj) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -504,11 +504,18 @@ + + + + + + + @@ -623,6 +630,12 @@ + + + + + + Index: src/libchengine/libchengine.vcxproj.filters =================================================================== diff -u -r08717141ce5f6926116c298cbc9442094a45bb67 -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libchengine/libchengine.vcxproj.filters (.../libchengine.vcxproj.filters) (revision 08717141ce5f6926116c298cbc9442094a45bb67) +++ src/libchengine/libchengine.vcxproj.filters (.../libchengine.vcxproj.filters) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -426,6 +426,27 @@ Source Files\Feedback + + Source Files\Tools + + + Source Files\Tools + + + Source Files\Tools + + + Source Files\Feedback\Error + + + Source Files\Tools + + + Source Files\Tools + + + Source Files\Feedback\OperationEvent + @@ -731,6 +752,24 @@ Source Files\Feedback + + Source Files\Tools + + + Source Files\Tools + + + Source Files\Tools + + + Source Files\Feedback\Error + + + Source Files\Tools + + + Source Files\Feedback\OperationEvent + Index: src/libserializer/DataMapper.h =================================================================== diff -u --- src/libserializer/DataMapper.h (revision 0) +++ src/libserializer/DataMapper.h (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -0,0 +1,83 @@ +// ============================================================================ +// Copyright (C) 2001-2020 by Jozef Starosczyk +// ixen {at} copyhandler [dot] 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. +// ============================================================================ +#pragma once + +#include +#include "../libstring/TString.h" +#include + +namespace serializer +{ + template + class DataMapper + { + public: + using Bimap = boost::bimap; + + public: + DataMapper(const std::initializer_list&& list) : + m_mapData(list.begin(), list.end()) + { + } + + string::TString Map(Enum eData) const + { + auto iterFnd = m_mapData.left.find(eData); + if(iterFnd != m_mapData.left.end()) + return iterFnd->second; + + throw std::invalid_argument("No mapping available "); + } + + Enum Unmap(const string::TString& mappedData) const + { + auto iterFnd = m_mapData.right.find(mappedData); + if(iterFnd != m_mapData.right.end()) + return iterFnd->second; + + // check the numeric value + try + { + // for numeric values check if they exist in internal bimap before returning + int iValue = std::stoi(mappedData.c_str()); + auto iterNumFnd = m_mapData.left.find((Enum)iValue); + if(iterNumFnd != m_mapData.left.end()) + return iterNumFnd->first; + } + catch(const std::exception&) + { + } + + throw std::invalid_argument("No reverse mapping available "); + } + + private: + Bimap m_mapData; + }; +} + +template +string::TString MapEnum(Enum eValue) +{ +} + +template +Enum UnmapEnum(const string::TString& strValue) +{ +} Index: src/libserializer/libserializer.vcxproj =================================================================== diff -u -rf3c80778cfee0736195e00274c78040f7908ac5b -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libserializer/libserializer.vcxproj (.../libserializer.vcxproj) (revision f3c80778cfee0736195e00274c78040f7908ac5b) +++ src/libserializer/libserializer.vcxproj (.../libserializer.vcxproj) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -499,6 +499,7 @@ + Index: src/libserializer/libserializer.vcxproj.filters =================================================================== diff -u -rf3c80778cfee0736195e00274c78040f7908ac5b -redf1ada01d4339a99fa80c4da7edbb5823adde0e --- src/libserializer/libserializer.vcxproj.filters (.../libserializer.vcxproj.filters) (revision f3c80778cfee0736195e00274c78040f7908ac5b) +++ src/libserializer/libserializer.vcxproj.filters (.../libserializer.vcxproj.filters) (revision edf1ada01d4339a99fa80c4da7edbb5823adde0e) @@ -134,6 +134,9 @@ Source Files\Serialization + + Source Files\Tools +