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.

91 lines
2.0 KiB

  1. //*************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation 1999 - 2000
  4. // All rights reserved
  5. //
  6. // variant.hxx
  7. //
  8. //*************************************************************
  9. #if !defined(_VARIANT_HXX_)
  10. class CVariantArg
  11. {
  12. public:
  13. virtual ~CVariantArg(){}
  14. virtual HRESULT GetUnknown(IUnknown** ppUnk) = 0;
  15. };
  16. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17. //
  18. // Class: CVariant
  19. //
  20. // Synopsis: abstracts details of variant struct so that
  21. // variant data types can be easily manipulated by code
  22. // with no knowledge of ole automation.
  23. //
  24. // This class supports a fixed subset of the variant
  25. // data types -- additional support should be added as
  26. // needed. Any resources allocated by the class to
  27. // store data should be freed by the destructor.
  28. //
  29. //-------------------------------------------------------------
  30. class CVariant
  31. {
  32. public:
  33. CVariant();
  34. ~CVariant();
  35. HRESULT SetStringValue( WCHAR* wszValue );
  36. HRESULT SetLongValue( LONG lValue );
  37. HRESULT SetBoolValue( BOOL bValue );
  38. HRESULT SetNextLongArrayElement(
  39. LONG Value,
  40. DWORD cMaxElements = 0);
  41. HRESULT SetNextByteArrayElement(
  42. BYTE byteValue,
  43. DWORD cMaxElements = 0);
  44. HRESULT SetNextStringArrayElement(
  45. WCHAR* wszValue,
  46. DWORD cMaxElements = 0);
  47. BOOL IsStringValue();
  48. BOOL IsLongValue();
  49. operator VARIANT*();
  50. private:
  51. HRESULT SetNextArrayElement(
  52. VARTYPE varType,
  53. DWORD cMaxElements,
  54. LPVOID pvData);
  55. HRESULT InitializeArray(
  56. VARTYPE varType,
  57. DWORD cMaxElements);
  58. VARIANT _var; // the variant being abstracted
  59. LONG _iCurrentArrayIndex; // current location in array
  60. DWORD _cMaxArrayElements; // max size of this type if it's an array
  61. };
  62. #endif // !defined(_VARIANT_HXX_)