mrdocs::js::Value

An ECMAScript value.

Synopsis

Declared in <mrdocs/Support/JavaScript.hpp>

class Value;

Description

This class represents a value in the JavaScript interpreter.

A value is a variable that is defined in a Scope. It can be a primitive type or an object.

A Value not associated with a Scope is undefined.

The user is responsible for ensuring that the lifetime of a Value does not exceed the lifetime of the Scope that created it.

A value can be converted to a DOM value using the getDom function.

Generic JavaScript value wrapper.

An ECMAScript value.

This class represents a value in the JavaScript interpreter.

A value is a variable that is defined in a Scope. It can be a primitive type or an object.

A Value not associated with a Scope is undefined.

The user is responsible for ensuring that the lifetime of a Value does not exceed the lifetime of the Scope that created it.

A value can be converted to a DOM value using the getDom function.

Member Functions

NameDescription
Value [constructor]Constructor
~Value [destructor]Destructor
operator= Assignment operators
apply apply overloads
call Invoke a function.
empty Return if an Array or Object is empty.
erase Remove a property from an object if it exists.
exists Return true if a key exists.
get get overloads
getArray Return the underlying array.
getBool Return the underlying boolean value.
getDom Return the value as a dom::Value
getDouble Return the underlying double value.
getFunction Return the underlying array.
getInteger Return the underlying integer value.
getObject Return the underlying object.
getString Return the underlying string
isArray Check if the value is an array.
isBoolean Check if the value is a boolean.
isDouble Check if the value is a floating point number.
isFunction Check if the value is a function.
isInteger Check if the value is an integer number.
isNull Check if the value is null.
isNumber Check if the value is a number.
isObject Check if the value is an object.
isString Check if the value is a string.
isTruthy Determine if a value is truthy
isUndefined Check if the value is undefined.
lookup Lookup a sequence of keys.
operator() Invoke a function.
operator[] Subscript operators
set Set or replace the value for a given key.
size Return if an Array or Object is empty.
swap Swap two values.
type Return the type of the value.
operator std::string Return the string.
operator bool Determine if a value is truthy

Protected Member Functions

NameDescription
Value [constructor]Wrap an existing engine value without transferring ownership.

Protected Data Members

NameDescription
impl_ Shared lifetime owner for the underlying JavaScript runtime.
val_ Opaque engine value handle stored as an integer (engine-specific inside the implementation).

Friends

NameDescription
mrdocs::js::toStringReturn value as a string.
mrdocs::js::operator&&
mrdocs::js::operator&&
mrdocs::js::operator&&Return the first Value that is not truthy, or the last one.
mrdocs::js::operator||
mrdocs::js::operator||
mrdocs::js::operator||Return the first Value that is truthy, or the last one.
mrdocs::js::operator<=>Compare two values for inequality.
mrdocs::js::operator!=
mrdocs::js::operator!=
mrdocs::js::operator!=Inequality operator
mrdocs::js::operator==
mrdocs::js::operator==
mrdocs::js::operator==Compare two values for equality.
mrdocs::js::swapSwap two values.
mrdocs::js::ScopeA JavaScript scope for value lifetime management.

See Also

Scope

Type