Loading...
Searching...
No Matches
JSArgs

#include <AppCore/JSHelpers.h>

Overview

A vector of JSValues, used for passing around arguments in JSCallback.

Public Member Functions

 JSArgs ()
 Create an empty list of JavaScript arguments.
 
 JSArgs (const std::initializer_list< JSValue > &values)
 Create a list of JavaScript arguments using a C++ initializer list.
 
 JSArgs (const JSArgs &other)
 Copy-constructor.
 
 ~JSArgs ()
 Destructor.
 
JSArgsoperator= (const JSArgs &other)
 Assignment operator.
 
JSValue operator[] (size_t pos)
 Access an element of the argument list by index.
 
const JSValue operator[] (size_t pos) const
 Access an element of the argument list by index.
 
bool empty () const
 Whether or not the argument list is empty.
 
size_t size () const
 The number of elements in the argument list.
 
void clear ()
 Clear the argument list.
 
void push_back (const JSValue &val)
 Add a new argument to the end of the list.
 
void pop_back ()
 Remove the last item from the end of the list.
 
JSValuedata ()
 Get the argument list as a C-array of JSValues.
 
const JSValuedata () const
 Get the argument list as a C-array of JSValues (const overload)
 

Protected Attributes

void * instance_
 

Constructor & Destructor Documentation

◆ JSArgs() [1/3]

JSArgs ( )

Create an empty list of JavaScript arguments.

◆ JSArgs() [2/3]

JSArgs ( const std::initializer_list< JSValue > & values)

Create a list of JavaScript arguments using a C++ initializer list.

◆ JSArgs() [3/3]

JSArgs ( const JSArgs & other)

Copy-constructor.

◆ ~JSArgs()

~JSArgs ( )

Destructor.

Member Function Documentation

◆ clear()

void clear ( )

Clear the argument list.

◆ data() [1/2]

JSValue * data ( )

Get the argument list as a C-array of JSValues.

◆ data() [2/2]

const JSValue * data ( ) const

Get the argument list as a C-array of JSValues (const overload)

◆ empty()

bool empty ( ) const

Whether or not the argument list is empty.

◆ operator=()

JSArgs & operator= ( const JSArgs & other)

Assignment operator.

◆ operator[]() [1/2]

JSValue operator[] ( size_t pos)

Access an element of the argument list by index.

Note
All JSValues are actually wrappers of JSValueRef instances so even though this function doesn't return a JSValue& you are still operating directly on the underlying JavaScript value instance.

◆ operator[]() [2/2]

const JSValue operator[] ( size_t pos) const

Access an element of the argument list by index.

(const overload)

Note
All JSValues are actually wrappers of JSValueRef instances so even though this function doesn't return a JSValue& you are still operating directly on the underlying JavaScript value instance.

◆ pop_back()

void pop_back ( )

Remove the last item from the end of the list.

◆ push_back()

void push_back ( const JSValue & val)

Add a new argument to the end of the list.

◆ size()

size_t size ( ) const

The number of elements in the argument list.

Member Data Documentation

◆ instance_

void* instance_
protected

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