共用方式為


類別 ProtectionProfile::Observer

接收 ProtectionProfile 相關通知的介面。 此介面必須由使用保護 SDK 的應用程式實作

摘要

成員 Description
public virtual void OnLoadSuccess(const std::shared_ptr<ProtectionProfile>& profile, const std::shared_ptr<void>& context) 成功載入配置檔時呼叫。
public virtual void OnLoadFailure(const std::exception_ptr& error, const std::shared_ptr<void>& context) 載入配置檔時呼叫,造成錯誤。
public virtual void OnListEnginesSuccess(const std::vector<std::string>& engineIds, const std::shared_ptr<void>& context) 成功產生引擎清單時呼叫。
public virtual void OnListEnginesFailure(const std::exception_ptr& error, const std::shared_ptr<void>& context) 列出引擎導致錯誤時呼叫。
public virtual void OnAddEngineSuccess(const std::shared_ptr<ProtectionEngine>& engine, const std::shared_ptr<void>& context) 成功新增引擎時呼叫。
public virtual void OnAddEngineFailure(const std::exception_ptr& error, const std::shared_ptr<void>& context) 新增引擎時呼叫,導致錯誤。
public virtual void OnDeleteEngineSuccess(const std::shared_ptr<void>& context) 成功刪除引擎時呼叫。
public virtual void OnDeleteEngineFailure(const std::exception_ptr& error, const std::shared_ptr<void>& context) 刪除引擎時呼叫,導致錯誤。

成員

OnLoadSuccess 函式

成功載入配置檔時呼叫。

參數:

  • 配置檔:新建立之 ProtectionProfile 的參考

  • context:傳遞至 ProtectionProfile::LoadAsync 的相同內容

應用程式可以將任何類型的內容(例如 std::p romise、std::function)傳遞至 ProtectionProfile::LoadAsync,並將相同的內容依原樣轉送至 ProtectionProfile::Observer::OnLoadSuccess 或 ProtectionProfile::Observer::OnLoadFailure

OnLoadFailure 函式

載入配置檔時呼叫,造成錯誤。

參數:

  • error:載入時發生的錯誤

  • context:傳遞至 ProtectionProfile::LoadAsync 的相同內容

應用程式可以將任何類型的內容(例如 std::p romise、std::function)傳遞至 ProtectionProfile::LoadAsync,並將相同的內容依原樣轉送至 ProtectionProfile::Observer::OnLoadSuccess 或 ProtectionProfile::Observer::OnLoadFailure

OnListEnginesSuccess 函式

成功產生引擎清單時呼叫。

參數:

  • engineIds:可用的引擎標識符清單。

  • context:傳遞至 ProtectionProfile::ListEnginesAsync 的相同內容

OnListEnginesFailure 函式

列出引擎導致錯誤時呼叫。

參數:

  • error:導致清單引擎作業失敗的錯誤。

  • context:傳遞至 ProtectionProfile::ListEnginesAsync 的相同內容

OnAddEngineSuccess 函式

成功新增引擎時呼叫。

參數:

  • 引擎:新建立的引擎

  • context:傳遞至 ProtectionProfile::AddEngineAsync 的相同內容

OnAddEngineFailure 函式

新增引擎時呼叫,導致錯誤。

參數:

  • error:造成新增引擎作業失敗的錯誤。

  • context:傳遞至 ProtectionProfile::AddEngineAsync 的相同內容

OnDeleteEngineSuccess 函式

成功刪除引擎時呼叫。

參數:

  • context:傳遞至 ProtectionProfile::D eleteEngineAsync 的相同內容

OnDeleteEngineFailure 函式

刪除引擎時呼叫,導致錯誤。

參數:

  • error:導致刪除引擎作業失敗的錯誤。

  • context:傳遞至 ProtectionProfile::D eleteEngineAsync 的相同內容