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.

51 lines
1.4 KiB

  1. #if !defined(_WINDOWS_BCL_INILINESTRING_H_INCLUDED_)
  2. #define _WINDOWS_BCL_INILINESTRING_H_INCLUDED_
  3. #pragma once
  4. /*++
  5. Copyright (c) 2000 Microsoft Corporation
  6. Module Name:
  7. bcl_inlinestring.h
  8. Abstract:
  9. Definitions common for strings that maintain a buffer inline
  10. with the derived object.
  11. Author:
  12. Michael Grier (MGrier) 2/6/2002
  13. Revision History:
  14. --*/
  15. #include <bcl_purestring.h>
  16. #include <bcl_unicodechartraits.h>
  17. namespace BCL {
  18. template <typename TTraits> class CInlineString : public CPureString<TTraits>
  19. {
  20. protected:
  21. inline bool IsUsingInlineBuffer() const { return this->GetBufferPtr() == this->GetInlineBufferPtr(); }
  22. inline TMutableString GetInlineBufferPtr() const { return TTraits::GetInlineBufferPtr(this); }
  23. inline TSizeT GetInlineBufferCch() const { return TTraits::GetInlineBufferCch(this); }
  24. inline TMutablePair InlineMutableBufferPair() { return TTraits::InlineMutableBufferPair(this); }
  25. inline void DeallocateDynamicBuffer()
  26. {
  27. if (this->GetBufferPtr() != this->GetInlineBufferPtr())
  28. {
  29. TTraits::DeallocateBuffer(this->GetBufferPtr());
  30. this->SetBufferPointerAndCount(this->GetInlineBufferPtr(), this->GetInlineBufferCch());
  31. this->SetStringCch(0);
  32. }
  33. }
  34. }; // class CInlineString
  35. }; // namespace BCL
  36. #endif