Magnum::OpenDdl::Structure class

OpenDDL structure.

Contents

See Document for more information.

Public functions

auto operator==(const Structure& other) const -> bool
Equality operator.
auto operator!=(const Structure& other) const -> bool
Non-equality operator.
auto isCustom() const -> bool
Whether the structure is custom.
auto type() const -> Type
Structure type.
auto identifier() const -> Int
Custom structure identifier.
auto hasName() const -> bool
Whether the structure has a name.
auto name() const -> const std::string&
Structure name.
auto arraySize() const -> std::size_t
Array size.
auto subArraySize() const -> std::size_t
Subarray size.
template<class T>
auto as() const -> const T&
Structure data.
auto asReference() const -> Containers::Optional<Structure>
Reference structure data.
template<class T>
auto asArray() const -> Containers::ArrayView<const T>
Structure data array.
auto asReferenceArray() const -> Containers::Array<Containers::Optional<Structure>>
Reference structure data array.
auto parent() const -> Containers::Optional<Structure>
Parent structure.
auto findNext() const -> Containers::Optional<Structure>
Find next sibling structure.
auto findNextOf(Int identifier) const -> Containers::Optional<Structure>
Find next custom sibling structure of given identifier.
auto findNextOf(std::initializer_list<Int> identifiers) const -> Containers::Optional<Structure>
auto findNextOf(Containers::ArrayView<const Int> identifiers) const -> Containers::Optional<Structure>
auto findNextSame() const -> Containers::Optional<Structure>
Find next custom sibling structure of the same identifier.
auto hasProperties() const -> bool
Whether the structure has properties.
auto propertyCount() const -> Int
Property count.
auto properties() const -> Implementation::PropertyList
Custom structure properties.
auto findPropertyOf(Int identifier) const -> Containers::Optional<Property>
Find custom structure property of given identifier.
auto propertyOf(Int identifier) const -> Property
Custom structure property of given identifier.
auto hasChildren() const -> bool
Whether the structure has children.
auto findFirstChild() const -> Containers::Optional<Structure>
Find first child structure.
auto firstChild() const -> Structure
First child structure.
auto children() const -> Implementation::StructureList
Structure children.
auto findFirstChildOf(Type type) const -> Containers::Optional<Structure>
Find first custom child structure of given type.
auto findFirstChildOf(Int identifier) const -> Containers::Optional<Structure>
Find first custom child structure of given identifier.
auto findFirstChildOf(std::initializer_list<Int> identifiers) const -> Containers::Optional<Structure>
auto findFirstChildOf(Containers::ArrayView<const Int> identifiers) const -> Containers::Optional<Structure>
auto firstChildOf(Type type) const -> Structure
First custom child structure of given type.
auto firstChildOf(Int identifier) const -> Structure
First custom child structure of given identifier.
auto childrenOf(Int identifier) const -> Implementation::StructureOfList<1>
Structure children of given identifier.
template<class ... T>
auto childrenOf(Int identifier, T... identifiers) const -> Implementation::StructureOfList<sizeof...(T)+1>

Function documentation

bool Magnum::OpenDdl::Structure::operator==(const Structure& other) const

Equality operator.

Returns true if the two instances refer to the same structure in the same document.

bool Magnum::OpenDdl::Structure::isCustom() const

Whether the structure is custom.

Type Magnum::OpenDdl::Structure::type() const

Structure type.

Int Magnum::OpenDdl::Structure::identifier() const

Custom structure identifier.

The structure must be custom.

const std::string& Magnum::OpenDdl::Structure::name() const

Structure name.

std::size_t Magnum::OpenDdl::Structure::arraySize() const

Array size.

The structure must not be custom.

std::size_t Magnum::OpenDdl::Structure::subArraySize() const

Subarray size.

The structure must not be custom. If the array has no subarrays, 0 is returned.

template<class T>
const T& Magnum::OpenDdl::Structure::as() const

Structure data.

The structure must not be custom, must be of corresponding type and the array must have exactly one item.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::asReference() const

