Index: src/libchcore/ErrorCodes.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/ErrorCodes.h (.../ErrorCodes.h) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -25,22 +25,27 @@ enum EGeneralErrors { - eNoError = 0, - eBoundsExceeded = 1, - eInvalidArgument = 2, - eUnhandledCase = 3, - eMissingData = 4, - eUnsupportedVersion = 5, + // general errors + eErr_Success = 0, + eErr_BoundsExceeded = 1, + eErr_InvalidArgument = 2, + eErr_UnhandledCase = 3, + eErr_InternalProblem = 4, - // shared memory - eCannotOpenSharedMemory = 6, - eSharedMemoryNotOpen = 7, - eSharedMemoryInvalidFormat = 8, - eSharedMemoryAlreadyExists = 9, + // shared memory (500+) + eErr_CannotOpenSharedMemory = 500, + eErr_SharedMemoryNotOpen = 501, + eErr_SharedMemoryInvalidFormat = 502, + eErr_SharedMemoryAlreadyExists = 503, - // threads - eMutexTimedOut = 10, + // threading (1000+) + eErr_MutexTimedOut = 1000, + // string errors (1500+) + + // Task definition errors (2000+) + eErr_UnsupportedVersion = 2000, + eErr_MissingXmlData = 2001, }; END_CHCORE_NAMESPACE Index: src/libchcore/TCoreException.cpp =================================================================== diff -u -N -r6dc950d4d76107421ff6eb62069b70f20bcc450e -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision 6dc950d4d76107421ff6eb62069b70f20bcc450e) +++ src/libchcore/TCoreException.cpp (.../TCoreException.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -29,13 +29,6 @@ // ============================================================================ BEGIN_CHCORE_NAMESPACE -TCoreException::TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszInternalError) : - m_eErrorCode(eErrorCode), - m_strInternalMessage(pszInternalError ? pszInternalError : _t("")) -{ - BOOST_ASSERT(false); -} - // ============================================================================ /// chcore::TCoreException::TCoreException /// @date 2009/11/30 @@ -47,12 +40,11 @@ /// @param[in] stLineNumber - source line number /// @param[in] pszFunction - function name in which the problem occured. // ============================================================================ -TCoreException::TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszInternalError, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : +TCoreException::TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction) : m_eErrorCode(eErrorCode), - m_strInternalMessage(pszInternalError ? pszInternalError : _t("")), - m_strFile(pszFile ? pszFile : _t("")), + m_pszFile(pszFile), m_strLineNumber(stLineNumber), - m_strFunction(pszFunction ? pszFunction : _t("")) + m_pszFunction(pszFunction) { BOOST_ASSERT(false); } Index: src/libchcore/TCoreException.h =================================================================== diff -u -N -r39db7f4bffdd185122d8dab0772bd6fc49a0b675 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TCoreException.h (.../TCoreException.h) (revision 39db7f4bffdd185122d8dab0772bd6fc49a0b675) +++ src/libchcore/TCoreException.h (.../TCoreException.h) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -25,37 +25,33 @@ // throws core exception object #define THROW_CORE_EXCEPTION(error_code)\ - throw TCoreException(error_code, _t(""), __FILEW__, __LINE__, __FUNCTIONW__) -#define THROW_CORE_EXCEPTION_STR(error_code, error_string)\ - throw TCoreException(error_code, error_string, __FILEW__, __LINE__, __FUNCTIONW__) + throw TCoreException(error_code, __FILEW__, __LINE__, __FUNCTIONW__) class LIBCHCORE_API TCoreException { public: - TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszInternalError); - TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszInternalError, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); + TCoreException(EGeneralErrors eErrorCode); + TCoreException(EGeneralErrors eErrorCode, const tchar_t* pszFile, size_t stLineNumber, const tchar_t* pszFunction); // error information EGeneralErrors GetErrorCode() const { return m_eErrorCode; } - tstring_t GetInternalErrorString() const { return m_strInternalMessage; } // location info - tstring_t GetSourceFile() const { return m_strFile; } + const wchar_t* GetSourceFile() const { return m_pszFile; } size_t GetSourceLineNumber() const { return m_strLineNumber; } - tstring_t GetFunctionName() const { return m_strFunction; } + const wchar_t* GetFunctionName() const { return m_pszFunction; } private: TCoreException() {} protected: // what happened? - tstring_t m_strInternalMessage; EGeneralErrors m_eErrorCode; // where it happened? - tstring_t m_strFile; + const wchar_t* m_pszFile; + const wchar_t* m_pszFunction; size_t m_strLineNumber; - tstring_t m_strFunction; }; END_CHCORE_NAMESPACE Index: src/libchcore/TPath.cpp =================================================================== diff -u -N -r7d56dc81daaf09b67f8036b5c3c997335c2994ae -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TPath.cpp (.../TPath.cpp) (revision 7d56dc81daaf09b67f8036b5c3c997335c2994ae) +++ src/libchcore/TPath.cpp (.../TPath.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -1193,7 +1193,7 @@ const TSmartPath& TPathContainer::GetAt(size_t stIndex) const { if(stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eBoundsExceeded); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); return m_vPaths.at(stIndex); } @@ -1209,7 +1209,7 @@ TSmartPath& TPathContainer::GetAt(size_t stIndex) { if(stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eBoundsExceeded); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); return m_vPaths.at(stIndex); } @@ -1225,7 +1225,7 @@ void TPathContainer::SetAt(size_t stIndex, const TSmartPath& spPath) { if(stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eBoundsExceeded); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); m_vPaths[stIndex] = spPath; } @@ -1240,7 +1240,7 @@ void TPathContainer::DeleteAt(size_t stIndex) { if(stIndex > m_vPaths.size()) - THROW_CORE_EXCEPTION(eBoundsExceeded); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); m_vPaths.erase(m_vPaths.begin() + stIndex); } Index: src/libchcore/TSharedMemory.cpp =================================================================== diff -u -N -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) +++ src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -39,7 +39,7 @@ { DWORD dwRes = WaitForSingleObject(hMutex, 10000); if(dwRes != WAIT_OBJECT_0) - THROW_CORE_EXCEPTION(eMutexTimedOut); + THROW_CORE_EXCEPTION(eErr_MutexTimedOut); } } @@ -72,7 +72,7 @@ void TSharedMemory::Create(const wchar_t* pszName, size_t stSize) { if(!pszName || pszName[0] == _T('\0') || stSize == 0) - THROW_CORE_EXCEPTION(eInvalidArgument); + THROW_CORE_EXCEPTION(eErr_InvalidArgument); Close(); @@ -83,30 +83,30 @@ SECURITY_DESCRIPTOR secDesc; if(!InitializeSecurityDescriptor(&secDesc, SECURITY_DESCRIPTOR_REVISION)) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); SECURITY_ATTRIBUTES secAttr; secAttr.nLength = sizeof(secAttr); secAttr.bInheritHandle = FALSE; secAttr.lpSecurityDescriptor = &secDesc; if(!SetSecurityDescriptorDacl(secAttr.lpSecurityDescriptor, TRUE, 0, FALSE)) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); m_hMutex = ::CreateMutex(&secAttr, FALSE, wstrMutexName.c_str()); if(!m_hMutex) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); m_hFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, &secAttr, PAGE_READWRITE, 0, boost::numeric_cast(stSize + sizeof(size_t)), pszName); if(!m_hFileMapping) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); else if(GetLastError() == ERROR_ALREADY_EXISTS) - THROW_CORE_EXCEPTION(eSharedMemoryAlreadyExists); // shared memory already exists - cannot guarantee that the size is correct + THROW_CORE_EXCEPTION(eErr_SharedMemoryAlreadyExists); // shared memory already exists - cannot guarantee that the size is correct // Get a pointer to the file-mapped shared memory. m_pMappedMemory = (BYTE*)MapViewOfFile(m_hFileMapping, FILE_MAP_WRITE, 0, 0, 0); if(!m_pMappedMemory) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); } catch(...) { @@ -143,12 +143,12 @@ { m_hFileMapping = OpenFileMapping(FILE_MAP_READ, FALSE, pszName); if(!m_hFileMapping) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); // Get a pointer to the file-mapped shared memory. m_pMappedMemory = (BYTE*)MapViewOfFile(m_hFileMapping, FILE_MAP_READ, 0, 0, 0); if(!m_pMappedMemory) - THROW_CORE_EXCEPTION(eCannotOpenSharedMemory); + THROW_CORE_EXCEPTION(eErr_CannotOpenSharedMemory); } catch(...) { @@ -192,19 +192,19 @@ void TSharedMemory::Read(TString& wstrData) const { if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t)) - THROW_CORE_EXCEPTION(eSharedMemoryNotOpen); + THROW_CORE_EXCEPTION(eErr_SharedMemoryNotOpen); TMutexLock lock(m_hMutex); size_t stByteSize = *(size_t*)m_pMappedMemory; if((stByteSize % 2) != 0) - THROW_CORE_EXCEPTION(eSharedMemoryInvalidFormat); + THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat); const wchar_t* pszRealData = (const wchar_t*)(m_pMappedMemory + sizeof(size_t)); size_t stCharCount = stByteSize / 2; if(pszRealData[stCharCount - 1] != _T('\0')) - THROW_CORE_EXCEPTION(eSharedMemoryInvalidFormat); + THROW_CORE_EXCEPTION(eErr_SharedMemoryInvalidFormat); wstrData = pszRealData; } @@ -217,7 +217,7 @@ void TSharedMemory::Write(const BYTE* pbyData, size_t stSize) { if(stSize + sizeof(size_t) > m_stSize) - THROW_CORE_EXCEPTION(eBoundsExceeded); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); TMutexLock lock(m_hMutex); Index: src/libchcore/TString.cpp =================================================================== diff -u -N -r3bc27cd61d57077aba80189b2fdde1500a2367a4 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TString.cpp (.../TString.cpp) (revision 3bc27cd61d57077aba80189b2fdde1500a2367a4) +++ src/libchcore/TString.cpp (.../TString.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -74,6 +74,8 @@ { TInternalStringData* pStringData = TInternalStringData::Allocate(m_stBufferSize); BOOST_ASSERT(m_stBufferSize == pStringData->m_stBufferSize); + if(m_stBufferSize != pStringData->m_stBufferSize) + THROW_CORE_EXCEPTION(eErr_InternalProblem); wcsncpy_s(pStringData->GetData(), pStringData->m_stBufferSize, GetData(), m_stStringLength + 1); pStringData->m_stStringLength = m_stStringLength; @@ -445,24 +447,30 @@ } } -void TString::DeleteChar(size_t stIndex) +bool TString::DeleteChar(size_t stIndex) { size_t stCurrentLength = GetLength(); if(stIndex >= stCurrentLength) - return; + return false; EnsureWritable(1); wmemmove(m_pszStringData + stIndex, m_pszStringData + stIndex + 1, stCurrentLength - stIndex); m_pszStringData[stCurrentLength - 1] = _T('\0'); GetInternalStringData()->SetStringLength(stCurrentLength - 1); + + return true; } -void TString::Delete(size_t stIndex, size_t stCount) +bool TString::Delete(size_t stIndex, size_t stCount) { size_t stCurrentLength = GetLength(); - if(stIndex >= stCurrentLength) - return; + if(stIndex >= stCurrentLength || stCount == 0) + return false; + bool bResult = true; // by default we assume that the entire operation will be executed as planned + if(stIndex + stCount > stCurrentLength) // but in case there is not enough data to delete, then we want to delete what we can, but return false + bResult = false; + EnsureWritable(stCurrentLength + 1); size_t stCountToDelete = min(stCurrentLength - stIndex, stCount); @@ -471,6 +479,8 @@ m_pszStringData[stCurrentLength - stCountToDelete] = _T('\0'); GetInternalStringData()->SetStringLength(stCurrentLength - stCountToDelete); + + return bResult; } void TString::Split(const wchar_t* pszSeparators, TStringArray& rStrings) const @@ -645,7 +655,10 @@ return m_pszStringData[tPos]; else { - BOOST_ASSERT(tPos >= tSize); + BOOST_ASSERT(tPos < tSize); + if(tPos >= tSize) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + // would be nice to throw an exception here return L'\0'; } @@ -722,6 +735,8 @@ size_t stMaxBufSize = GetCurrentBufferSize(); BOOST_ASSERT(stCount + 1 <= stMaxBufSize); + if(stCount + 1 > stMaxBufSize) + THROW_CORE_EXCEPTION(eErr_InternalProblem); wcsncpy_s(m_pszStringData, stMaxBufSize, pszStart, stCount); m_pszStringData[stCount] = _T('\0'); Index: src/libchcore/TString.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TString.h (.../TString.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TString.h (.../TString.h) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -179,8 +179,8 @@ void RightSelf(size_t tLen); ///< Makes this TString it's Right part void MidSelf(size_t tStart, size_t tLen = (size_t)-1); ///< Makes this TString it's middle part - void DeleteChar(size_t stIndex); - void Delete(size_t stIndex, size_t stCount); + bool DeleteChar(size_t stIndex); + bool Delete(size_t stIndex, size_t stCount); void Split(const wchar_t* pszSeparators, TStringArray& rStrings) const; Index: src/libchcore/TStringArray.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TStringArray.cpp (.../TStringArray.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -75,6 +75,55 @@ } /////////////////////////////////////////////////////////////////////////////////////////////////////// +// class TStringArrayConstIterator + +TStringArrayConstIterator::TStringArrayConstIterator(std::vector::const_iterator iterArray) : + m_iterArray(iterArray) +{ +} + +TStringArrayConstIterator::TStringArrayConstIterator() +{ +} + +TStringArrayConstIterator::~TStringArrayConstIterator() +{ +} + +TStringArrayConstIterator TStringArrayConstIterator::operator++(int) +{ + TStringArrayConstIterator iterCurrent = *this; + ++m_iterArray; + return iterCurrent; +} + +TStringArrayConstIterator& TStringArrayConstIterator::operator++() +{ + ++m_iterArray; + return *this; +} + +bool TStringArrayConstIterator::operator==(const TStringArrayConstIterator& rSrc) const +{ + return m_iterArray == rSrc.m_iterArray; +} + +bool TStringArrayConstIterator::operator!=(const TStringArrayConstIterator& rSrc) const +{ + return m_iterArray != rSrc.m_iterArray; +} + +const TString& TStringArrayConstIterator::operator*() +{ + return *m_iterArray; +} + +const TString& TStringArrayConstIterator::operator*() const +{ + return *m_iterArray; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////// // class TStringArray TStringArray::TStringArray() { @@ -91,16 +140,25 @@ void TStringArray::InsertAt(size_t stIndex, const TString& str) { + if(stIndex >= m_vItems.size()) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + m_vItems.insert(m_vItems.begin() + stIndex, str); } void TStringArray::SetAt(size_t stIndex, const TString& str) { + if(stIndex >= m_vItems.size()) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + m_vItems[stIndex] = str; } void TStringArray::RemoveAt(size_t stIndex) { + if(stIndex >= m_vItems.size()) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + m_vItems.erase(m_vItems.begin() + stIndex); } @@ -111,6 +169,9 @@ const TString& TStringArray::GetAt(size_t stIndex) const { + if(stIndex >= m_vItems.size()) + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); + return m_vItems.at(stIndex); } @@ -129,4 +190,14 @@ return TStringArrayIterator(m_vItems.end()); } +TStringArrayConstIterator TStringArray::Begin() const +{ + return TStringArrayConstIterator(m_vItems.begin()); +} + +TStringArrayConstIterator TStringArray::End() const +{ + return TStringArrayConstIterator(m_vItems.end()); +} + END_CHCORE_NAMESPACE Index: src/libchcore/TStringArray.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TStringArray.h (.../TStringArray.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TStringArray.h (.../TStringArray.h) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -55,10 +55,38 @@ friend class TStringArray; }; +class LIBCHCORE_API TStringArrayConstIterator +{ +protected: + TStringArrayConstIterator(std::vector::const_iterator iterArray); + +public: + TStringArrayConstIterator(); + ~TStringArrayConstIterator(); + + TStringArrayConstIterator operator++(int); + TStringArrayConstIterator& operator++(); + + bool operator==(const TStringArrayConstIterator& rSrc) const; + bool operator!=(const TStringArrayConstIterator& rSrc) const; + + const TString& operator*(); + const TString& operator*() const; + +private: +#pragma warning(push) +#pragma warning(disable: 4251) + std::vector::const_iterator m_iterArray; +#pragma warning(pop) + + friend class TStringArray; +}; + class LIBCHCORE_API TStringArray { public: typedef TStringArrayIterator iterator; + typedef TStringArrayConstIterator const_iterator; public: TStringArray(); @@ -75,6 +103,8 @@ TStringArrayIterator Begin(); TStringArrayIterator End(); + TStringArrayConstIterator Begin() const; + TStringArrayConstIterator End() const; private: #pragma warning(push) Index: src/libchcore/TTaskDefinition.cpp =================================================================== diff -u -N -r0cd863a6e51b221c4f7bf6e7b83ddfc43a5d433f -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision 0cd863a6e51b221c4f7bf6e7b83ddfc43a5d433f) +++ src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -190,24 +190,24 @@ // basic information // source paths to be processed if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.SourcePaths.Path"), m_vSourcePaths) || m_vSourcePaths.IsEmpty()) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing source paths")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); // destination path if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.DestinationPath"), m_pathDestinationPath) || m_pathDestinationPath.IsEmpty()) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing destination path")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); m_pathDestinationPath.AppendSeparatorIfDoesNotExist(); // type of the operation int iOperation = eOperation_None; if(!tTaskInfo.GetValue(_T("TaskDefinition.OperationType"), iOperation)) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing operation type")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); m_tOperationPlan.SetOperationType((EOperationType)iOperation); // and version of the task if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.Version"), m_ullTaskVersion)) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing task definition version")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); if(m_ullTaskVersion < CURRENT_TASK_VERSION) { @@ -219,7 +219,7 @@ m_bModified = true; } else if(m_ullTaskVersion > CURRENT_TASK_VERSION) - THROW_CORE_EXCEPTION_STR(eUnsupportedVersion, _T("Unsupported task version")); + THROW_CORE_EXCEPTION(eErr_UnsupportedVersion); tTaskInfo.ExtractSubConfig(_T("TaskDefinition.TaskSettings"), m_tConfiguration); } @@ -305,24 +305,24 @@ // basic information // source paths to be processed if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.SourcePaths.Path"), m_vSourcePaths) || m_vSourcePaths.IsEmpty()) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing source paths")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); // destination path if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.DestinationPath"), m_pathDestinationPath) || m_pathDestinationPath.IsEmpty()) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing destination path")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); m_pathDestinationPath.AppendSeparatorIfDoesNotExist(); // type of the operation int iOperation = eOperation_None; if(!tTaskInfo.GetValue(_T("TaskDefinition.OperationType"), iOperation)) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing operation type")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); m_tOperationPlan.SetOperationType((EOperationType)iOperation); // and version of the task if(!GetConfigValue(tTaskInfo, _T("TaskDefinition.Version"), m_ullTaskVersion)) - THROW_CORE_EXCEPTION_STR(eMissingData, _T("Missing task definition version")); + THROW_CORE_EXCEPTION(eErr_MissingXmlData); if(m_ullTaskVersion < CURRENT_TASK_VERSION) { @@ -334,7 +334,7 @@ m_bModified = true; } else if(m_ullTaskVersion > CURRENT_TASK_VERSION) - THROW_CORE_EXCEPTION_STR(eUnsupportedVersion, _T("Unsupported task version")); + THROW_CORE_EXCEPTION(eErr_UnsupportedVersion); tTaskInfo.ExtractSubConfig(_T("TaskDefinition.TaskSettings"), m_tConfiguration); } Index: src/libchcore/TTaskOperationPlan.cpp =================================================================== diff -u -N -r6dc950d4d76107421ff6eb62069b70f20bcc450e -re9926b6e83984d0f30bf2008b93874c7c483d95c --- src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision 6dc950d4d76107421ff6eb62069b70f20bcc450e) +++ src/libchcore/TTaskOperationPlan.cpp (.../TTaskOperationPlan.cpp) (revision e9926b6e83984d0f30bf2008b93874c7c483d95c) @@ -66,7 +66,7 @@ switch(eOperation) { case eOperation_None: - THROW_CORE_EXCEPTION_STR(eInvalidArgument, _T("Cannot set operation type 'none'")); + THROW_CORE_EXCEPTION(eErr_InvalidArgument); break; case eOperation_Copy: @@ -91,7 +91,7 @@ BOOST_STATIC_ASSERT(eOperation_Move == eOperation_Max - 1); default: - THROW_CORE_EXCEPTION_STR(eUnhandledCase, _T("Unhandled case")); + THROW_CORE_EXCEPTION(eErr_UnhandledCase); } m_eOperation = eOperation; @@ -113,7 +113,7 @@ { boost::shared_lock lock(m_lock); if(stIndex >= m_vSubOperations.size()) - THROW_CORE_EXCEPTION_STR(eBoundsExceeded, _T("Index out of bounds")); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); else return m_vSubOperations[stIndex].first; } @@ -122,7 +122,7 @@ { boost::shared_lock lock(m_lock); if(stIndex >= m_vSubOperations.size()) - THROW_CORE_EXCEPTION_STR(eBoundsExceeded, _T("Index out of bounds")); + THROW_CORE_EXCEPTION(eErr_BoundsExceeded); else return m_vSubOperations[stIndex].second; }