API Documentation
Public Member Functions | List of all members
nkScripts::Namespace Class Referenceabstract

Holds information and allow control over a namespace in a scripting environment. More...

Public Member Functions

 Namespace (nkMemory::StringView name) noexcept
 
virtual ~Namespace ()
 
nkMemory::StringView getName () const
 
virtual NamespacegetNamespace (nkMemory::StringView name) const =0
 
virtual UserTypegetUserType (nkMemory::StringView name) const =0
 
virtual void setVar (nkMemory::StringView name, bool value)=0
 
virtual void setVar (nkMemory::StringView name, int value)=0
 
virtual void setVar (nkMemory::StringView name, float value)=0
 
virtual void setVar (nkMemory::StringView name, double value)=0
 
void setVar (nkMemory::StringView name, const char *value)
 
virtual void setVar (nkMemory::StringView name, nkMemory::StringView value)=0
 
virtual void setVar (nkMemory::StringView name, const ScriptObjectReference &value)=0
 
virtual void setObject (nkMemory::StringView name, nkMemory::StringView userTypeName, void *value)=0
 
virtual NamespacesetNamespace (nkMemory::StringView name)=0
 
virtual UserTypesetUserType (nkMemory::StringView name)=0
 
virtual FunctionsetFunc (nkMemory::StringView name)=0
 
virtual void shutdown ()=0
 
virtual void reset ()=0
 

Detailed Description

Holds information and allow control over a namespace in a scripting environment.

Constructor & Destructor Documentation

◆ Namespace()

nkScripts::Namespace::Namespace ( nkMemory::StringView  name)
noexcept

Constructor.

Parameters
nameThe namespace name.

◆ ~Namespace()

virtual nkScripts::Namespace::~Namespace ( )
virtual

Destructor.

Member Function Documentation

◆ getName()

nkMemory::StringView nkScripts::Namespace::getName ( ) const
Returns
The namespace name.

◆ getNamespace()

virtual Namespace* nkScripts::Namespace::getNamespace ( nkMemory::StringView  name) const
pure virtual
Parameters
nameThe name of the sub namespace to retrieve.
Returns
The sub namespace if available, nullptr else.

◆ getUserType()

virtual UserType* nkScripts::Namespace::getUserType ( nkMemory::StringView  name) const
pure virtual
Parameters
nameThe name of the user type to retrieve.
Returns
The user type defined in the namespace if available, nullptr else.

◆ setVar() [1/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
bool  value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [2/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
int  value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [3/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
float  value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [4/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
double  value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [5/7]

void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
const char *  value 
)

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [6/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
nkMemory::StringView  value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setVar() [7/7]

virtual void nkScripts::Namespace::setVar ( nkMemory::StringView  name,
const ScriptObjectReference value 
)
pure virtual

Sets a variable within the namespace.

Parameters
nameThe name of the variable to set.
valueThe value it should have.

◆ setObject()

virtual void nkScripts::Namespace::setObject ( nkMemory::StringView  name,
nkMemory::StringView  userTypeName,
void *  value 
)
pure virtual

Sets an object within the namespace.

Parameters
nameThe name of the object to set.
userTypeNameThe user type name identifying the type of the object to set.
valueThe user data pointer to attach.

◆ setNamespace()

virtual Namespace* nkScripts::Namespace::setNamespace ( nkMemory::StringView  name)
pure virtual

Sets a sub namespace.

Parameters
nameThe name of the sub namespace to set.
Returns
The newly created namespace. External code does not own it, it should not delete it.

◆ setUserType()

virtual UserType* nkScripts::Namespace::setUserType ( nkMemory::StringView  name)
pure virtual

Sets a user type.

Parameters
nameThe name of the type to set.
Returns
The newly created user type. External code does not own it, it should not delete it.

◆ setFunc()

virtual Function* nkScripts::Namespace::setFunc ( nkMemory::StringView  name)
pure virtual

Sets a function.

Parameters
nameThe name of the sub namespace to set.
Returns
The newly created function. External code does not own it, it should not delete it.

◆ shutdown()

virtual void nkScripts::Namespace::shutdown ( )
pure virtual

Prepares the namespace for shutdown. In theory, should never be called by external code.

◆ reset()

virtual void nkScripts::Namespace::reset ( )
pure virtual

Resets the namespace, to free all sub namespaces, functions, user types set on it.


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