Manages the environments available. More...
Public Member Functions | |
Environment * | createOrRetrieve (nkMemory::StringView name) |
Environment * | get (nkMemory::StringView name) |
Environment * | getByIndex (unsigned int id) |
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
void | erase (nkMemory::StringView name) |
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.
Environment* nkScripts::EnvironmentManager::createOrRetrieve | ( | nkMemory::StringView | name | ) |
Creates if unavailable, or retrieves if available, the environment attached to a name.
name | The name of the environment the create or retrieve. |
Environment* nkScripts::EnvironmentManager::get | ( | nkMemory::StringView | name | ) |
Gets an existing environment.
name | The name of the environment to retrieve. |
Environment* nkScripts::EnvironmentManager::getByIndex | ( | unsigned int | id | ) |
Gets an environment according to an index.
id | The index to search for. |
void nkScripts::EnvironmentManager::rename | ( | nkMemory::StringView | currentName, |
nkMemory::StringView | newName | ||
) |
Renames an environment within memory.
currentName | The current name to find back the environment to alter. |
newName | The new name to assign to the environment. |
void nkScripts::EnvironmentManager::erase | ( | nkMemory::StringView | name | ) |
Erases an environment, and free its memory.
name | The name of the environment to erase. |