Index: src/ch/MainWnd.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/ch/MainWnd.cpp (.../MainWnd.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -34,7 +34,6 @@ #include "ClipboardMonitor.h" #include #include -#include "../libchcore/TWStringData.h" #include "../common/TShellExtMenuConfig.h" #include "../libchcore/TConfig.h" #include "FileSupport.h" @@ -433,8 +432,8 @@ if(!pszBuffer || ulLen == 0 || pszBuffer[ulLen - 1] != L'\0') return FALSE; - chcore::TWStringData wstrData(pszBuffer); - AfxMessageBox(wstrData.GetData()); // TEMP = to remove before commit + chcore::TString wstrData(pszBuffer); + AfxMessageBox(wstrData); // TEMP = to remove before commit chcore::TTaskDefinition tTaskDefinition; tTaskDefinition.LoadFromString(wstrData); @@ -768,7 +767,7 @@ } chcore::TConfig cfgStorage; - chcore::TWStringData wstrData; + chcore::TString wstrData; cfgShellExt.StoreInConfig(cfgStorage, _T("ShellExtCfg")); cfgStorage.WriteToString(wstrData); Index: src/chext/DropMenuExt.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/chext/DropMenuExt.cpp (.../DropMenuExt.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -24,7 +24,6 @@ #include "../libchcore/TTaskDefinition.h" #include #include "ShellPathsHelpers.h" -#include "../libchcore/TWStringData.h" #include "../common/TShellExtMenuConfig.h" #include "../libchcore/TSharedMemory.h" @@ -150,14 +149,14 @@ tTaskDefinition.SetOperationType(eOperationType); // get task data as xml - chcore::TWStringData wstrData; + chcore::TString wstrData; tTaskDefinition.StoreInString(wstrData); // fill struct COPYDATASTRUCT cds; cds.dwData = spSelectedItem->IsSpecialOperation() ? eCDType_TaskDefinitionContentSpecial : eCDType_TaskDefinitionContent; - cds.lpData = (void*)wstrData.GetData(); - cds.cbData = (DWORD)wstrData.GetBytesCount(); + cds.lpData = (void*)(const wchar_t*)wstrData; + cds.cbData = (DWORD)((wstrData.GetLength() + 1) * sizeof(wchar_t)); // send a message ::SendMessage(hWnd, WM_COPYDATA, reinterpret_cast(lpici->hwnd), reinterpret_cast(&cds)); @@ -230,7 +229,7 @@ std::wstring strSHMName = IPCSupport::GenerateSHMName(ulSHMID); chcore::TSharedMemory tSharedMemory; - chcore::TWStringData wstrData; + chcore::TString wstrData; chcore::TConfig cfgShellExtData; tSharedMemory.Open(strSHMName.c_str()); Index: src/chext/MenuExt.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/chext/MenuExt.cpp (.../MenuExt.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/chext/MenuExt.cpp (.../MenuExt.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -25,7 +25,6 @@ #include "chext-utils.h" #include #include "ShellPathsHelpers.h" -#include "../libchcore/TWStringData.h" #include "../common/TShellExtMenuConfig.h" #include "../libchcore/TSharedMemory.h" #include "../libchcore/TTaskDefinition.h" @@ -194,14 +193,14 @@ tTaskDefinition.SetOperationType(eOperationType); // get task data as xml - chcore::TWStringData wstrData; + chcore::TString wstrData; tTaskDefinition.StoreInString(wstrData); // fill struct COPYDATASTRUCT cds; cds.dwData = spSelectedItem->IsSpecialOperation() ? eCDType_TaskDefinitionContentSpecial : eCDType_TaskDefinitionContent; - cds.lpData = (void*)wstrData.GetData(); - cds.cbData = (DWORD)wstrData.GetBytesCount(); + cds.lpData = (void*)(const wchar_t*)wstrData; + cds.cbData = (DWORD)((wstrData.GetLength() + 1) * sizeof(wchar_t)); // send a message ::SendMessage(hWnd, WM_COPYDATA, reinterpret_cast(lpici->hwnd), reinterpret_cast(&cds)); @@ -383,7 +382,7 @@ std::wstring strSHMName = IPCSupport::GenerateSHMName(ulSHMID); chcore::TSharedMemory tSharedMemory; - chcore::TWStringData wstrData; + chcore::TString wstrData; chcore::TConfig cfgShellExtData; tSharedMemory.Open(strSHMName.c_str()); Index: src/libchcore/TConfig.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -26,7 +26,6 @@ #include #include #include "../libicpf/exception.h" -#include "TWStringData.h" #pragma warning(push) #pragma warning(disable: 4702 4512) @@ -245,7 +244,7 @@ } } -void TConfig::ReadFromString(const TWStringData& strInput) +void TConfig::ReadFromString(const TString& strInput) { if(strInput.IsEmpty()) THROW(_T("Invalid argument"), 0, 0, 0); @@ -254,7 +253,7 @@ ClearNL(); // also clears m_bModified - std::wistringstream ifs(strInput.GetData(), std::ios_base::in); + std::wistringstream ifs((const wchar_t*)strInput, std::ios_base::in); try { boost::property_tree::xml_parser::read_xml(ifs, m_propTree); @@ -266,15 +265,15 @@ } } -void TConfig::WriteToString(TWStringData& strOutput) +void TConfig::WriteToString(TString& strOutput) { boost::shared_lock lock(m_lock); std::wostringstream ofs(std::ios_base::out); boost::property_tree::xml_parser::write_xml(ofs, m_propTree); - strOutput = ofs.str(); + strOutput = ofs.str().c_str(); } void TConfig::SetFilePath(PCTSTR pszPath) Index: src/libchcore/TConfig.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TConfig.h (.../TConfig.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TConfig.h (.../TConfig.h) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -33,8 +33,6 @@ BEGIN_CHCORE_NAMESPACE -class TWStringData; - // class defines configuration change notification record; not to be used outside class TConfigNotifier { @@ -98,8 +96,8 @@ void Read(PCTSTR pszFile); void Write(bool bOnlyIfModified = false); - void ReadFromString(const TWStringData& strInput); - void WriteToString(TWStringData& strOutput); + void ReadFromString(const TString& strInput); + void WriteToString(TString& strOutput); void SetFilePath(PCTSTR pszPath); Index: src/libchcore/TSharedMemory.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TSharedMemory.cpp (.../TSharedMemory.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -23,7 +23,6 @@ #include "stdafx.h" #include "TSharedMemory.h" #include -#include "TWStringData.h" #include "ErrorCodes.h" BEGIN_CHCORE_NAMESPACE @@ -121,9 +120,9 @@ *(size_t*)m_pMappedMemory = sizeof(size_t); // no data inside (set just in case) } -void TSharedMemory::Create(const wchar_t* pszName, const TWStringData& wstrData) +void TSharedMemory::Create(const wchar_t* pszName, const TString& wstrData) { - Create(pszName, (BYTE*)wstrData.GetData(), wstrData.GetBytesCount()); + Create(pszName, (const BYTE*)(const wchar_t*)wstrData, (wstrData.GetLength() + 1) * sizeof(wchar_t)); } void TSharedMemory::Create(const wchar_t* pszName, const BYTE* pbyData, size_t stSize) @@ -190,7 +189,7 @@ } } -void TSharedMemory::Read(TWStringData& wstrData) const +void TSharedMemory::Read(TString& wstrData) const { if(!m_hFileMapping || !m_pMappedMemory || m_stSize <= sizeof(size_t)) THROW_CORE_EXCEPTION(eSharedMemoryNotOpen); @@ -210,9 +209,9 @@ wstrData = pszRealData; } -void TSharedMemory::Write(const TWStringData& wstrData) +void TSharedMemory::Write(const TString& wstrData) { - Write((BYTE*)wstrData.GetData(), wstrData.GetBytesCount()); + Write((const BYTE*)(const wchar_t*)wstrData, (wstrData.GetLength() + 1) * sizeof(wchar_t)); } void TSharedMemory::Write(const BYTE* pbyData, size_t stSize) Index: src/libchcore/TSharedMemory.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TSharedMemory.h (.../TSharedMemory.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TSharedMemory.h (.../TSharedMemory.h) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -23,25 +23,25 @@ #ifndef __TSHAREDMEMORY_H__ #define __TSHAREDMEMORY_H__ +#include "TString.h" + BEGIN_CHCORE_NAMESPACE -class TWStringData; - class LIBCHCORE_API TSharedMemory { public: TSharedMemory(); ~TSharedMemory(); void Create(const wchar_t* pszName, size_t stSize); - void Create(const wchar_t* pszName, const TWStringData& wstrData); + void Create(const wchar_t* pszName, const TString& wstrData); void Create(const wchar_t* pszName, const BYTE* pbyData, size_t stSize); void Open(const wchar_t* pszName); void Close() throw(); - void Read(TWStringData& wstrData) const; - void Write(const TWStringData& wstrData); + void Read(TString& wstrData) const; + void Write(const TString& wstrData); void Write(const BYTE* pbyData, size_t stSize); // below are the unsafe functions (i.e. not protected with mutex) Index: src/libchcore/TTaskDefinition.cpp =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TTaskDefinition.cpp (.../TTaskDefinition.cpp) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -253,7 +253,7 @@ } } -void TTaskDefinition::StoreInString(TWStringData& strOutput) +void TTaskDefinition::StoreInString(TString& strOutput) { // read everything chcore::TConfig tTaskInfo; @@ -276,7 +276,7 @@ tTaskInfo.WriteToString(strOutput); } -void TTaskDefinition::LoadFromString(const TWStringData& strInput) +void TTaskDefinition::LoadFromString(const TString& strInput) { // read everything chcore::TConfig tTaskInfo; Index: src/libchcore/TTaskDefinition.h =================================================================== diff -u -N -r633a533cb6e741d44fe28aa56339e1d2709b1b27 -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/TTaskDefinition.h (.../TTaskDefinition.h) (revision 633a533cb6e741d44fe28aa56339e1d2709b1b27) +++ src/libchcore/TTaskDefinition.h (.../TTaskDefinition.h) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -71,8 +71,8 @@ void Load(const std::wstring& strPath); void Store(const std::wstring& strPath, bool bOnlyIfModified = false); - void StoreInString(TWStringData& strInput); - void LoadFromString(const TWStringData& strInput); + void StoreInString(TString& strInput); + void LoadFromString(const TString& strInput); private: TString m_strTaskUniqueID; ///< Unique ID of the task that will process this request (generated automatically) Index: src/libchcore/TWStringData.cpp =================================================================== diff -u -N --- src/libchcore/TWStringData.cpp (revision 2d7bee54f998ae8f5d4145a2cf3f4a589253016f) +++ src/libchcore/TWStringData.cpp (revision 0) @@ -1,92 +0,0 @@ -// ============================================================================ -// Copyright (C) 2001-2011 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 TWString.cpp -/// @date 2011/04/10 -/// @brief Implementation of the basic wrapper over wstring. -// ============================================================================ -#include "stdafx.h" -#include "TWStringData.h" - -BEGIN_CHCORE_NAMESPACE - -TWStringData::TWStringData() -{ - -} - -TWStringData::TWStringData(const TWStringData& rSrc) : - m_wstrData(rSrc.m_wstrData) -{ -} - -TWStringData::TWStringData(const wchar_t* pszSrc) : - m_wstrData(pszSrc) -{ -} - -TWStringData::TWStringData(const std::wstring& strSrc) : - m_wstrData(strSrc.c_str()) -{ -} - -TWStringData::~TWStringData() -{ -} - -TWStringData& TWStringData::operator=(const TWStringData& rSrc) -{ - if(this != &rSrc) - m_wstrData = rSrc.m_wstrData; - - return *this; -} - -TWStringData& TWStringData::operator=(const wchar_t* pszSrc) -{ - m_wstrData = pszSrc; - return *this; -} - -TWStringData& TWStringData::operator=(const std::wstring& strSrc) -{ - m_wstrData = strSrc.c_str(); - return *this; -} - -bool TWStringData::IsEmpty() const -{ - return m_wstrData.empty(); -} - -size_t TWStringData::GetCount() const -{ - return m_wstrData.size(); -} - -size_t TWStringData::GetBytesCount() const -{ - return (m_wstrData.size() + 1) * sizeof(wchar_t); -} - -const wchar_t* TWStringData::GetData() const -{ - return m_wstrData.c_str(); -} - -END_CHCORE_NAMESPACE Index: src/libchcore/TWStringData.h =================================================================== diff -u -N --- src/libchcore/TWStringData.h (revision 2d7bee54f998ae8f5d4145a2cf3f4a589253016f) +++ src/libchcore/TWStringData.h (revision 0) @@ -1,56 +0,0 @@ -// ============================================================================ -// Copyright (C) 2001-2011 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 TWString.h -/// @date 2011/04/10 -/// @brief Basic wrapper over std::wstring. -// ============================================================================ -#ifndef __TWSTRINGDATA_H__ -#define __TWSTRINGDATA_H__ - -BEGIN_CHCORE_NAMESPACE - -class LIBCHCORE_API TWStringData -{ -public: - TWStringData(); - TWStringData(const TWStringData& rSrc); - TWStringData(const wchar_t* pszSrc); - TWStringData(const std::wstring& strSrc); - - ~TWStringData(); - - TWStringData& operator=(const TWStringData& rSrc); - TWStringData& operator=(const wchar_t* pszSrc); - TWStringData& operator=(const std::wstring& strSrc); - - bool IsEmpty() const; - size_t GetCount() const; - size_t GetBytesCount() const; - const wchar_t* GetData() const; - -private: -#pragma warning(push) -#pragma warning(disable: 4251) - std::wstring m_wstrData; -#pragma warning(pop) -}; - -END_CHCORE_NAMESPACE - -#endif Index: src/libchcore/libchcore.vc90.vcproj =================================================================== diff -u -N -r9ffa8edc757436ca9e71bdc89e5d31a2103c588c -rbe5d5dfa17e79a1db8e64ad2d2ed5faea30399cb --- src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision 9ffa8edc757436ca9e71bdc89e5d31a2103c588c) +++ src/libchcore/libchcore.vc90.vcproj (.../libchcore.vc90.vcproj) (revision be5d5dfa17e79a1db8e64ad2d2ed5faea30399cb) @@ -519,14 +519,6 @@ RelativePath=".\TTaskOperationPlan.h" > - - - -