API reference - Class LayerPropertiesIterator

Notation used in Ruby API documentation

Description: Layer properties iterator

This iterator provides a flat view for the layers in the layer tree if used with the next method. In this mode it will descend into the hierarchy and deliver node by node as a linear (flat) sequence.

The iterator can also be used to navigate through the node hierarchy using next_sibling, down_first_child, parent etc.

The iterator also plays an important role for manipulating the layer properties tree, i.e. by specifying insertion points in the tree for the LayoutView class.

Public constructors

LayerPropertiesIteratornewCreates a new object of this class

Public methods

[const]bool!=(const LayerPropertiesIterator other)Inequality
[const]bool<(const LayerPropertiesIterator other)Comparison
[const]bool==(const LayerPropertiesIterator other)Equality
[const]voidassign(const LayerPropertiesIterator other)Assign the contents of another object to self
[const]boolat_end?At-the-end property
[const]boolat_top?At-the-top property
[const]unsigned intchild_indexReturns the index of the child within the parent
voidcreateEnsures the C++ object is created
[const]const LayerPropertiesNode ptrcurrentReturns a const reference to the layer properties node that self points to
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
voiddown_first_childMove to the first child
voiddown_last_childMove to the last child
[const]LayerPropertiesIteratordupCreates a copy of self
[const]LayerPropertiesIteratorfirst_childReturns the iterator pointing to the first child
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
[const]boolis_null?"is null" predicate
[const]LayerPropertiesIteratorlast_childReturns the iterator pointing behind the last child
LayerPropertiesIteratornextIncrement operator
voidnext_sibling(int n)Move to the next sibling by a given distance
[const]unsigned intnum_siblingsReturn the number of siblings
[const]LayerPropertiesIteratorparentReturns the iterator pointing to the parent node
voidto_sibling(unsigned int n)Move to the sibling with the given index
LayerPropertiesIteratorupMove up

Detailed description

[const] bool !=(const LayerPropertiesIterator other)

Description: Inequality

other:The other object to compare against

[const] bool <(const LayerPropertiesIterator other)

Description: Comparison

other:The other object to compare against
Returns:true, if self points to an object that comes before other

[const] bool ==(const LayerPropertiesIterator other)

Description: Equality

other:The other object to compare against

Returns true, if self and other point to the same layer properties node. Caution: this does not imply that both layer properties nodes sit in the same tab. Just their position in the tree is compared.

[const] void assign(const LayerPropertiesIterator other)

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

[const] bool at_end?

Description: At-the-end property

This predicate is true if the iterator is at the end of either all elements or at the end of the child list (if down_last_child or down_first_child is used to iterate).

[const] bool at_top?

Description: At-the-top property

This predicate is true if there is no parent node above the node addressed by self.

[const] unsigned int child_index

Description: Returns the index of the child within the parent

This method returns the index of that the properties node the iterator points to in the list of children of it's parent. If the element does not have a parent, the index of the element in the global list is returned.

void create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

[const] const LayerPropertiesNode ptr current

Description: Returns a const reference to the layer properties node that self points to

void destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.

[const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

void down_first_child

Description: Move to the first child

This method moves to the first child of the current element. If there is no child, at_end? will be true. Even then, the iterator is sitting at the the child level and up can be used to move back.

void down_last_child

Description: Move to the last child

This method moves behind the last child of the current element. at_end? will be true then. Even then, the iterator points to the child level and up can be used to move back.

Despite the name, the iterator does not address the last child, but the position after that child. To actually get the iterator for the last child, use down_last_child and next_sibling(-1).

[const] LayerPropertiesIterator dup

Description: Creates a copy of self

[const] LayerPropertiesIterator first_child

Description: Returns the iterator pointing to the first child

If there is no children, the iterator will be a valid insert point but not point to any valid element. It will report at_end? = true.

[const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

[const] bool is_null?

Description: "is null" predicate

This predicate is true if the iterator is "null". Such an iterator can be created with the default constructor or by moving a top-level iterator up.

[const] LayerPropertiesIterator last_child

Description: Returns the iterator pointing behind the last child

The iterator will be a valid insert point but not point to any valid element. It will report at_end? = true.

Despite the name, the iterator does not address the last child, but the position after that child. To actually get the iterator for the last child, use last_child and call next_sibling(-1) on that iterator.

[static] LayerPropertiesIterator new

Description: Creates a new object of this class

LayerPropertiesIterator next

Description: Increment operator

The iterator will be incremented to point to the next layer entry. It will descend into the hierarchy to address child nodes if there are any.

void next_sibling(int n)

Description: Move to the next sibling by a given distance

The iterator is moved to the nth next sibling of the current element. Use negative distances to move backward.

[const] unsigned int num_siblings

Description: Return the number of siblings

The count includes the current element. More precisely, this property delivers the number of children of the current node's parent.

[const] LayerPropertiesIterator parent

Description: Returns the iterator pointing to the parent node

This method will return an iterator pointing to the parent element. If there is no parent, the returned iterator will be a null iterator.

void to_sibling(unsigned int n)

Description: Move to the sibling with the given index

The iterator is moved to the nth sibling by selecting the nth child in the current node's parent.

LayerPropertiesIterator up

Description: Move up

The iterator is moved to point to the current element's parent. If the current element does not have a parent, the iterator will become a null iterator.