Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.9 KiB

  1. #if !defined(_BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_)
  2. #define _BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_
  3. #pragma once
  4. #include <windows.h>
  5. #include <bcl_inlinestring.h>
  6. #include <bcl_unicodechartraits.h>
  7. #include <bcl_w32common.h>
  8. #include <bcl_w32baseunicodestringbuffer.h>
  9. namespace BCL
  10. {
  11. class CWin32UnicodeStringBuffer;
  12. class CWin32UnicodeStringBufferTraits : public CWin32BaseUnicodeStringBufferTraits<CWin32UnicodeStringBuffer, CWin32CallDisposition, BOOL>
  13. {
  14. public:
  15. typedef CWin32UnicodeStringBufferTraits TThis;
  16. typedef void TAccessor;
  17. friend BCL::CPureString<TThis>;
  18. typedef CWin32UnicodeStringBuffer TBuffer;
  19. };
  20. class CWin32UnicodeStringBuffer : private BCL::CPureString<CWin32UnicodeStringBufferTraits>, private CWin32BaseUnicodeStringBufferAddIn
  21. {
  22. protected:
  23. inline void DeallocateDynamicBuffer();
  24. public:
  25. typedef CWin32UnicodeStringBuffer TThis;
  26. typedef CWin32UnicodeStringBufferTraits TTraits;
  27. inline CWin32UnicodeStringBuffer() : CWin32BaseUnicodeStringBufferAddIn(NULL, 0) { }
  28. inline ~CWin32UnicodeStringBuffer() { TTraits::DeallocateDynamicBuffer(this); }
  29. operator PCWSTR() const { return this->GetStringPtr(); }
  30. #include <bcl_stringapi.h>
  31. private:
  32. friend CWin32BaseUnicodeStringBufferTraits<TThis, CWin32CallDisposition, BOOL>;
  33. friend CWin32UnicodeStringBufferTraits;
  34. friend BCL::CUnicodeCharTraits<TThis, TCallDisposition>;
  35. }; // class CWin32UnicodeStringBuffer
  36. inline
  37. void
  38. CWin32UnicodeStringBuffer::DeallocateDynamicBuffer()
  39. {
  40. if (this->GetBufferPtr() != NULL)
  41. {
  42. TTraits::DeallocateBuffer(this->MutableBufferPair().GetPointer());
  43. this->MutableBufferPair() = BCL::CMutablePointerAndCountPair<WCHAR, SIZE_T>(NULL, 0);
  44. this->SetStringCch(0);
  45. }
  46. }
  47. }; // namespace BCL
  48. #endif // !defined(_BCL_W32UNICODESTRINGBUFFER_H_INCLUDED_)