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.2 KiB

  1. /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. Microsoft Windows
  3. Copyright (C) Microsoft Corporation, 1995 - 1999
  4. File: CopyItem.h
  5. Content: Declaration of _CopyXXXItem template class.
  6. History: 11-15-99 dsie created
  7. 08-20-01 xtan copy/paste
  8. ------------------------------------------------------------------------------*/
  9. #ifndef __CopyItem_H_
  10. #define __CopyItem_H_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif // _MSC_VER > 1000
  14. #include <map>
  15. #pragma warning(disable:4786) // Disable symbol names > 256 character warning.
  16. //
  17. // _CopyMapItem class.
  18. //
  19. template <class T>
  20. class _CopyMapItem
  21. {
  22. public:
  23. //
  24. // copy method.
  25. //
  26. static HRESULT copy(VARIANT * p1, std::pair<const CComBSTR, CComPtr<T> > * p2)
  27. {
  28. CComPtr<T> p = p2->second;
  29. CComVariant var = p;
  30. return VariantCopy(p1, &var);
  31. }
  32. //
  33. // init method.
  34. //
  35. static void init(VARIANT * p)
  36. {
  37. p->vt = VT_EMPTY;
  38. }
  39. //
  40. // destroy method.
  41. //
  42. static void destroy(VARIANT * p)
  43. {
  44. VariantClear(p);
  45. }
  46. };
  47. #endif