mrdocs::dom::Object

A container of key and value pairs.

Synopsis

Declared in <mrdocs/Dom/Object.hpp>
class Object final

Types

Name Description
value_type The type of an element.
const_pointer A pointer to an element.
const_reference A reference to an element.
difference_type A signed integral type.
impl_type The implementation type.
pointer A pointer to an element.
reference A reference to an element.
size_type An unsigned integral type used for indexes and sizes.
storage_type The type of storage used by the default implementation.

Member Functions

Name Description
Object [constructor]Constructor.
~Object [destructor]Destructor.
operator= Assignment.
at Return the element at a given index.
empty Return true if the container is empty.
exists Return true if a key exists.
get Return the element with the specified key
impl Return the implementation used by this object.
set Set or replace the value for a given key.
size Return the number of elements.
swap Swap two objects.
type_key Return the type key.
visit Invoke the visitor for each key/value pair

Friends

|===
Name Description
toString Return a diagnostic string.
operator<=> Compare two objects for precedence.
operator== Compare two objects for equality.
swap Swap two objects.

Non-Member Functions

Name Description
LazyObjectReturn a new dom::Object based on a transformed lazy array implementation.
LazyObjectReturn a new dom::Object based on a lazy object implementation.
newObjectReturn a new object using a custom implementation.
::mrdocs::createFrameCreate child data objects.

Description

Objects are a collection of properties, which are equivalent to key-value pairs. Property values can be any type, including other Objects, allowing for the creation of arbitrarily complex data structures.

An Object is a non-primitive (or reference) type, meaning that they are not copied when assigned or passed as a parameter. Instead, the reference is copied, and the original value is shared.

These reference types are modeled after JavaScript "Objects". All non-primitive types (Object types) are derived from Object in JavaScript. This means types such as Array and Function represent a relevant selection of built-in types that would derive from Object in JavaScript.

Properties

Objects are a collection of properties, which are equivalent to key-value pairs. There are two kinds of properties: @li Data properties: Associates a key with a value. @li Accessor properties: Associates a key with one of two accessor functions (`get` and `set`), which are used to retrieve or set the value. The internal representation of objects can determine how properties are stored and the type of properties being represented. Properties can also be enumerable or non-enumerable. An enumerable property is one that is iterated by the `visit` function. Non-enumerable properties can only be accessed by name with the `get` and `set` functions.

Created with MrDocs