Manages the scripts available in the component. More...
Public Member Functions | |
Script * | createOrRetrieve (nkMemory::StringView name) |
Script * | get (nkMemory::StringView name) |
Script * | getByIndex (unsigned int id) |
void | rename (nkMemory::StringView currentName, nkMemory::StringView newName) |
void | erase (nkMemory::StringView name) |
Manages the scripts available in the component.
The manager always owns the memory allocated through it. External code should never call delete on memory retrieved through it. Note that the Script 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.
Script* nkScripts::ScriptManager::createOrRetrieve | ( | nkMemory::StringView | name | ) |
Creates if unavailable, or retrieves if available, a script given its name.
name | The name of the script to create or retrieve. |
Script* nkScripts::ScriptManager::get | ( | nkMemory::StringView | name | ) |
Gets an existing script.
name | The name of the script to retrieve. |
Script* nkScripts::ScriptManager::getByIndex | ( | unsigned int | id | ) |
Gets a script according to an index.
id | The index to search for. |
void nkScripts::ScriptManager::rename | ( | nkMemory::StringView | currentName, |
nkMemory::StringView | newName | ||
) |
Renames a script within memory.
currentName | The current name to find back the script to alter. |
newName | The new name to assign to the script. |
void nkScripts::ScriptManager::erase | ( | nkMemory::StringView | name | ) |
Erases a script, and free its memory.
name | The name of the script to erase. |