.. _program_listing_file_include_miral_miral_live_config.h: Program Listing for File live_config.h ====================================== |exhale_lsh| :ref:`Return to documentation for file ` (``include/miral/miral/live_config.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright © Canonical Ltd. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 or 3 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef MIRAL_LIVE_CONFIG_H #define MIRAL_LIVE_CONFIG_H #include #include #include #include #include #include #include namespace miral::live_config { class Key { public: Key(std::initializer_list key); void with_key(std::function const& key)> const& f) const; auto to_string() const -> std::string; auto operator<=>(Key const& that) const -> std::strong_ordering; auto operator==(Key const& that) const -> bool; private: struct State; std::shared_ptr self; }; class Store { public: using HandleInt = std::function value)>; using HandleInts = std::function> value)>; using HandleBool = std::function value)>; using HandleFloat = std::function value)>; using HandleFloats = std::function> value)>; using HandleString = std::function value)>; using HandleStrings = std::function> value)>; using HandleDone = std::function; virtual void add_int_attribute(Key const& key, std::string_view description, HandleInt handler) = 0; virtual void add_ints_attribute(Key const& key, std::string_view description, HandleInts handler) = 0; virtual void add_bool_attribute(Key const& key, std::string_view description, HandleBool handler) = 0; virtual void add_float_attribute(Key const& key, std::string_view description, HandleFloat handler) = 0; virtual void add_floats_attribute(Key const& key, std::string_view description, HandleFloats handler) = 0; virtual void add_string_attribute(Key const& key, std::string_view description, HandleString handler) = 0; virtual void add_strings_attribute(Key const& key, std::string_view description, HandleStrings handler) = 0; virtual void add_int_attribute(Key const& key, std::string_view description, int preset, HandleInt handler) = 0; virtual void add_ints_attribute(Key const& key, std::string_view description, std::span preset, HandleInts handler) = 0; virtual void add_bool_attribute(Key const& key, std::string_view description, bool preset, HandleBool handler) = 0; virtual void add_float_attribute(Key const& key, std::string_view description, float preset, HandleFloat handler) = 0; virtual void add_floats_attribute(Key const& key, std::string_view description, std::span preset, HandleFloats handler) = 0; virtual void add_string_attribute(Key const& key, std::string_view description, std::string_view preset, HandleString handler) = 0; virtual void add_strings_attribute(Key const& key, std::string_view description, std::span preset, HandleStrings handler) = 0; virtual void on_done(HandleDone handler) = 0; Store() = default; virtual ~Store() = default; Store(Store const&) = delete; Store& operator=(Store const&) = delete; }; } #endif //MIRAL_LIVE_CONFIG_H