cohtml::ArgumentsBinder

Class for communicating between EventHandler and the scripting.

#include <EventHandler.h>

Public Functions

Name
virtual~ArgumentsBinder()
template <typename T >
void
Result(const T & value)
Set the result to be send back to the scripting.
template <typename T >
void
GetArgument(int argument, T & value)
Read the nth argument into a C++ value.
virtual Binder *ResultBegin() =0
Start sending the result to the scripting. This setups the binder that the next value will be the result of the call.
virtual voidResultEnd() =0
Send the last bound value as result to the scripting.
virtual voidResultVoid() =0
Send a void result to the scripting.
virtual Binder *GetArgument(int argument) =0
Setup the binder for reading the n-th argument.
virtual intGetArgumentsCount() const =0
Get the number of arguments for the current call.
virtual boolHasError() const =0
Get whether there has been an error during argument conversion.

Public Functions Documentation

function ~ArgumentsBinder

inline virtual ~ArgumentsBinder()

function Result

template <typename T >
inline void Result(
    const T & value
)

Set the result to be send back to the scripting.

Parameters:

  • value - the value to be send back to the scripting

function GetArgument

template <typename T >
inline void GetArgument(
    int argument,
    T & value
)

Read the nth argument into a C++ value.

Parameters:

  • argument - the index of the argument, starting from 0
  • value - the C++ variable to be filled with the argument value

Note: The index of the argument is used only for logging errors. The next read operation always reads the next argument from JavaScript.

function ResultBegin

virtual Binder * ResultBegin() =0

Start sending the result to the scripting. This setups the binder that the next value will be the result of the call.

function ResultEnd

virtual void ResultEnd() =0

Send the last bound value as result to the scripting.

function ResultVoid

virtual void ResultVoid() =0

Send a void result to the scripting.

function GetArgument

virtual Binder * GetArgument(
    int argument
) =0

Setup the binder for reading the n-th argument.

Parameters:

  • argument - the index of the argument to be read, starting from 0

Return: the binder instance for the view

function GetArgumentsCount

virtual int GetArgumentsCount() const =0

Get the number of arguments for the current call.

Return: - the number of arguments for the current call

function HasError

virtual bool HasError() const =0

Get whether there has been an error during argument conversion.

Return: true if there have been errors while converting the arguments