Ultralight C++ API 1.3.0
Loading...
Searching...
No Matches
ultralight::JSArgs Class Reference

#include <AppCore/JSHelpers.h>

Details

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]

ultralight::JSArgs::JSArgs ( )

Create an empty list of JavaScript arguments.

◆ JSArgs() [2/3]

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

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

◆ JSArgs() [3/3]

ultralight::JSArgs::JSArgs ( const JSArgs other)

Copy-constructor.

◆ ~JSArgs()

ultralight::JSArgs::~JSArgs ( )

Destructor.

Member Function Documentation

◆ clear()

void ultralight::JSArgs::clear ( )

Clear the argument list.

◆ data() [1/2]

JSValue * ultralight::JSArgs::data ( )

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

◆ data() [2/2]

const JSValue * ultralight::JSArgs::data ( ) const

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

◆ empty()

bool ultralight::JSArgs::empty ( ) const

Whether or not the argument list is empty.

◆ operator=()

JSArgs & ultralight::JSArgs::operator= ( const JSArgs other)

Assignment operator.

◆ operator[]() [1/2]

JSValue ultralight::JSArgs::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 ultralight::JSArgs::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 ultralight::JSArgs::pop_back ( )

Remove the last item from the end of the list.

◆ push_back()

void ultralight::JSArgs::push_back ( const JSValue val)

Add a new argument to the end of the list.

◆ size()

size_t ultralight::JSArgs::size ( ) const

The number of elements in the argument list.

Member Data Documentation

◆ instance_

void* ultralight::JSArgs::instance_
protected

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