lxgui
|
An node in a layout file. More...
#include <gui_layout_node.hpp>
Classes | |
struct | name_filter |
Public Types | |
using | child_list = std::vector< layout_node > |
using | children_view = utils::view::adaptor< const child_list, utils::view::standard_dereferencer, utils::view::no_filter > |
using | filtered_children_view = utils::view::adaptor< const child_list, utils::view::standard_dereferencer, name_filter > |
using | attribute_list = std::vector< layout_attribute > |
using | attribute_view = utils::view::adaptor< const attribute_list, utils::view::standard_dereferencer, utils::view::no_filter > |
Public Member Functions | |
layout_node ()=default | |
layout_node (const layout_node &)=default | |
layout_node (layout_node &&)=default | |
layout_node & | operator= (const layout_node &)=default |
layout_node & | operator= (layout_node &&)=default |
std::size_t | get_child_count () const noexcept |
Returns the number of children of this node. | |
const layout_node & | get_child (std::size_t index) const noexcept |
Returns a specific child of this node, by index. | |
children_view | get_children () const noexcept |
Returns a view to the list of children. | |
filtered_children_view | get_children (std::string_view name) const noexcept |
Returns a view to the list of children with a given name. | |
const layout_node * | try_get_child (std::string_view name) const noexcept |
Returns the first child with a given name, or null if none. | |
const layout_node & | get_child (std::string_view name) const |
Returns the first child with a given name, and throws if none. | |
bool | has_child (std::string_view name) const noexcept |
Checks if at least one child exists with the given name. | |
const layout_attribute * | try_get_attribute (std::string_view name) const noexcept |
Returns the attribute with the provided name, or null if none. | |
const layout_attribute & | get_attribute (std::string_view name) const |
Returns the value of the first child with the provided name, throws if none. | |
bool | has_attribute (std::string_view name) const noexcept |
Checks if a given attribute has been specified. | |
std::optional< std::string_view > | try_get_attribute_value (std::string_view name) const noexcept |
Returns the value of the attribute with the provided name, nullopt if not found. | |
template<typename T > | |
std::optional< T > | try_get_attribute_value (std::string_view name) const noexcept |
Returns the value of the attribute with the provided name, nullopt if not found or parsing failed. | |
template<typename T > | |
T | get_attribute_value_or (std::string_view name, T fallback) const noexcept |
Returns the value of the attribute with the provided name, or a default if not found or parsing failed. | |
std::string_view | get_attribute_value (std::string_view name) const |
Returns the value of the attribute with the provided name, throws if none. | |
template<typename T > | |
T | get_attribute_value (std::string_view name) const |
Returns the value of the attribute with the provided name, throws if not found or parsing failed. | |
attribute_view | get_attributes () const noexcept |
Returns a view to the list of attributes. | |
layout_node & | add_child () |
Add a new child to this node. | |
layout_attribute & | add_attribute () |
Add a new attribute to this node. | |
std::string_view | get_or_set_attribute_value (std::string_view name, std::string_view value) |
Returns the value of the attribute with the provided name, or set it if none. | |
std::string_view | get_location () const noexcept |
Returns this node's location in the file as {file}:{line}. | |
std::string_view | get_value_location () const noexcept |
Returns this node's value location in the file as {file}:{line}. | |
std::string_view | get_filename () const noexcept |
Returns the file in which this node is located. | |
std::size_t | get_line_number () const noexcept |
Returns the line number on which this node is located. | |
std::size_t | get_value_line_number () const noexcept |
Returns the line number on which this node's value is located. | |
std::string_view | get_name () const noexcept |
Returns this node's name. | |
std::string_view | get_value () const noexcept |
Returns this node's value as string. | |
template<typename T > | |
T | get_value () const |
Returns this node's value converted to a specific type. | |
template<typename T > | |
std::optional< T > | try_get_value () const noexcept |
Returns this node's value converted to a specific type, or nullopt if conversion failed. | |
template<typename T > | |
T | get_value_or (T fallback) const noexcept |
Returns this node's value converted to a specific type, or a default value. | |
void | set_location (std::string location) noexcept |
Set this node's location. | |
void | set_value_location (std::string location) noexcept |
Set this node's value location. | |
void | set_name (std::string name) noexcept |
Set this node's name. | |
void | set_value (std::string value) noexcept |
Set this node's value. | |
void | mark_as_not_accessed () const noexcept |
Flag this node as "not accessed" for later warnings. | |
void | bypass_access_check () const noexcept |
Flag this node as "fully accessed" for later warnings; no check will be done. | |
bool | was_accessed () const noexcept |
Check if this node was accessed by the parser. | |
bool | is_access_check_bypassed () const noexcept |
Check if this node should be bypassed for access checks. | |
Protected Attributes | |
std::string | name_ |
std::string | value_ |
std::string | location_ |
std::string | value_location_ |
bool | accessed_ = false |
bool | access_bypass_ = false |
An node in a layout file.
This is a format-agnostic representation of a GUI layout, as read for example from an XML or YAML file. The GUI uses this class to de-couple the layout parsing format (XML, YAML, etc) from the actual parsed layout.
Definition at line 229 of file gui_layout_node.hpp.
using lxgui::gui::layout_node::attribute_list = std::vector<layout_attribute> |
Definition at line 436 of file gui_layout_node.hpp.
using lxgui::gui::layout_node::attribute_view = utils::view:: adaptor<const attribute_list, utils::view::standard_dereferencer, utils::view::no_filter> |
Definition at line 437 of file gui_layout_node.hpp.
using lxgui::gui::layout_node::child_list = std::vector<layout_node> |
Definition at line 237 of file gui_layout_node.hpp.
using lxgui::gui::layout_node::children_view = utils::view:: adaptor<const child_list, utils::view::standard_dereferencer, utils::view::no_filter> |
Definition at line 238 of file gui_layout_node.hpp.
using lxgui::gui::layout_node::filtered_children_view = utils::view::adaptor<const child_list, utils::view::standard_dereferencer, name_filter> |
Definition at line 277 of file gui_layout_node.hpp.
|
default |
|
default |
|
default |
|
inline |
Add a new attribute to this node.
Definition at line 461 of file gui_layout_node.hpp.
|
inline |
Add a new child to this node.
Definition at line 453 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Flag this node as "fully accessed" for later warnings; no check will be done.
Definition at line 193 of file gui_layout_node.hpp.
|
inline |
Returns the value of the first child with the provided name, throws if none.
name | The name to look for |
Definition at line 351 of file gui_layout_node.hpp.
|
inline |
Returns the value of the attribute with the provided name, throws if none.
name | The name to look for |
Definition at line 419 of file gui_layout_node.hpp.
|
inline |
Returns the value of the attribute with the provided name, throws if not found or parsing failed.
name | The name to look for |
Definition at line 432 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the value of the attribute with the provided name, or a default if not found or parsing failed.
name | The name to look for |
fallback | The fallback value |
Definition at line 405 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns a view to the list of attributes.
Definition at line 444 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns a specific child of this node, by index.
index | The index (starting from 0) of this child |
Definition at line 254 of file gui_layout_node.hpp.
|
inline |
Returns the first child with a given name, and throws if none.
name | The name to look for |
Definition at line 311 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the number of children of this node.
Definition at line 245 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns a view to the list of children.
Definition at line 263 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns a view to the list of children with a given name.
name | The name to look for |
Definition at line 285 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns the file in which this node is located.
Definition at line 52 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns the line number on which this node is located.
Definition at line 61 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's location in the file as {file}:{line}.
Definition at line 36 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's name.
Definition at line 87 of file gui_layout_node.hpp.
|
inline |
Returns the value of the attribute with the provided name, or set it if none.
name | The name to look for |
value | The value to set if the attribute is missing |
Definition at line 473 of file gui_layout_node.hpp.
|
inlineinherited |
Returns this node's value converted to a specific type.
Definition at line 124 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's value as string.
Definition at line 96 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns the line number on which this node's value is located.
Definition at line 74 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's value location in the file as {file}:{line}.
Definition at line 44 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's value converted to a specific type, or a default value.
Definition at line 142 of file gui_layout_node.hpp.
|
inlinenoexcept |
Checks if a given attribute has been specified.
name | The name to look for |
Definition at line 365 of file gui_layout_node.hpp.
|
inlinenoexcept |
Checks if at least one child exists with the given name.
name | The name to look for |
Definition at line 325 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Check if this node should be bypassed for access checks.
Definition at line 209 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Flag this node as "not accessed" for later warnings.
Definition at line 188 of file gui_layout_node.hpp.
|
default |
|
default |
|
inlinenoexceptinherited |
Set this node's location.
location | The new location |
Definition at line 159 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Set this node's name.
name | The new name |
Definition at line 175 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Set this node's value.
value | The new value |
Definition at line 183 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Set this node's value location.
location | The new value location |
Definition at line 167 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the attribute with the provided name, or null if none.
name | The name to look for |
Definition at line 334 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the value of the attribute with the provided name, nullopt if not found.
name | The name to look for |
Definition at line 374 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the value of the attribute with the provided name, nullopt if not found or parsing failed.
name | The name to look for |
Definition at line 389 of file gui_layout_node.hpp.
|
inlinenoexcept |
Returns the first child with a given name, or null if none.
name | The name to look for |
Definition at line 295 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Returns this node's value converted to a specific type, or nullopt if conversion failed.
Definition at line 106 of file gui_layout_node.hpp.
|
inlinenoexceptinherited |
Check if this node was accessed by the parser.
Definition at line 201 of file gui_layout_node.hpp.
|
mutableprotectedinherited |
Definition at line 220 of file gui_layout_node.hpp.
|
mutableprotectedinherited |
Definition at line 219 of file gui_layout_node.hpp.
|
protectedinherited |
Definition at line 216 of file gui_layout_node.hpp.
|
protectedinherited |
Definition at line 214 of file gui_layout_node.hpp.
|
protectedinherited |
Definition at line 215 of file gui_layout_node.hpp.
|
protectedinherited |
Definition at line 217 of file gui_layout_node.hpp.