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.

102 lines
2.0 KiB

  1. // persist.h : Declaration of PersistStorage and PersistStream
  2. #ifndef __PERSIST_H_INCLUDED__
  3. #define __PERSIST_H_INCLUDED__
  4. class PersistStorage : public IPersistStorage
  5. {
  6. public:
  7. STDMETHOD(GetClassID)(CLSID __RPC_FAR * pClassID)
  8. {
  9. UNREFERENCED_PARAMETER (pClassID);
  10. return E_NOTIMPL;
  11. }
  12. STDMETHOD(IsDirty)()
  13. {
  14. return (m_fDirty) ? S_OK : S_FALSE;
  15. }
  16. STDMETHOD(InitNew)(IStorage __RPC_FAR * pStg)
  17. {
  18. UNREFERENCED_PARAMETER (pStg);
  19. return S_OK;
  20. }
  21. STDMETHOD(Load)(IStorage __RPC_FAR * pStg)
  22. {
  23. UNREFERENCED_PARAMETER (pStg);
  24. return S_OK;
  25. }
  26. STDMETHOD(Save)(IStorage __RPC_FAR * pStgSave, BOOL fSameAsLoad)
  27. {
  28. UNREFERENCED_PARAMETER (pStgSave);
  29. UNREFERENCED_PARAMETER (fSameAsLoad);
  30. return S_OK;
  31. }
  32. STDMETHOD(SaveCompleted)(IStorage __RPC_FAR * pStgNew)
  33. {
  34. UNREFERENCED_PARAMETER (pStgNew);
  35. return S_OK;
  36. }
  37. STDMETHOD(HandsOffStorage)()
  38. {
  39. return S_OK;
  40. }
  41. void SetDirty( BOOL fDirty = TRUE ) { m_fDirty = fDirty; }
  42. BOOL m_fDirty;
  43. PersistStorage::PersistStorage() : m_fDirty( FALSE ) {}
  44. }; // class PersistStorage
  45. class PersistStream : public IPersistStream
  46. {
  47. public:
  48. STDMETHOD(GetClassID)(CLSID __RPC_FAR * pClassID)
  49. {
  50. UNREFERENCED_PARAMETER (pClassID);
  51. return E_NOTIMPL;
  52. }
  53. STDMETHOD(IsDirty)()
  54. {
  55. return (m_fDirty) ? S_OK : S_FALSE;
  56. }
  57. STDMETHOD(Load)(IStorage __RPC_FAR * pStg)
  58. {
  59. UNREFERENCED_PARAMETER (pStg);
  60. return S_OK;
  61. }
  62. STDMETHOD(Save)(IStorage __RPC_FAR * pStgSave, BOOL fSameAsLoad)
  63. {
  64. UNREFERENCED_PARAMETER (pStgSave);
  65. UNREFERENCED_PARAMETER (fSameAsLoad);
  66. return S_OK;
  67. }
  68. STDMETHOD(GetSizeMax)(ULARGE_INTEGER __RPC_FAR *pcbSize)
  69. {
  70. ASSERT(pcbSize);
  71. if (!pcbSize)
  72. return E_INVALIDARG;
  73. ::memset(pcbSize, 0, sizeof(*pcbSize));
  74. return S_OK;
  75. }
  76. void SetDirty( BOOL fDirty = TRUE ) { m_fDirty = fDirty; }
  77. BOOL m_fDirty;
  78. PersistStream::PersistStream() : m_fDirty( FALSE ) {}
  79. }; // class PersistStream
  80. #endif // ~__PERSIST_H_INCLUDED__