Reference structure data.

The structure must not be custom, must be of Type::Reference and the array must have exactly one item. Returns referenced structure or Corrade::Containers::NullOpt if the reference is null.

template<class T>
Containers::ArrayView<const T> Magnum::OpenDdl::Structure::asArray() const

Structure data array.

The structure must not be custom and must be of corresponding type.

Containers::Array<Containers::Optional<Structure>> Magnum::OpenDdl::Structure::asReferenceArray() const

Reference structure data array.

The structure must not be custom and must be of Type::Reference. For each item returns referenced structure or Corrade::Containers::NullOpt if the reference is null.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::parent() const

Parent structure.

Returns Corrade::Containers::NullOpt if the structure is top-level.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findNext() const

Find next sibling structure.

Returns Corrade::Containers::NullOpt if the structure is last in given level.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findNextOf(Int identifier) const

Find next custom sibling structure of given identifier.

Returns Corrade::Containers::NullOpt if there is no such structure.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findNextOf(std::initializer_list<Int> identifiers) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findNextOf(Containers::ArrayView<const Int> identifiers) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findNextSame() const

Find next custom sibling structure of the same identifier.

The structure must be custom. Equivalent to calling structure.findNextOf(structure.identifier()). Returns Corrade::Containers::NullOpt if there is no such structure.

bool Magnum::OpenDdl::Structure::hasProperties() const

Whether the structure has properties.

The structure must be custom.

Int Magnum::OpenDdl::Structure::propertyCount() const

Property count.

The structure must be custom.

Implementation::PropertyList Magnum::OpenDdl::Structure::properties() const

Custom structure properties.

The structure must be custom. The returned list can be traversed using common range-based for:

for(Property p: structure.properties()) {
    // ...
}

Containers::Optional<Property> Magnum::OpenDdl::Structure::findPropertyOf(Int identifier) const

Find custom structure property of given identifier.

The structure must be custom. Returns Corrade::Containers::NullOpt if the structure doesn't contain any property of given identifier.

Property Magnum::OpenDdl::Structure::propertyOf(Int identifier) const

Custom structure property of given identifier.

The structure must be custom and there must be such property.

bool Magnum::OpenDdl::Structure::hasChildren() const

Whether the structure has children.

The structure must be custom.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findFirstChild() const

Find first child structure.

The structure must be custom. Returns Corrade::Containers::NullOpt if the structure has no children.

Structure Magnum::OpenDdl::Structure::firstChild() const

First child structure.

The structure must be custom and must have at least one child.

Implementation::StructureList Magnum::OpenDdl::Structure::children() const

Structure children.

The structure must be custom. The returned list can be traversed using common range-based for:

for(Structure p: structure.children()) {
    // ...
}

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findFirstChildOf(Type type) const

Find first custom child structure of given type.

The structure must be custom. Returns Corrade::Containers::NullOpt if there is no such structure.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findFirstChildOf(Int identifier) const

Find first custom child structure of given identifier.

The structure must be custom. Returns Corrade::Containers::NullOpt if there is no such structure.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findFirstChildOf(std::initializer_list<Int> identifiers) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Containers::Optional<Structure> Magnum::OpenDdl::Structure::findFirstChildOf(Containers::ArrayView<const Int> identifiers) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Structure Magnum::OpenDdl::Structure::firstChildOf(Type type) const

First custom child structure of given type.

The structure must be custom and there must be such child structure.

Structure Magnum::OpenDdl::Structure::firstChildOf(Int identifier) const

First custom child structure of given identifier.

The structure must be custom and there must be such child structure.

Implementation::StructureOfList<1> Magnum::OpenDdl::Structure::childrenOf(Int identifier) const

Structure children of given identifier.

The structure must be custom. The returned list can be traversed using common range-based for:

for(Structure p: structure.childrenOf(...)) {
    // ...
}

template<class ... T>
Implementation::StructureOfList<sizeof...(T)+1> Magnum::OpenDdl::Structure::childrenOf(Int identifier, T... identifiers) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.