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.

47 lines
1.3 KiB

  1. // util.h : Utilities
  2. #ifndef __UTIL_H_
  3. #define __UTIL_H_
  4. #define LoadSaveHelpers 0
  5. #define PropBagInStream 1
  6. #if LoadSaveHelpers
  7. BOOL IsPersistable(IUnknown *pUnk);
  8. HRESULT SaveToStream(IUnknown *punk, IStorage *pstore, TCHAR *szPrefix, int n);
  9. HRESULT LoadFromStream(IStorage *pstore, TCHAR *szPrefix, int n, IUnknown **ppunk);
  10. HRESULT SaveToStorage(IUnknown *punk, IStorage *pstore, TCHAR *szPrefix, int n);
  11. HRESULT LoadFromStorage(IStorage *pstore, TCHAR *szPrefix, int n, IUnknown **ppunk);A
  12. #endif
  13. #if PropBagInStream
  14. HRESULT SaveToPropBagInStream(IPersistPropertyBag *ppersistpropbag, IStream *pstream);
  15. HRESULT LoadFromPropBagInStream(IStream *pstream, IUnknown **ppunk);
  16. class PropertyBag :
  17. public CComObjectRootEx<CComObjectThreadModel>,
  18. public IPropertyBag
  19. {
  20. public:
  21. ~PropertyBag();
  22. BEGIN_COM_MAP(PropertyBag)
  23. COM_INTERFACE_ENTRY(IPropertyBag)
  24. END_COM_MAP()
  25. HRESULT ReadFromStream(IStream *pstream);
  26. HRESULT WriteToStream(IStream *pstream);
  27. // IPropertyBag interface
  28. STDMETHOD(Read)(LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog);
  29. STDMETHOD(Write)(LPCOLESTR pszPropName, VARIANT *pVar);
  30. protected:
  31. typedef map<BSTR, VARIANT, BSTRCmpLess> t_map;
  32. t_map m_mapProps;
  33. enum {t_Variant, t_PropertyBag, t_NULL, t_Blob};
  34. };
  35. #endif
  36. #endif // __UTIL_H_