Source code of Windows XP (NT5)
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.

60 lines
1.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: StgVar.cxx
  7. //
  8. // Contents: C++ wrapper for PROPVARIANT.
  9. //
  10. // History: 01-Aug-94 KyleP Created
  11. // 01-Apr-95 t-ColinB Added definitions for vector related
  12. // SetValue() members
  13. //
  14. //--------------------------------------------------------------------------
  15. #include <pch.cxx>
  16. #pragma hdrstop
  17. CCoTaskAllocator CoTaskAllocator; // exported data definition
  18. void *
  19. CCoTaskAllocator::Allocate(ULONG cbSize)
  20. {
  21. return(CoTaskMemAlloc(cbSize));
  22. }
  23. void
  24. CCoTaskAllocator::Free(void *pv)
  25. {
  26. CoTaskMemFree(pv);
  27. }
  28. #define VECTOR_SET_BODY( type, vtype ) \
  29. \
  30. void CStorageVariant::Set##vtype ( \
  31. type val, \
  32. unsigned pos ) \
  33. { \
  34. CAllocStorageVariant::Set##vtype( val, pos, CoTaskAllocator ); \
  35. }
  36. VECTOR_SET_BODY( CHAR, I1 );
  37. VECTOR_SET_BODY( BYTE, UI1 );
  38. VECTOR_SET_BODY( short, I2 );
  39. VECTOR_SET_BODY( USHORT, UI2 );
  40. VECTOR_SET_BODY( long, I4 );
  41. VECTOR_SET_BODY( ULONG, UI4 );
  42. VECTOR_SET_BODY( SCODE, ERROR );
  43. VECTOR_SET_BODY( LARGE_INTEGER, I8 );
  44. VECTOR_SET_BODY( ULARGE_INTEGER, UI8 );
  45. VECTOR_SET_BODY( float, R4 );
  46. VECTOR_SET_BODY( double, R8 );
  47. VECTOR_SET_BODY( VARIANT_BOOL, BOOL );
  48. VECTOR_SET_BODY( CY, CY );
  49. VECTOR_SET_BODY( DATE, DATE );
  50. VECTOR_SET_BODY( char const *, LPSTR );
  51. VECTOR_SET_BODY( WCHAR const *, LPWSTR );
  52. VECTOR_SET_BODY( BSTR, BSTR );
  53. VECTOR_SET_BODY( FILETIME, FILETIME );
  54. VECTOR_SET_BODY( CLSID, CLSID );