An object whose keys are layered over the keys of a parent.

Synopsis

Declared in <mrdocs/Dom/OverlayObject.hpp>

class OverlayObjectImpl
    : public ObjectImpl

Description

The keys of the child shadow the keys of the parent: a read finds the child's value first, and falls back to the parent for any other key. A write goes to the child, so the parent is never changed. size and visit count each key once, even when both layers have it, and visit gives the keys of the child first.

An overlay of an overlay is flattened into one list of layers, so a chain of any depth costs one level of lookup per layer and never a chain of nested calls.

dom::Object parent;
parent.set("a", 1);
parent.set("b", 2);
dom::Object child;
child.set("b", 20);
dom::Object const frame = dom::overlayObject(child, parent);
// frame.get("a") is 1, frame.get("b") is 20, frame.size() is 2

Base Classes

Name

Description

ObjectImpl

Abstract object interface.

Type Aliases

Name

Description

reference

A reference to an element.

storage_type

The type of storage used by the default implementation.

Member Functions

Name

Description

OverlayObjectImpl [constructor]

Constructors

~OverlayObjectImpl [destructor] [virtual]

Destructor.

exists [virtual]

Determine if a key exists.

get [virtual]

Return the value for the specified key, or null.

set [virtual]

Insert or set the given key/value pair.

size [virtual]

Return the number of properties in the object.

typeKey [virtual]

Return the type key of the implementation.

visit [virtual]

Invoke the visitor for each key/value pair.

See Also

overlayObject

Created with MrDocs