Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
sf::ScriptGlobalEntry Class Referenceabstract

Pure virtual class to register script accessible entries through the use of sf::ScriptGlobalObject class. More...

#include <ScriptGlobalEntry.h>

Inheritance diagram for sf::ScriptGlobalEntry:
Collaboration diagram for sf::ScriptGlobalEntry:

Public Member Functions

 ScriptGlobalEntry (const std::string &name, const std::string &description, int argumentCount)
 Default Constructor adding itself to the global mapped entries.
 
virtual ~ScriptGlobalEntry ()
 Destructor. Removes itself from the mapped entries.
 
 ScriptGlobalEntry (const ScriptGlobalEntry &)=delete
 Not allowed to copy.
 
ScriptGlobalEntryoperator= (const ScriptGlobalEntry &)=delete
 Not allowed to copy.
 
std::string getName () const
 Gets the name of the entry.
 
void setDescription (const std::string &description)
 Sets the description of the entry.
 
std::string getDescription () const
 Gets the description of the entry.
 
int getArgumentCount () const
 Gets the amount of parameters that is needed for this function.
 
virtual void call (const Value::vector_type &arguments, Value &result) const =0
 Must be implemented to be able to call the function.
 

Static Public Member Functions

static bool call (const std::string &name, const Value::vector_type &arguments, Value &result)
 Finds the function with name 'name' and returns true when the function was found passing the correct amount of parameters. When found the function is also executed.
 
static ScriptGlobalEntrygetEntry (const std::string &name)
 Gets the entry pointer by name.
 

Static Public Attributes

static constexpr size_t unlimitedArgs = std::numeric_limits<int>::max()
 Unsigned size value indicating not found or no index.
 

Protected Attributes

std::string _name
 Holds the name of the entry.
 
std::string _description
 Holds description of the entry.
 
int _argumentCount {0}
 Holds the number of parameters to pass to the entry.
 

Detailed Description

Pure virtual class to register script accessible entries through the use of sf::ScriptGlobalObject class.

Constructor & Destructor Documentation

◆ ScriptGlobalEntry() [1/2]

sf::ScriptGlobalEntry::ScriptGlobalEntry ( const std::string &  name,
const std::string &  description,
int  argumentCount 
)

Default Constructor adding itself to the global mapped entries.

Parameters
nameName of the function.
descriptionDescription of the function.
argumentCountAmount of arguments needed.

◆ ~ScriptGlobalEntry()

virtual sf::ScriptGlobalEntry::~ScriptGlobalEntry ( )
virtual

Destructor. Removes itself from the mapped entries.

◆ ScriptGlobalEntry() [2/2]

sf::ScriptGlobalEntry::ScriptGlobalEntry ( const ScriptGlobalEntry )
delete

Not allowed to copy.

Member Function Documentation

◆ call() [1/2]

static bool sf::ScriptGlobalEntry::call ( const std::string &  name,
const Value::vector_type arguments,
Value result 
)
static

Finds the function with name 'name' and returns true when the function was found passing the correct amount of parameters. When found the function is also executed.

Parameters
nameName of the entry.
argumentsRequired arguments.
resultResult from the call.
Returns

◆ call() [2/2]

virtual void sf::ScriptGlobalEntry::call ( const Value::vector_type arguments,
Value result 
) const
pure virtual

Must be implemented to be able to call the function.

◆ getArgumentCount()

int sf::ScriptGlobalEntry::getArgumentCount ( ) const
inline

Gets the amount of parameters that is needed for this function.

Returns
When unlimitedArgs is unlimited, -2 is the same a unlimited but at least 2 arguments.

◆ getDescription()

std::string sf::ScriptGlobalEntry::getDescription ( ) const
inline

Gets the description of the entry.

◆ getEntry()

static ScriptGlobalEntry * sf::ScriptGlobalEntry::getEntry ( const std::string &  name)
static

Gets the entry pointer by name.

Parameters
nameName if the entry.
Returns
nullptr when not found.

◆ getName()

std::string sf::ScriptGlobalEntry::getName ( ) const
inline

Gets the name of the entry.

◆ operator=()

ScriptGlobalEntry & sf::ScriptGlobalEntry::operator= ( const ScriptGlobalEntry )
delete

Not allowed to copy.

◆ setDescription()

void sf::ScriptGlobalEntry::setDescription ( const std::string &  description)
inline

Sets the description of the entry.

Member Data Documentation

◆ _argumentCount

int sf::ScriptGlobalEntry::_argumentCount {0}
protected

Holds the number of parameters to pass to the entry.

◆ _description

std::string sf::ScriptGlobalEntry::_description
protected

Holds description of the entry.

◆ _name

std::string sf::ScriptGlobalEntry::_name
protected

Holds the name of the entry.

◆ unlimitedArgs

constexpr size_t sf::ScriptGlobalEntry::unlimitedArgs = std::numeric_limits<int>::max()
staticconstexpr

Unsigned size value indicating not found or no index.


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