1 #include "lxgui/gui_parser_common.hpp"
3 #include "lxgui/gui_frame.hpp"
4 #include "lxgui/gui_layout_node.hpp"
5 #include "lxgui/gui_manager.hpp"
6 #include "lxgui/gui_out.hpp"
7 #include "lxgui/gui_root.hpp"
8 #include "lxgui/gui_virtual_registry.hpp"
9 #include "lxgui/gui_virtual_root.hpp"
17 utils::observer_ptr<frame> parent) {
23 attr.
parent = std::move(parent);
27 <<
"Cannot use the \"virtual\" attribute on \"" << attr.
name
28 <<
"\", because it is a nested region. Attribute ignored." << std::endl;
32 <<
"Cannot use the \"parent\" attribute on \"" << attr.
name
33 <<
"\", because it is a nested region. Attribute ignored." << std::endl;
39 std::string parent_name = parent_attr.value();
41 if (!parent_name.empty() && !parent_obj) {
43 <<
"Cannot find \"" << attr.
name <<
"\"'s parent: \"" << parent_name
44 <<
"\". No parent given to this region." << std::endl;
47 attr.
parent = down_cast<frame>(parent_obj);
48 if (parent_obj !=
nullptr && attr.
parent ==
nullptr) {
50 <<
"Cannot set \"" << attr.
name <<
"\"'s parent: \"" << parent_name
51 <<
"\". This is not a frame." << std::endl;
70 <<
"' was not read by parser; check its name is spelled correctly and that it is "
71 "at the right location."
77 if (attr.is_access_check_bypassed())
80 if (!attr.was_accessed()) {
82 <<
"attribute '" << attr.get_name()
83 <<
"' was not read by parser; check its name is spelled correctly and that it "
84 "is at the right location."
bool is_access_check_bypassed() const noexcept
Check if this node should be bypassed for access checks.
std::string_view get_name() const noexcept
Returns this node's name.
bool was_accessed() const noexcept
Check if this node was accessed by the parser.
std::string_view get_location() const noexcept
Returns this node's location in the file as {file}:{line}.
An node in a layout file.
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.
bool has_attribute(std::string_view name) const noexcept
Checks if a given attribute has been specified.
children_view get_children() const noexcept
Returns a view to the list of children.
attribute_view get_attributes() const noexcept
Returns a view to the list of attributes.
std::string_view get_attribute_value(std::string_view name) const
Returns the value of the attribute with the provided name, throws if none.
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 faile...
Keeps track of created UI objects and records their names for lookup.
utils::observer_ptr< const region > get_region_by_name(std::string_view name) const
Returns the region associated with the given name.
Keeps track of virtual UI objects and records their names for lookup.
std::vector< utils::observer_ptr< const region > > get_virtual_region_list(std::string_view names) const
Return a list of virtual regions matching the provided comma-separated list.
region_core_attributes parse_core_attributes(registry ®, virtual_registry &vreg, const layout_node &node, utils::observer_ptr< frame > parent)
Parse "core" attributes from a layout node, before creating a frame.
const std::string warning
void warn_for_not_accessed_node(const layout_node &node)
Emit a warning if this node (or any of its attributes/children) was not read.
Struct holding all the core information about a region necessary for its creation.
std::vector< utils::observer_ptr< const region > > inheritance
utils::observer_ptr< frame > parent