API Documentation
Public Member Functions | List of all members
nkScripts::EnvironmentManager Class Referencefinal

Manages the environments available. More...

Inheritance diagram for nkScripts::EnvironmentManager:

Public Member Functions

EnvironmentcreateOrRetrieve (nkMemory::StringView name)
 
Environmentget (nkMemory::StringView name)
 
EnvironmentgetByIndex (unsigned int id)
 
void rename (nkMemory::StringView currentName, nkMemory::StringView newName)
 
void erase (nkMemory::StringView name)
 

Detailed Description

Manages the environments available.

The manager always owns the memory allocated from calling it. External code should never free memory returned by it.
Note that the Environment class can be instantiated directly without relying on the manager. The manager is provided as a tool to uniformize the API with the other components, allowing to manipulate nkScripts in a similar way if desirable.

Member Function Documentation

◆ createOrRetrieve()

Environment* nkScripts::EnvironmentManager::createOrRetrieve ( nkMemory::StringView  name)

Creates if unavailable, or retrieves if available, the environment attached to a name.

Parameters
nameThe name of the environment the create or retrieve.
Returns
The newly created, or existing environment.
Remarks
The manager is responsible for the environment it returns. External code should not delete it.

◆ get()

Environment* nkScripts::EnvironmentManager::get ( nkMemory::StringView  name)

Gets an existing environment.

Parameters
nameThe name of the environment to retrieve.
Returns
The environment attached to given name if available, nullptr if unavailable.

◆ getByIndex()

Environment* nkScripts::EnvironmentManager::getByIndex ( unsigned int  id)

Gets an environment according to an index.

Parameters
idThe index to search for.
Returns
The environment linked to given index if available, nullptr if unavailable.
Remarks
If manager memory is manipulated between different calls to this method, it is possible indices return different environments between the calls.

◆ rename()

void nkScripts::EnvironmentManager::rename ( nkMemory::StringView  currentName,
nkMemory::StringView  newName 
)

Renames an environment within memory.

Parameters
currentNameThe current name to find back the environment to alter.
newNameThe new name to assign to the environment.

◆ erase()

void nkScripts::EnvironmentManager::erase ( nkMemory::StringView  name)

Erases an environment, and free its memory.

Parameters
nameThe name of the environment to erase.

The documentation for this class was generated from the following file: