mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 01:36:22 +00:00
xml_node: change with_sub_node
signature
The `with_sub_node` method is renamed to `with_optional_sub_node` to better reflect that the non-existence of a sub node with the desired type is ignored. At the same time, the new `with_sub_node` now takes a second functor that is called when no sub node of the desired type exists. genodelabs/genode#4600
This commit is contained in:
parent
f0e9881c7e
commit
7d143087c9
@ -189,10 +189,10 @@ class Genode::Affinity
|
||||
Affinity::Space space { };
|
||||
Affinity::Location location { };
|
||||
|
||||
node.with_sub_node("affinity", [&] (Xml_node const &node) {
|
||||
node.with_sub_node("space", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("affinity", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("space", [&] (Xml_node const &node) {
|
||||
space = Space::from_xml(node); });
|
||||
node.with_sub_node("location", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("location", [&] (Xml_node const &node) {
|
||||
location = Location::from_xml(space, node); });
|
||||
});
|
||||
|
||||
|
@ -846,12 +846,27 @@ class Genode::Xml_node
|
||||
* If no matching sub node exists, the functor is not called.
|
||||
*/
|
||||
template <typename FN>
|
||||
void with_sub_node(char const *type, FN const &fn) const
|
||||
void with_optional_sub_node(char const *type, FN const &fn) const
|
||||
{
|
||||
if (has_sub_node(type))
|
||||
fn(sub_node(type));
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply functor 'fn' to first sub node of specified type
|
||||
*
|
||||
* The functor is called with the sub node as argument.
|
||||
* If no matching sub node exists, the functor 'fn_nexists' is called.
|
||||
*/
|
||||
template <typename FN, typename FN_NEXISTS>
|
||||
void with_sub_node(char const *type, FN const &fn, FN_NEXISTS const &fn_nexists) const
|
||||
{
|
||||
if (has_sub_node(type))
|
||||
fn(sub_node(type));
|
||||
else
|
||||
fn_nexists();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute functor 'fn' for each sub node of specified type
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ class Linker::Config : Noncopyable
|
||||
template <typename FN>
|
||||
void for_each_library(FN const &fn) const
|
||||
{
|
||||
_config.with_sub_node("ld", [&] (Xml_node ld) {
|
||||
_config.with_optional_sub_node("ld", [&] (Xml_node ld) {
|
||||
|
||||
ld.for_each_sub_node("library", [&] (Xml_node lib) {
|
||||
|
||||
|
@ -133,7 +133,7 @@ struct Main
|
||||
|
||||
_uplink.construct(_env, _heap);
|
||||
|
||||
_config_rom.xml().with_sub_node("report", [&] (Xml_node const &xml) {
|
||||
_config_rom.xml().with_optional_sub_node("report", [&] (Xml_node const &xml) {
|
||||
bool const report_mac_address =
|
||||
xml.attribute_value("mac_address", false);
|
||||
|
||||
|
@ -37,7 +37,7 @@ class Cbe_init::Configuration
|
||||
|
||||
Configuration (Genode::Xml_node const &node)
|
||||
{
|
||||
node.with_sub_node("virtual-block-device",
|
||||
node.with_optional_sub_node("virtual-block-device",
|
||||
[&] (Genode::Xml_node const &vbd)
|
||||
{
|
||||
_vbd_nr_of_lvls =
|
||||
@ -47,7 +47,7 @@ class Cbe_init::Configuration
|
||||
_vbd_nr_of_leafs =
|
||||
vbd.attribute_value("nr_of_leafs", (Genode::uint64_t)0);
|
||||
});
|
||||
node.with_sub_node("free-tree",
|
||||
node.with_optional_sub_node("free-tree",
|
||||
[&] (Genode::Xml_node const &ft)
|
||||
{
|
||||
_ft_nr_of_lvls =
|
||||
|
@ -37,7 +37,7 @@ class Verbose_node
|
||||
|
||||
Verbose_node(Genode::Xml_node const &config)
|
||||
{
|
||||
config.with_sub_node("verbose", [&] (Genode::Xml_node const &verbose)
|
||||
config.with_optional_sub_node("verbose", [&] (Genode::Xml_node const &verbose)
|
||||
{
|
||||
_cmd_pool_cmd_pending = verbose.attribute_value("cmd_pool_cmd_pending" , false);
|
||||
_cmd_pool_cmd_in_progress = verbose.attribute_value("cmd_pool_cmd_in_progress", false);
|
||||
|
@ -428,11 +428,11 @@ void Depot_deploy::Child::gen_start_node(Xml_generator &xml,
|
||||
Affinity::Location location { };
|
||||
|
||||
if (affinity_from_launcher)
|
||||
launcher_xml.with_sub_node("affinity", [&] (Xml_node node) {
|
||||
launcher_xml.with_optional_sub_node("affinity", [&] (Xml_node node) {
|
||||
location = Affinity::Location::from_xml(affinity_space, node); });
|
||||
|
||||
if (affinity_from_start)
|
||||
start_xml.with_sub_node("affinity", [&] (Xml_node node) {
|
||||
start_xml.with_optional_sub_node("affinity", [&] (Xml_node node) {
|
||||
location = Affinity::Location::from_xml(affinity_space, node); });
|
||||
|
||||
xml.node("affinity", [&] () {
|
||||
|
@ -85,7 +85,7 @@ struct Depot_deploy::Main
|
||||
static_config.with_raw_content([&] (char const *start, size_t length) {
|
||||
xml.append(start, length); });
|
||||
|
||||
config.with_sub_node("report", [&] (Xml_node const &report) {
|
||||
config.with_optional_sub_node("report", [&] (Xml_node const &report) {
|
||||
|
||||
auto copy_bool_attribute = [&] (char const* name) {
|
||||
if (report.has_attribute(name)) {
|
||||
@ -120,7 +120,7 @@ struct Depot_deploy::Main
|
||||
});
|
||||
});
|
||||
|
||||
config.with_sub_node("heartbeat", [&] (Xml_node const &heartbeat) {
|
||||
config.with_optional_sub_node("heartbeat", [&] (Xml_node const &heartbeat) {
|
||||
size_t const rate_ms = heartbeat.attribute_value("rate_ms", 2000UL);
|
||||
xml.node("heartbeat", [&] () {
|
||||
xml.attribute("rate_ms", rate_ms);
|
||||
|
@ -409,13 +409,13 @@ void Depot_download_manager::Main::_handle_query_result()
|
||||
Archive::User user { };
|
||||
|
||||
if (missing_index_files)
|
||||
index.with_sub_node("missing", [&] (Xml_node missing) {
|
||||
index.with_optional_sub_node("missing", [&] (Xml_node missing) {
|
||||
user = missing.attribute_value("user", Archive::User()); });
|
||||
|
||||
if (user.valid())
|
||||
return user;
|
||||
|
||||
dependencies.with_sub_node("missing", [&] (Xml_node missing) {
|
||||
dependencies.with_optional_sub_node("missing", [&] (Xml_node missing) {
|
||||
user = Archive::user(missing.attribute_value("path", Archive::Path())); });
|
||||
|
||||
if (!user.valid())
|
||||
|
@ -541,7 +541,7 @@ bool Main::cbe_control_file_yields_state_idle(Xml_node const &fs_query_listing,
|
||||
{
|
||||
bool result { false };
|
||||
bool done { false };
|
||||
fs_query_listing.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
fs_query_listing.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.for_each_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
if (done) {
|
||||
return;
|
||||
@ -631,8 +631,8 @@ Main::State_string Main::_state_to_string(State state)
|
||||
Main::State Main::_state_from_fs_query_listing(Xml_node const &node)
|
||||
{
|
||||
State state { State::INVALID };
|
||||
node.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
if (_has_name(node_1, "state")) {
|
||||
state = _state_from_string(
|
||||
node_1.decoded_content<State_string>());
|
||||
@ -817,7 +817,7 @@ void Main::_handle_snapshots_fs_query_listing(Xml_node const &node)
|
||||
case State::CONTROLS_SECURITY_USER_PASSPHRASE:
|
||||
{
|
||||
bool update_dialog { false };
|
||||
node.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
|
||||
_snapshots.for_each([&] (Snapshot const &snap)
|
||||
{
|
||||
@ -931,8 +931,8 @@ void Main::_handle_client_fs_fs_query_listing(Xml_node const &node)
|
||||
switch (_state) {
|
||||
case State::STARTUP_DETERMINE_CLIENT_FS_SIZE:
|
||||
|
||||
node.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
|
||||
if (_has_name(node_1, "data")) {
|
||||
|
||||
@ -957,8 +957,8 @@ void Main::_handle_client_fs_fs_query_listing(Xml_node const &node)
|
||||
switch (_resizing_state) {
|
||||
case Resizing_state::DETERMINE_CLIENT_FS_SIZE:
|
||||
|
||||
node.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
|
||||
if (_has_name(node_1, "data")) {
|
||||
|
||||
@ -1010,8 +1010,8 @@ void Main::_handle_image_fs_query_listing(Xml_node const &node)
|
||||
case State::CONTROLS_SECURITY_USER_PASSPHRASE:
|
||||
{
|
||||
size_t size { 0 };
|
||||
node.with_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("file", [&] (Xml_node const &node_1) {
|
||||
if (_has_name(node_1, "cbe.img")) {
|
||||
size = node_1.attribute_value("size", (size_t)0);
|
||||
}
|
||||
@ -1063,7 +1063,7 @@ _child_nr_of_provided_sessions(Xml_node const &sandbox_state,
|
||||
|
||||
if (child.attribute_value("name", String<128> { }) == child_state.start_name()) {
|
||||
|
||||
child.with_sub_node("provided", [&] (Xml_node const &provided) {
|
||||
child.with_optional_sub_node("provided", [&] (Xml_node const &provided) {
|
||||
provided.for_each_sub_node("session", [&] (Xml_node const &session) {
|
||||
|
||||
if (session.attribute_value("service", String<64> { }) == service_name) {
|
||||
@ -3507,24 +3507,24 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Setup_obtain_params_hover const prev_hover { _setup_obtain_params_hover };
|
||||
Setup_obtain_params_hover next_hover { Setup_obtain_params_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
|
||||
node_2.with_sub_node("float", [&] (Xml_node const &node_3) {
|
||||
node_2.with_optional_sub_node("float", [&] (Xml_node const &node_3) {
|
||||
if (_has_name(node_3, "ok")) {
|
||||
next_hover = Setup_obtain_params_hover::START_BUTTON;
|
||||
}
|
||||
});
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("frame", [&] (Xml_node const &node_4) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("frame", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Passphrase")) {
|
||||
next_hover = Setup_obtain_params_hover::PASSPHRASE_INPUT;
|
||||
}
|
||||
});
|
||||
node_3.with_sub_node("float", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
node_3.with_optional_sub_node("float", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Show Hide")) {
|
||||
next_hover = Setup_obtain_params_hover::PASSPHRASE_SHOW_HIDE_BUTTON;
|
||||
@ -3532,7 +3532,7 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
});
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
|
||||
if (_has_name(node_3, "Client FS Size")) {
|
||||
next_hover = Setup_obtain_params_hover::CLIENT_FS_SIZE_INPUT;
|
||||
@ -3556,24 +3556,24 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Setup_obtain_params_hover const prev_hover { _setup_obtain_params_hover };
|
||||
Setup_obtain_params_hover next_hover { Setup_obtain_params_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
|
||||
node_2.with_sub_node("float", [&] (Xml_node const &node_3) {
|
||||
node_2.with_optional_sub_node("float", [&] (Xml_node const &node_3) {
|
||||
if (_has_name(node_3, "ok")) {
|
||||
next_hover = Setup_obtain_params_hover::START_BUTTON;
|
||||
}
|
||||
});
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("frame", [&] (Xml_node const &node_4) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("frame", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Passphrase")) {
|
||||
next_hover = Setup_obtain_params_hover::PASSPHRASE_INPUT;
|
||||
}
|
||||
});
|
||||
node_3.with_sub_node("float", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
node_3.with_optional_sub_node("float", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Show Hide")) {
|
||||
next_hover = Setup_obtain_params_hover::PASSPHRASE_SHOW_HIDE_BUTTON;
|
||||
@ -3596,11 +3596,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Controls_root_hover const prev_hover { _controls_root_hover };
|
||||
Controls_root_hover next_hover { Controls_root_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3609,9 +3609,9 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Snapshots")) {
|
||||
|
||||
@ -3646,11 +3646,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Snapshot_pointer const prev_snapshots_hover { _snapshots_hover };
|
||||
Snapshot_pointer next_snapshots_hover { };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3658,20 +3658,20 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_snapshots_select.valid()) {
|
||||
|
||||
node_5.with_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Leave")) {
|
||||
|
||||
next_hover = Controls_snapshots_hover::GENERATION_LEAVE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("button", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("button", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Discard")) {
|
||||
|
||||
@ -3681,18 +3681,18 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
|
||||
} else {
|
||||
|
||||
node_5.with_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Leave")) {
|
||||
|
||||
next_hover = Controls_snapshots_hover::LEAVE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("vbox", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("vbox", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Generations")) {
|
||||
|
||||
node_6.with_sub_node("float", [&] (Xml_node const &node_7) {
|
||||
node_6.with_optional_sub_node("float", [&] (Xml_node const &node_7) {
|
||||
|
||||
Generation const generation {
|
||||
node_7.attribute_value(
|
||||
@ -3710,7 +3710,7 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
});
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("button", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("button", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Create")) {
|
||||
|
||||
@ -3741,11 +3741,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Dimensions_hover const prev_hover { _dimensions_hover };
|
||||
Dimensions_hover next_hover { Dimensions_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3753,16 +3753,16 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Leave")) {
|
||||
|
||||
next_hover = Dimensions_hover::LEAVE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Expand Client FS")) {
|
||||
|
||||
@ -3793,11 +3793,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Expand_client_fs_hover const prev_hover { _expand_client_fs_hover };
|
||||
Expand_client_fs_hover next_hover { Expand_client_fs_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3806,24 +3806,24 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_5.with_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_5.with_optional_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Leave")) {
|
||||
|
||||
next_hover = Expand_client_fs_hover::LEAVE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("float", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("float", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Start")) {
|
||||
|
||||
next_hover = Expand_client_fs_hover::START_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("frame", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("frame", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Contingent")) {
|
||||
|
||||
@ -3848,12 +3848,12 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Expand_snapshot_buf_hover const prev_hover { _expand_snapshot_buf_hover };
|
||||
Expand_snapshot_buf_hover next_hover { Expand_snapshot_buf_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3862,25 +3862,25 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
node_5.with_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("hbox", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Leave")) {
|
||||
|
||||
next_hover = Expand_snapshot_buf_hover::LEAVE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("float", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("float", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Start")) {
|
||||
|
||||
next_hover = Expand_snapshot_buf_hover::START_BUTTON;
|
||||
}
|
||||
});
|
||||
node_5.with_sub_node("frame", [&] (Xml_node const &node_6) {
|
||||
node_5.with_optional_sub_node("frame", [&] (Xml_node const &node_6) {
|
||||
|
||||
if (_has_name(node_6, "Contingent")) {
|
||||
|
||||
@ -3905,11 +3905,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Controls_security_hover const prev_hover { _controls_security_hover };
|
||||
Controls_security_hover next_hover { Controls_security_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3918,16 +3918,16 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Leave")) {
|
||||
|
||||
next_hover = Controls_security_hover::SECURITY_EXPAND_BUTTON;
|
||||
}
|
||||
});
|
||||
node_4.with_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
node_4.with_optional_sub_node("vbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Block Encryption Key")) {
|
||||
|
||||
@ -3959,11 +3959,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Controls_security_block_encryption_key_hover const prev_hover { _controls_security_block_encryption_key_hover };
|
||||
Controls_security_block_encryption_key_hover next_hover { Controls_security_block_encryption_key_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -3972,16 +3972,16 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("button", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Rekey")) {
|
||||
|
||||
next_hover = Controls_security_block_encryption_key_hover::REPLACE_BUTTON;
|
||||
}
|
||||
});
|
||||
node_4.with_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
node_4.with_optional_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Leave")) {
|
||||
|
||||
@ -4005,11 +4005,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Controls_security_master_key_hover const prev_hover { _controls_security_master_key_hover };
|
||||
Controls_security_master_key_hover next_hover { Controls_security_master_key_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -4018,9 +4018,9 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Leave")) {
|
||||
|
||||
@ -4044,11 +4044,11 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
Controls_security_user_passphrase_hover const prev_hover { _controls_security_user_passphrase_hover };
|
||||
Controls_security_user_passphrase_hover next_hover { Controls_security_user_passphrase_hover::NONE };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &node_0) {
|
||||
node_0.with_optional_sub_node("frame", [&] (Xml_node const &node_1) {
|
||||
node_1.with_optional_sub_node("vbox", [&] (Xml_node const &node_2) {
|
||||
node_2.with_optional_sub_node("hbox", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("button", [&] (Xml_node const &node_4) {
|
||||
|
||||
if (_has_name(node_4, "Shut down")) {
|
||||
|
||||
@ -4057,9 +4057,9 @@ void File_vault::Main::_handle_hover(Xml_node const &node)
|
||||
}
|
||||
});
|
||||
});
|
||||
node_2.with_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
node_2.with_optional_sub_node("frame", [&] (Xml_node const &node_3) {
|
||||
node_3.with_optional_sub_node("vbox", [&] (Xml_node const &node_4) {
|
||||
node_4.with_optional_sub_node("hbox", [&] (Xml_node const &node_5) {
|
||||
|
||||
if (_has_name(node_5, "Leave")) {
|
||||
|
||||
|
@ -762,7 +762,7 @@ struct Main
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
config.with_sub_node("actions", [&] (Genode::Xml_node actions) {
|
||||
config.with_optional_sub_node("actions", [&] (Genode::Xml_node actions) {
|
||||
success = _writer->execute_actions(actions); });
|
||||
|
||||
_env.parent().exit(success ? 0 : 1);
|
||||
|
@ -318,7 +318,7 @@ void Menu_view::Main::_handle_config()
|
||||
|
||||
_background_color = config.attribute_value("background", Color(127, 127, 127, 255));
|
||||
|
||||
config.with_sub_node("vfs", [&] (Xml_node const &vfs_node) {
|
||||
config.with_optional_sub_node("vfs", [&] (Xml_node const &vfs_node) {
|
||||
_vfs_env.root_dir().apply_config(vfs_node); });
|
||||
|
||||
_handle_dialog_update();
|
||||
|
@ -1247,7 +1247,7 @@ struct Sculpt::Main : Input_event_handler,
|
||||
/*
|
||||
* Read static platform information
|
||||
*/
|
||||
_platform.xml().with_sub_node("affinity-space", [&] (Xml_node const &node) {
|
||||
_platform.xml().with_optional_sub_node("affinity-space", [&] (Xml_node const &node) {
|
||||
_affinity_space = Affinity::Space(node.attribute_value("width", 1U),
|
||||
node.attribute_value("height", 1U));
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ void Menu_view::_handle_hover()
|
||||
_seq_number.construct(seq);
|
||||
}
|
||||
|
||||
hover.with_sub_node("dialog", [&] (Xml_node hover) {
|
||||
hover.with_optional_sub_node("dialog", [&] (Xml_node hover) {
|
||||
_hovered = true;
|
||||
hover_result = _dialog.hover(hover);
|
||||
});
|
||||
|
@ -67,12 +67,12 @@ struct Sculpt::Component : Noncopyable
|
||||
if (path != pkg.attribute_value("path", Path()))
|
||||
return;
|
||||
|
||||
pkg.with_sub_node("runtime", [&] (Xml_node runtime) {
|
||||
pkg.with_optional_sub_node("runtime", [&] (Xml_node runtime) {
|
||||
|
||||
ram = runtime.attribute_value("ram", Number_of_bytes());
|
||||
caps = runtime.attribute_value("caps", 0UL);
|
||||
|
||||
runtime.with_sub_node("requires", [&] (Xml_node requires) {
|
||||
runtime.with_optional_sub_node("requires", [&] (Xml_node requires) {
|
||||
routes.update_from_xml(_route_update_policy, requires); });
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ struct Sculpt::File_browser_state : Noncopyable
|
||||
{
|
||||
unsigned cnt = 0;
|
||||
with_query_result([&] (Xml_node node) {
|
||||
node.with_sub_node("dir", [&] (Xml_node listing) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node listing) {
|
||||
listing.for_each_sub_node([&] (Xml_node entry) {
|
||||
if (Index(cnt++) == index)
|
||||
fn(entry); }); }); });
|
||||
|
@ -47,13 +47,13 @@ class Sculpt::Runtime_config
|
||||
static Start_name _to_name(Xml_node node)
|
||||
{
|
||||
Start_name result { };
|
||||
node.with_sub_node("child", [&] (Xml_node child) {
|
||||
node.with_optional_sub_node("child", [&] (Xml_node child) {
|
||||
result = child.attribute_value("name", Start_name()); });
|
||||
|
||||
if (result.valid())
|
||||
return result;
|
||||
|
||||
node.with_sub_node("parent", [&] (Xml_node parent) {
|
||||
node.with_optional_sub_node("parent", [&] (Xml_node parent) {
|
||||
|
||||
Service::Type_name const service =
|
||||
node.attribute_value("name", Service::Type_name());
|
||||
@ -143,8 +143,8 @@ class Sculpt::Runtime_config
|
||||
static Start_name _primary_dependency(Xml_node const start)
|
||||
{
|
||||
Start_name result { };
|
||||
start.with_sub_node("route", [&] (Xml_node route) {
|
||||
route.with_sub_node("service", [&] (Xml_node service) {
|
||||
start.with_optional_sub_node("route", [&] (Xml_node route) {
|
||||
route.with_optional_sub_node("service", [&] (Xml_node service) {
|
||||
result = _to_name(service); }); });
|
||||
|
||||
return result;
|
||||
@ -291,14 +291,14 @@ class Sculpt::Runtime_config
|
||||
{
|
||||
Dep::Update_policy policy { _alloc };
|
||||
|
||||
node.with_sub_node("route", [&] (Xml_node route) {
|
||||
node.with_optional_sub_node("route", [&] (Xml_node route) {
|
||||
elem.deps.update_from_xml(policy, route); });
|
||||
}
|
||||
|
||||
{
|
||||
Child_service::Update_policy policy { elem.name, _alloc };
|
||||
|
||||
node.with_sub_node("provides", [&] (Xml_node provides) {
|
||||
node.with_optional_sub_node("provides", [&] (Xml_node provides) {
|
||||
elem._child_services.update_from_xml(policy,
|
||||
provides); });
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ struct Sculpt::Dialog : Interface
|
||||
{
|
||||
Hover_result result = Hover_result::UNMODIFIED;
|
||||
|
||||
hover.with_sub_node(sub_node, [&] (Xml_node sub_hover) {
|
||||
hover.with_optional_sub_node(sub_node, [&] (Xml_node sub_hover) {
|
||||
if (_match_sub_dialog(sub_hover, tail...) == Hover_result::CHANGED)
|
||||
result = Hover_result::CHANGED; });
|
||||
|
||||
|
@ -281,7 +281,7 @@ struct Sculpt::File_browser_dialog : Noncopyable, Dialog
|
||||
unsigned cnt = 0;
|
||||
|
||||
_state.with_query_result([&] (Xml_node node) {
|
||||
node.with_sub_node("dir", [&] (Xml_node listing) {
|
||||
node.with_optional_sub_node("dir", [&] (Xml_node listing) {
|
||||
|
||||
if (_state.path != "/")
|
||||
_gen_back_entry(xml);
|
||||
|
@ -631,8 +631,8 @@ void Dialog::handle_hover(Xml_node const &hover)
|
||||
|
||||
_hovered_position.construct(max_x, y);
|
||||
|
||||
node.with_sub_node("float", [&] (Xml_node node) {
|
||||
node.with_sub_node("label", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("float", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("label", [&] (Xml_node node) {
|
||||
|
||||
Line::Index const x {
|
||||
node.attribute_value("at", max_x.value) };
|
||||
@ -654,14 +654,14 @@ void Dialog::handle_hover(Xml_node const &hover)
|
||||
|
||||
_text_hovered = false;
|
||||
|
||||
hover.with_sub_node("frame", [&] (Xml_node node) {
|
||||
node.with_sub_node("button", [&] (Xml_node node) {
|
||||
hover.with_optional_sub_node("frame", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("button", [&] (Xml_node node) {
|
||||
|
||||
_text_hovered = true;
|
||||
|
||||
node.with_sub_node("float", [&] (Xml_node node) {
|
||||
node.with_sub_node("vbox", [&] (Xml_node node) {
|
||||
node.with_sub_node("hbox", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("float", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("vbox", [&] (Xml_node node) {
|
||||
node.with_optional_sub_node("hbox", [&] (Xml_node node) {
|
||||
with_hovered_line(node); }); }); }); }); });
|
||||
|
||||
if (hover_changed || position_changed || (_text_hovered != orig_text_hovered))
|
||||
|
@ -92,7 +92,7 @@ struct Text_area::Main : Sandbox::Local_service_base::Wakeup,
|
||||
if (!node.has_sub_node("dialog"))
|
||||
_dialog.handle_hover(Xml_node("<empty/>"));
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &dialog) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &dialog) {
|
||||
_dialog.handle_hover(dialog); });
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ struct Text_area::Main : Sandbox::Local_service_base::Wakeup,
|
||||
if (_editable()) {
|
||||
bool const orig_saved_reporter_enabled = _saved_reporter.constructed();
|
||||
|
||||
config.with_sub_node("report", [&] (Xml_node const &node) {
|
||||
config.with_optional_sub_node("report", [&] (Xml_node const &node) {
|
||||
_saved_reporter.conditional(node.attribute_value("saved", false),
|
||||
_env, "saved", "saved"); });
|
||||
|
||||
@ -471,7 +471,7 @@ struct Text_area::Main : Sandbox::Local_service_base::Wakeup,
|
||||
|
||||
Saved_version const orig_saved_version = _saved_version;
|
||||
|
||||
config.with_sub_node("save", [&] (Xml_node const &node) {
|
||||
config.with_optional_sub_node("save", [&] (Xml_node const &node) {
|
||||
_saved_version.value =
|
||||
node.attribute_value("version", _saved_version.value); });
|
||||
|
||||
|
@ -90,7 +90,7 @@ struct Touch_keyboard::Main : Sandbox::Local_service_base::Wakeup,
|
||||
{
|
||||
Input::Seq_number hover_seq { node.attribute_value("seq_number", 0U) };
|
||||
|
||||
node.with_sub_node("dialog", [&] (Xml_node const &dialog) {
|
||||
node.with_optional_sub_node("dialog", [&] (Xml_node const &dialog) {
|
||||
_dialog.handle_hover(hover_seq, dialog); });
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,10 @@ void Dialog::handle_hover(Input::Seq_number seq, Xml_node const &dialog)
|
||||
Row::Id hovered_row_id { };
|
||||
Key::Id hovered_key_id { };
|
||||
|
||||
dialog.with_sub_node("frame", [&] (Xml_node const &frame) {
|
||||
frame.with_sub_node("vbox", [&] (Xml_node const &vbox) {
|
||||
vbox.with_sub_node("hbox", [&] (Xml_node const &hbox) {
|
||||
hbox.with_sub_node("vbox", [&] (Xml_node const &button) {
|
||||
dialog.with_optional_sub_node("frame", [&] (Xml_node const &frame) {
|
||||
frame.with_optional_sub_node("vbox", [&] (Xml_node const &vbox) {
|
||||
vbox.with_optional_sub_node("hbox", [&] (Xml_node const &hbox) {
|
||||
hbox.with_optional_sub_node("vbox", [&] (Xml_node const &button) {
|
||||
hovered_row_id = hbox .attribute_value("name", Row::Id());
|
||||
hovered_key_id = button.attribute_value("name", Key::Id());
|
||||
});
|
||||
|
@ -211,7 +211,7 @@ struct Terminal::Main : Character_consumer
|
||||
_fb_mode = _gui.mode();
|
||||
|
||||
/* apply initial size from config, if provided */
|
||||
_config.xml().with_sub_node("initial", [&] (Xml_node const &initial) {
|
||||
_config.xml().with_optional_sub_node("initial", [&] (Xml_node const &initial) {
|
||||
_fb_mode.area = Area(initial.attribute_value("width", _fb_mode.area.w()),
|
||||
initial.attribute_value("height", _fb_mode.area.h()));
|
||||
});
|
||||
|
@ -71,8 +71,8 @@ void Libc::init_file_operations(Cwd &cwd,
|
||||
{
|
||||
_cwd_ptr = &cwd;
|
||||
|
||||
config_accessor.config().with_sub_node("libc", [&] (Xml_node libc) {
|
||||
libc.with_sub_node("mmap", [&] (Xml_node mmap) {
|
||||
config_accessor.config().with_optional_sub_node("libc", [&] (Xml_node libc) {
|
||||
libc.with_optional_sub_node("mmap", [&] (Xml_node mmap) {
|
||||
_mmap_align_log2 = mmap.attribute_value("align_log2",
|
||||
(unsigned int)PAGE_SHIFT);
|
||||
});
|
||||
|
@ -140,7 +140,7 @@ void Libc::Child_config::_generate(Xml_generator &xml, Xml_node config)
|
||||
xml.attribute("pid", _pid);
|
||||
|
||||
typedef String<Vfs::MAX_PATH_LEN> Path;
|
||||
config.with_sub_node("libc", [&] (Xml_node node) {
|
||||
config.with_optional_sub_node("libc", [&] (Xml_node node) {
|
||||
if (node.has_attribute("rtc"))
|
||||
xml.attribute("rtc", node.attribute_value("rtc", Path()));
|
||||
if (node.has_attribute("pipe"))
|
||||
|
@ -145,7 +145,7 @@ class Libc::Vfs_plugin final : public Plugin
|
||||
static bool _init_pipe_configured(Xml_node config)
|
||||
{
|
||||
bool result = false;
|
||||
config.with_sub_node("libc", [&] (Xml_node libc_node) {
|
||||
config.with_optional_sub_node("libc", [&] (Xml_node libc_node) {
|
||||
result = libc_node.has_attribute("pipe"); });
|
||||
return result;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ size_t Libc::Kernel::_user_stack_size()
|
||||
{
|
||||
size_t size = Component::stack_size();
|
||||
|
||||
_libc_env.libc_config().with_sub_node("stack", [&] (Xml_node stack) {
|
||||
_libc_env.libc_config().with_optional_sub_node("stack", [&] (Xml_node stack) {
|
||||
size = stack.attribute_value("size", Number_of_bytes(0)); });
|
||||
|
||||
return size;
|
||||
|
@ -104,7 +104,7 @@ Qemu::Controller *Qemu::usb_init(Timer_queue &tq, Pci_device &pci,
|
||||
_type_init_xhci_pci_register_types();
|
||||
_type_init_usb_host_register_types(&ep, &alloc, &env);
|
||||
|
||||
config.with_sub_node("webcam", [&] (Genode::Xml_node const &node) {
|
||||
config.with_optional_sub_node("webcam", [&] (Genode::Xml_node const &node) {
|
||||
_type_init_host_webcam_register_types(env, node);
|
||||
});
|
||||
|
||||
|
@ -193,7 +193,7 @@ void Genode::with_matching_policy(String<N> const &label,
|
||||
|
||||
/* fall back to default policy if no match exists */
|
||||
if (best_match.has_type("none"))
|
||||
policies.with_sub_node("default-policy", [&] (Xml_node const &policy) {
|
||||
policies.with_optional_sub_node("default-policy", [&] (Xml_node const &policy) {
|
||||
best_match = policy; });
|
||||
|
||||
if (best_match.has_type("none"))
|
||||
|
@ -266,7 +266,7 @@ void Main::sys_rom_update()
|
||||
Main::Main(Env & env) : env(env)
|
||||
{
|
||||
sys_rom.sigh(sys_rom_handler);
|
||||
platform_info.xml().with_sub_node("kernel", [&] (Xml_node xml)
|
||||
platform_info.xml().with_optional_sub_node("kernel", [&] (Xml_node xml)
|
||||
{
|
||||
apic_capable = xml.attribute_value("acpi", false);
|
||||
msi_capable = xml.attribute_value("msi", false);
|
||||
|
@ -45,8 +45,8 @@ struct Framebuffer::Main
|
||||
static Info from_platform_info(Xml_node const &node)
|
||||
{
|
||||
Info result { };
|
||||
node.with_sub_node("boot", [&] (Xml_node const &boot) {
|
||||
boot.with_sub_node("framebuffer", [&] (Xml_node const &fb) {
|
||||
node.with_optional_sub_node("boot", [&] (Xml_node const &boot) {
|
||||
boot.with_optional_sub_node("framebuffer", [&] (Xml_node const &fb) {
|
||||
result = {
|
||||
.addr = fb.attribute_value("phys", 0UL),
|
||||
.size = { fb.attribute_value("width", 0U),
|
||||
|
@ -212,7 +212,7 @@ struct Main
|
||||
|
||||
Main(Env &env) : _env(env)
|
||||
{
|
||||
_config_rom.xml().with_sub_node("report", [&] (Xml_node const &xml) {
|
||||
_config_rom.xml().with_optional_sub_node("report", [&] (Xml_node const &xml) {
|
||||
bool const report_mac_address =
|
||||
xml.attribute_value("mac_address", false);
|
||||
|
||||
|
@ -77,7 +77,7 @@ struct Platform::Main
|
||||
|
||||
try {
|
||||
Attached_rom_dataspace info { _env, "platform_info" };
|
||||
info.xml().with_sub_node("kernel", [&] (Xml_node const &node) {
|
||||
info.xml().with_optional_sub_node("kernel", [&] (Xml_node const &node) {
|
||||
acpi_platform = node.attribute_value("acpi", acpi_platform);
|
||||
msi_platform = node.attribute_value("msi" , msi_platform);
|
||||
});
|
||||
@ -188,7 +188,7 @@ void Platform::Main::_attempt_acpi_reset()
|
||||
if (!acpi_rom.constructed())
|
||||
return;
|
||||
|
||||
acpi_rom->xml().with_sub_node("reset", [&] (Xml_node reset) {
|
||||
acpi_rom->xml().with_optional_sub_node("reset", [&] (Xml_node reset) {
|
||||
|
||||
uint16_t const io_port = reset.attribute_value("io_port", (uint16_t)0);
|
||||
uint8_t const value = reset.attribute_value("value", (uint8_t)0);
|
||||
|
@ -49,7 +49,7 @@ struct Init::Main : Sandbox::State_handler
|
||||
Xml_node const config = _config.xml();
|
||||
|
||||
bool reporter_enabled = false;
|
||||
config.with_sub_node("report", [&] (Xml_node report) {
|
||||
config.with_optional_sub_node("report", [&] (Xml_node report) {
|
||||
|
||||
reporter_enabled = true;
|
||||
|
||||
|
@ -702,7 +702,7 @@ void ::Root::_announce_service()
|
||||
/*
|
||||
* Check for report policy, and resp. con-/destruct device reporter
|
||||
*/
|
||||
_config.xml().with_sub_node("report", [&] (Xml_node node) {
|
||||
_config.xml().with_optional_sub_node("report", [&] (Xml_node node) {
|
||||
_device_reporter.conditional(node.attribute_value("devices", false),
|
||||
_env, "devices", "devices" );
|
||||
|
||||
|
@ -66,8 +66,8 @@ Sandbox::Child::apply_config(Xml_node start_node)
|
||||
* The <route> node may affect the availability or unavailability
|
||||
* of dependencies.
|
||||
*/
|
||||
start_node.with_sub_node("route", [&] (Xml_node const &route) {
|
||||
_start_node->xml().with_sub_node("route", [&] (Xml_node const &orig) {
|
||||
start_node.with_optional_sub_node("route", [&] (Xml_node const &route) {
|
||||
_start_node->xml().with_optional_sub_node("route", [&] (Xml_node const &orig) {
|
||||
if (route.differs_from(orig)) {
|
||||
_construct_route_model_from_start_node(start_node);
|
||||
_uncertain_dependencies = true; } }); });
|
||||
|
@ -126,13 +126,11 @@ class Sandbox::Child : Child_policy, Routed_service::Wakeup
|
||||
{
|
||||
_route_model.destruct();
|
||||
|
||||
start.with_sub_node("route", [&] (Xml_node const &route) {
|
||||
_route_model.construct(_alloc, route); });
|
||||
|
||||
if (_route_model.constructed())
|
||||
return;
|
||||
|
||||
_route_model.construct(_alloc, _default_route_accessor.default_route());
|
||||
start.with_sub_node("route",
|
||||
[&] (Xml_node const &route) {
|
||||
_route_model.construct(_alloc, route); },
|
||||
[&] () {
|
||||
_route_model.construct(_alloc, _default_route_accessor.default_route()); });
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -213,7 +213,7 @@ namespace Sandbox {
|
||||
|
||||
Location result = Location(0, 0, space.width(), space.height());
|
||||
|
||||
start_node.with_sub_node("affinity", [&] (Xml_node node) {
|
||||
start_node.with_optional_sub_node("affinity", [&] (Xml_node node) {
|
||||
|
||||
Location const location = Location::from_xml(space, node);
|
||||
|
||||
|
@ -107,16 +107,18 @@ class Nic_perf::Interface
|
||||
|
||||
_dhcp_client.destruct();
|
||||
|
||||
config.with_sub_node("interface", [&] (Xml_node node) {
|
||||
_ip = node.attribute_value("ip", _ip);
|
||||
_dhcp_client_ip = node.attribute_value("dhcp_client_ip", _dhcp_client_ip);
|
||||
config.with_sub_node("interface",
|
||||
[&] (Xml_node node) {
|
||||
_ip = node.attribute_value("ip", _ip);
|
||||
_dhcp_client_ip = node.attribute_value("dhcp_client_ip", _dhcp_client_ip);
|
||||
|
||||
if (_mac_from_policy)
|
||||
_mac = node.attribute_value("mac", _mac);
|
||||
});
|
||||
if (_mac_from_policy)
|
||||
_mac = node.attribute_value("mac", _mac);
|
||||
},
|
||||
|
||||
if (_ip == Ipv4_address())
|
||||
_dhcp_client.construct(_timer, *this);
|
||||
/* node does not exist */
|
||||
[&] () { _dhcp_client.construct(_timer, *this); }
|
||||
);
|
||||
}
|
||||
|
||||
Session_label const &label() const { return _label; }
|
||||
|
@ -74,7 +74,7 @@ class Nic_perf::Packet_generator
|
||||
_enable = false;
|
||||
_state = MUTED;
|
||||
|
||||
config.with_sub_node("tx", [&] (Xml_node node) {
|
||||
config.with_optional_sub_node("tx", [&] (Xml_node node) {
|
||||
_mtu = node.attribute_value("mtu", _mtu);
|
||||
_dst_ip = node.attribute_value("to", _dst_ip);
|
||||
_dst_port = node.attribute_value("udp_port", _dst_port);
|
||||
|
@ -43,7 +43,7 @@ Dhcp_server_base::Dhcp_server_base(Xml_node const &node,
|
||||
_invalid(domain, "invalid DNS server entry");
|
||||
}
|
||||
});
|
||||
node.with_sub_node("dns-domain", [&] (Xml_node const &sub_node) {
|
||||
node.with_optional_sub_node("dns-domain", [&] (Xml_node const &sub_node) {
|
||||
xml_node_with_attribute(sub_node, "name", [&] (Xml_attribute const &attr) {
|
||||
_dns_domain_name.set_to(attr);
|
||||
|
||||
|
@ -131,7 +131,7 @@ void Local::Main::_handle_router_state()
|
||||
|
||||
/* read out new DNS domain name */
|
||||
Dns_domain_name dns_domain_name { _heap };
|
||||
domain_node.with_sub_node("dns-domain", [&] (Xml_node const &sub_node) {
|
||||
domain_node.with_optional_sub_node("dns-domain", [&] (Xml_node const &sub_node) {
|
||||
xml_node_with_attribute(sub_node, "name", [&] (Xml_attribute const &attr) {
|
||||
dns_domain_name.set_to(attr);
|
||||
});
|
||||
|
@ -87,8 +87,8 @@ struct Test::Monitor
|
||||
{
|
||||
size_t result = 0;
|
||||
|
||||
_init_state.xml().with_sub_node("child", [&] (Xml_node const &child) {
|
||||
child.with_sub_node("ram", [&] (Xml_node const &ram) {
|
||||
_init_state.xml().with_optional_sub_node("child", [&] (Xml_node const &child) {
|
||||
child.with_optional_sub_node("ram", [&] (Xml_node const &ram) {
|
||||
result = ram.attribute_value(attr, Number_of_bytes(0)); }); });
|
||||
|
||||
return result;
|
||||
|
@ -722,7 +722,7 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
platform_rom().with_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
platform_rom().with_optional_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
cpu_freq = tsc.attribute_value("freq_khz", cpu_freq); });
|
||||
cpu_freq *= 1000ULL;
|
||||
} catch (...) { }
|
||||
|
@ -690,7 +690,7 @@ uint64_t genode_cpu_hz()
|
||||
|
||||
if (!cpu_freq) {
|
||||
try {
|
||||
platform_rom().with_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
platform_rom().with_optional_sub_node("tsc", [&] (Genode::Xml_node const &tsc) {
|
||||
cpu_freq = tsc.attribute_value("freq_khz", cpu_freq); });
|
||||
cpu_freq *= 1000ULL;
|
||||
} catch (...) { }
|
||||
|
@ -24,8 +24,8 @@ Sup::Cpu_freq_khz Sup::Drv::_cpu_freq_khz_from_rom()
|
||||
{
|
||||
unsigned khz = 0;
|
||||
|
||||
_platform_info_rom.xml().with_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_sub_node("tsc", [&] (Xml_node const &node) {
|
||||
_platform_info_rom.xml().with_optional_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("tsc", [&] (Xml_node const &node) {
|
||||
khz = node.attribute_value("freq_khz", khz); });
|
||||
});
|
||||
|
||||
@ -42,8 +42,8 @@ Sup::Drv::Cpu_virt Sup::Drv::_cpu_virt_from_rom()
|
||||
{
|
||||
Cpu_virt virt = Cpu_virt::NONE;
|
||||
|
||||
_platform_info_rom.xml().with_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_sub_node("features", [&] (Xml_node const &node) {
|
||||
_platform_info_rom.xml().with_optional_sub_node("hardware", [&] (Xml_node const &node) {
|
||||
node.with_optional_sub_node("features", [&] (Xml_node const &node) {
|
||||
if (node.attribute_value("vmx", false))
|
||||
virt = Cpu_virt::VMX;
|
||||
else if (node.attribute_value("svm", false))
|
||||
|
Loading…
x
Reference in New Issue
Block a user