Layers 2.0 is archived. The latest version is 3.0. Read the 3.0 docs

LObject Class

#include <Layers/lobject.h>
Inherited By: LAttribute, LStyle

Public Functions

LObject()
~LObject()
void add_child(std::unique_ptr<LObject> child)
std::vector<std::unique_ptr<LObject>> & children()
std::uint64_t children_version()
void disconnect_destroyed(const LConnectionID & connection)
std::vector<T *> find_children(bool recursive = false)
const LString & object_name()
LConnectionID on_destroyed(std::function<void ()> callback)
LObject * parent()
void remove_child(LObject * child)
void set_object_name(const LString & new_name)

Detailed Description

The LObject class is used to establish a hierarchy between Layers objects.

Member Function Documentation

LObject()

Constructs a Layers object.

~LObject()

No description available.

void add_child(std::unique_ptr<LObject> child)

Adds child to this object's list of child objects.

std::vector<std::unique_ptr<LObject>> & children()

Returns a vector containing pointers to the child objects associated with this object.

std::uint64_t children_version()

Returns a counter that increments whenever the child set changes (add_child / remove_child).

Callers that derive data from the child set (e.g. LStyle's attribute lookup cache) can record this value and treat their derivation as valid while it is unchanged.

void disconnect_destroyed(const LConnectionID & connection)

Disconnects the callback associated with connection to stop it from processing when this object gets destroyed.

template<typename T>
std::vector<T *> find_children(bool recursive = false)

Returns a vector containing pointers to the child objects, of type T, associated with this object.

If recursive is true, then the returned vector will include children of children.

const LString & object_name()

Returns the name of the object.

LConnectionID on_destroyed(std::function<void ()> callback)

Stores callback and processes it whenever this object gets destroyed.

Returns an LConnectionID which can be used to disconnect the callback later through disconnect_destroyed().

LObject * parent()

Returns a pointer to the object's parent.

Returns nullptr if no parent has been set.

void remove_child(LObject * child)

Removes child from this object's list of child objects.

void set_object_name(const LString & new_name)

Sets the object's name to new_name.

Appearance
Theme
—