diff --git a/repos/os/src/lib/sandbox/config_model.cc b/repos/os/src/lib/sandbox/config_model.cc index 0c48d2e977..0dbb118276 100644 --- a/repos/os/src/lib/sandbox/config_model.cc +++ b/repos/os/src/lib/sandbox/config_model.cc @@ -21,6 +21,8 @@ struct Config_model::Node : Noncopyable, Interface, private List_model::El friend class List_model; friend class List; + static bool type_matches(Xml_node const &) { return true; } + virtual bool matches(Xml_node const &) const = 0; virtual void update(Xml_node const &) = 0; diff --git a/repos/os/src/lib/sandbox/config_model.h b/repos/os/src/lib/sandbox/config_model.h index ea19a5c165..30d14a7430 100644 --- a/repos/os/src/lib/sandbox/config_model.h +++ b/repos/os/src/lib/sandbox/config_model.h @@ -14,8 +14,10 @@ #ifndef _CONFIG_MODEL_H_ #define _CONFIG_MODEL_H_ +/* Genode includes */ +#include + /* local includes */ -#include #include namespace Sandbox { @@ -56,6 +58,8 @@ struct Sandbox::Parent_provides_model : Noncopyable service.abandon(); } + static bool type_matches(Xml_node const &) { return true; } + bool matches(Xml_node const &xml) const { return xml.attribute_value("name", Service::Name()) == service.name(); diff --git a/repos/os/src/lib/sandbox/report.h b/repos/os/src/lib/sandbox/report.h index 971cd73b5a..7531f2a7ee 100644 --- a/repos/os/src/lib/sandbox/report.h +++ b/repos/os/src/lib/sandbox/report.h @@ -14,9 +14,13 @@ #ifndef _LIB__SANDBOX__REPORT_H_ #define _LIB__SANDBOX__REPORT_H_ +/* Genode includes */ #include #include +/* local includes */ +#include + namespace Sandbox { struct Report_update_trigger; struct Report_detail; diff --git a/repos/os/src/lib/sandbox/update_list_model.h b/repos/os/src/lib/sandbox/update_list_model.h deleted file mode 100644 index 2703986826..0000000000 --- a/repos/os/src/lib/sandbox/update_list_model.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * \brief Convenience wrapper around 'List_model' - * \author Norman Feske - * \date 2021-04-01 - */ - -/* - * Copyright (C) 2021 Genode Labs GmbH - * - * This file is part of the Genode OS framework, which is distributed - * under the terms of the GNU Affero General Public License version 3. - */ - -#ifndef _UPDATE_LIST_MODEL_H_ -#define _UPDATE_LIST_MODEL_H_ - -/* Genode includes */ -#include - -/* local includes */ -#include - -namespace Sandbox { - - template - static inline void update_list_model_from_xml(List_model &, - Xml_node const &, - CREATE_FN const &, - DESTROY_FN const &, - UPDATE_FN const &); -} - - -template -void Sandbox::update_list_model_from_xml(List_model &model, - Xml_node const &xml, - CREATE_FN const &create, - DESTROY_FN const &destroy, - UPDATE_FN const &update) -{ - struct Model_update_policy : List_model::Update_policy - { - CREATE_FN const &_create_fn; - DESTROY_FN const &_destroy_fn; - UPDATE_FN const &_update_fn; - - Model_update_policy(CREATE_FN const &create_fn, - DESTROY_FN const &destroy_fn, - UPDATE_FN const &update_fn) - : - _create_fn(create_fn), _destroy_fn(destroy_fn), _update_fn(update_fn) - { } - - void destroy_element(NODE &node) { _destroy_fn(node); } - - NODE &create_element(Xml_node xml) { return _create_fn(xml); } - - void update_element(NODE &node, Xml_node xml) { _update_fn(node, xml); } - - static bool element_matches_xml_node(NODE const &node, Xml_node xml) - { - return node.matches(xml); - } - } policy(create, destroy, update); - - model.update_from_xml(policy, xml); -} - -#endif /* _UPDATE_LIST_MODEL_H_ */