#if !defined(_BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_) #define _BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_ #pragma once #include #include #include #include #include namespace BCL { class CWin32UnicodeStringBuffer; class CWin32UnicodeStringBufferTraits : public CWin32BaseUnicodeStringBufferTraits { public: typedef CWin32UnicodeStringBufferTraits TThis; typedef void TAccessor; friend BCL::CPureString; typedef CWin32UnicodeStringBuffer TBuffer; }; class CWin32UnicodeStringBuffer : private BCL::CPureString, private CWin32BaseUnicodeStringBufferAddIn { protected: inline void DeallocateDynamicBuffer(); public: typedef CWin32UnicodeStringBuffer TThis; typedef CWin32UnicodeStringBufferTraits TTraits; inline CWin32UnicodeStringBuffer() : CWin32BaseUnicodeStringBufferAddIn(NULL, 0) { } inline ~CWin32UnicodeStringBuffer() { TTraits::DeallocateDynamicBuffer(this); } operator PCWSTR() const { return this->GetStringPtr(); } #include private: friend CWin32BaseUnicodeStringBufferTraits; friend CWin32UnicodeStringBufferTraits; friend BCL::CUnicodeCharTraits; }; // class CWin32UnicodeStringBuffer inline void CWin32UnicodeStringBuffer::DeallocateDynamicBuffer() { if (this->GetBufferPtr() != NULL) { TTraits::DeallocateBuffer(this->MutableBufferPair().GetPointer()); this->MutableBufferPair() = BCL::CMutablePointerAndCountPair(NULL, 0); this->SetStringCch(0); } } }; // namespace BCL #endif // !defined(_BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_)