IPersistStorageImpl 类

此类实现 IPersistStorage 接口。

重要

无法在 Windows 运行时中执行的应用程序中使用此类及其成员。

语法

template <class T>
class ATL_NO_VTABLE IPersistStorageImpl : public IPersistStorage

参数

T
你的类,派生自 IPersistStorageImpl

成员

公共方法

名称 描述
IPersistStorageImpl::GetClassID 检索对象的 CLSID。
IPersistStorageImpl::HandsOffStorage 指示对象释放所有存储对象并进入 HandsOff 模式。 ATL 实现返回 S_OK。
IPersistStorageImpl::InitNew 初始化新存储。
IPersistStorageImpl::IsDirty 检查对象数据自上次保存以来是否已更改。
IPersistStorageImpl::Load 从指定的存储加载对象属性。
IPersistStorageImpl::Save 将对象属性保存到指定的存储。
IPersistStorageImpl::SaveCompleted 通知对象,该对象可以返回到 Normal 模式以写入其存储对象。 ATL 实现返回 S_OK。

备注

IPersistStorageImpl 实现 IPersistStorage 接口,该接口允许客户端请求让对象使用存储来加载并保存其持久数据。

此类的实现要求类 T 支持通过 QueryInterface 实现 IPersistStreamInit 接口。 通常,这意味着类 T 应派生自 IPersistStreamInitImpl,提供 IPersistStreamInitCOM 映射 的条目,并使用属性映射描述该类的持久数据。

相关文章ATL 教程创建 ATL 项目

继承层次结构

IPersistStorage

IPersistStorageImpl

要求

标头:atlcom.h

IPersistStorageImpl::GetClassID

检索对象的 CLSID。

STDMETHOD(GetClassID)(CLSID* pClassID);

备注

请参阅 Windows SDK 中的 IPersist::GetClassID

IPersistStorageImpl::HandsOffStorage

指示对象释放所有存储对象并进入 HandsOff 模式。

STDMETHOD(HandsOffStorage)(void);

返回值

返回 S_OK。

备注

请参阅 Windows SDK 中的 IPersistStorage::HandsOffStorage

IPersistStorageImpl::InitNew

初始化新存储。

STDMETHOD(InitNew)(IStorage*);

备注

ATL 实现委托给 IPersistStreamInit 接口。

请参阅 Windows SDK 中的 IPersistStorage:InitNew

IPersistStorageImpl::IsDirty

检查对象数据自上次保存以来是否已更改。

STDMETHOD(IsDirty)(void);

备注

ATL 实现委托给 IPersistStreamInit 接口。

请参阅 Windows SDK 中的 IPersistStorage:IsDirty

IPersistStorageImpl::Load

从指定的存储加载对象属性。

STDMETHOD(Load)(IStorage* pStorage);

备注

ATL 实现委托给 IPersistStreamInit 接口。 Load 使用名为“Contents”的流来检索对象的数据。 Save 方法最先创建此流。

请参阅 Windows SDK 中的 IPersistStorage:Load

IPersistStorageImpl::Save

将对象属性保存到指定的存储。

STDMETHOD(Save)(IStorage* pStorage, BOOL fSameAsLoad);

备注

ATL 实现委托给 IPersistStreamInit 接口。 首次调用 Save 时,它会在指定的存储上创建名为“Contents”的流。 然后,此流用于对 SaveLoad 的调用。

请参阅 Windows SDK 中的 IPersistStorage:Save

IPersistStorageImpl::SaveCompleted

通知对象,该对象可以返回到 Normal 模式以写入其存储对象。

STDMETHOD(SaveCompleted)(IStorage*);

返回值

返回 S_OK。

备注

请参阅 Windows SDK 中的 IPersistStorage:SaveCompleted

另请参阅

存储和流
IPersistStreamInitImpl 类
IPersistPropertyBagImpl 类
类概述