From ff72f3be107e94a0be41a1e7ba113000a4e95089 Mon Sep 17 00:00:00 2001 From: Mark Rowe Date: Mon, 11 Aug 2025 15:45:38 -0700 Subject: Deprecate Workflow::Instance in favor of Workflow::Get and Workflow::GetOrCreate Calls to `Workflow::Instance` that were looking up a built-in workflow name are updated to use `Workflow::Get`. Others use `Workflow::GetOrCreate`. --- binaryninjaapi.h | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'binaryninjaapi.h') diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 93117eb8..589556f1 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -11307,13 +11307,43 @@ namespace BinaryNinja { */ static std::vector> GetList(); - /*! Get an instance of a workflow by name. If it is already registered, this will return the registered Workflow. - If not, it will create and return a new Workflow. + /*! Get an instance of an existing registered workflow by name. + If no registered workflow exists, nullptr will be returned. + + \note Be sure to handle the nullptr case if you're retrieving + anything other than a built-in workflow. \param name Workflow name - \return The registered workflow. + \return The registered workflow, or nullptr if none exists. */ - static Ref Instance(const std::string& name = ""); + static Ref Get(const std::string& name); + + /*! Get an instance of a workflow by name. If it is already registered, + this will return the registered Workflow. If not, a new Workflow will + be created and returned. + + \note If a new workflow is returned it will have no activities. Attempting + to register new activities on it via `Insert` and `InsertAfter` will fail. + + \param name Workflow name + \return The workflow. + */ + static Ref GetOrCreate(const std::string& name); + + /*! Get an instance of a workflow by name. If it is already registered, + this will return the registered Workflow. If not, a new Workflow will + be created and returned. + + \deprecated Use `Get` or `GetOrCreate` instead. + + \note If a new workflow is returned it will have no activities. Attempting + to register new activities on it via `Insert` and `InsertAfter` will fail. + + \param name Workflow name + \return The workflow. + */ + static Ref Instance(const std::string& name = "") { return GetOrCreate(name); } + /*! Register a workflow, making it immutable and available for use \param workflow The workflow to register -- cgit v1.3.1