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.

81 lines
1.7 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. wsbvar.h
  5. Abstract:
  6. This class is a wrapper for the VARIANT structure, providing
  7. conversion and cleanup automatically. Current supported types
  8. for conversion are OLECHAR * (BSTR), IUnknown / IDispatch, and
  9. GUID. GUIDs are represented internally as strings.
  10. Author:
  11. Rohde Wakefield [rohde] 21-Jan-1997
  12. Revision History:
  13. --*/
  14. #ifndef _WSBVAR_
  15. #define _WSBVAR_
  16. class WSB_EXPORT CWsbVariant : public tagVARIANT
  17. {
  18. public:
  19. CWsbVariant ( ) { Init ( ); }
  20. ~CWsbVariant ( ) { Clear ( ); }
  21. HRESULT Clear ( ) { return ( VariantClear ( this ) ); }
  22. void Init ( ) { VariantInit ( this ); }
  23. BOOL IsEmpty ( )
  24. {
  25. return ( VT_EMPTY == vt );
  26. }
  27. CWsbVariant & operator = ( const VARIANT & variant )
  28. {
  29. VariantCopy ( this, (VARIANT *)&variant );
  30. return ( *this );
  31. }
  32. BOOL IsBstr ( )
  33. {
  34. return ( VT_BSTR == vt );
  35. }
  36. CWsbVariant ( const OLECHAR * string );
  37. CWsbVariant & operator = ( const OLECHAR * string );
  38. operator OLECHAR * ( );
  39. BOOL IsInterface ( )
  40. {
  41. return ( ( VT_UNKNOWN == vt ) || ( VT_DISPATCH == vt ) );
  42. }
  43. BOOL IsDispatch ( )
  44. {
  45. return ( ( VT_DISPATCH == vt ) );
  46. }
  47. CWsbVariant ( IUnknown * );
  48. CWsbVariant ( IDispatch * );
  49. operator IUnknown * ( );
  50. operator IDispatch * ( );
  51. CWsbVariant & operator = ( IUnknown * pUnk );
  52. CWsbVariant & operator = ( IDispatch * pDisp );
  53. CWsbVariant ( REFGUID rguid );
  54. CWsbVariant & operator = ( REFGUID rguid );
  55. operator GUID ();
  56. };
  57. #endif