26DynamicObject::DynamicObject()
30DynamicObject::DynamicObject (
const DynamicObject& other)
31 : ReferenceCountedObject(), properties (other.properties)
35DynamicObject::~DynamicObject()
42 return v !=
nullptr && !
v->isMethod();
67 if (
auto function = properties [
method].getNativeFunction())
68 return function (
args);
73void DynamicObject::setMethod (
Identifier name, var::NativeFunction function)
75 properties.set (name,
var (function));
78void DynamicObject::clear()
83void DynamicObject::cloneAllProperties()
85 for (
int i = properties.size(); --i >= 0;)
86 if (
auto*
v = properties.getVarPointerAt (i))
108 JSONFormatter::writeSpaces (
out,
indentLevel + JSONFormatter::indentSize);
111 JSONFormatter::writeString (
out, properties.getName (i));
120 out <<
',' << newLine;
Holds a resizable array of primitive or copy-by-value objects.
int size() const noexcept
Returns the current number of elements in the array.
Represents a dynamically implemented object.
void cloneAllProperties()
Calls var::clone() on all the properties that this object contains.
Represents a string identifier, designed for accessing properties by name.
The base class for streams that write data to some kind of destination.
A variant class, that can be used to hold a range of primitive values.
void remove(int index)
If the var is an array, this removes one of its elements.
This structure is passed to a NativeFunction callback, and contains invocation details about the func...