diff --git a/src/lib/libkrbn/src/libkrbn_configuration.cpp b/src/lib/libkrbn/src/libkrbn_configuration.cpp index fe5d8ac95..aff85a81d 100644 --- a/src/lib/libkrbn/src/libkrbn_configuration.cpp +++ b/src/lib/libkrbn/src/libkrbn_configuration.cpp @@ -17,23 +17,25 @@ gsl::not_null> get return empty_core_configuration; } -krbn::core_configuration::details::simple_modifications* find_simple_modifications(const libkrbn_device_identifiers* device_identifiers) { +gsl::not_null> find_simple_modifications(const libkrbn_device_identifiers* device_identifiers) { auto di = libkrbn_cpp::make_device_identifiers(device_identifiers); auto c = get_current_core_configuration(); if (di.empty()) { - return &(c->get_selected_profile().get_simple_modifications()); + return c->get_selected_profile().get_simple_modifications(); } else { - return c->get_selected_profile().find_simple_modifications(di); + auto d = c->get_selected_profile().get_device(di); + return d->get_simple_modifications(); } } -krbn::core_configuration::details::simple_modifications* find_fn_function_keys(const libkrbn_device_identifiers* device_identifiers) { +gsl::not_null> find_fn_function_keys(const libkrbn_device_identifiers* device_identifiers) { auto di = libkrbn_cpp::make_device_identifiers(device_identifiers); auto c = get_current_core_configuration(); if (di.empty()) { - return &(c->get_selected_profile().get_fn_function_keys()); + return c->get_selected_profile().get_fn_function_keys(); } else { - return c->get_selected_profile().find_fn_function_keys(di); + auto d = c->get_selected_profile().get_device(di); + return d->get_fn_function_keys(); } } } // namespace @@ -222,10 +224,8 @@ void libkrbn_core_configuration_set_selected_profile_parameters_delay_millisecon } size_t libkrbn_core_configuration_get_selected_profile_simple_modifications_size(const libkrbn_device_identifiers* device_identifiers) { - if (auto m = find_simple_modifications(device_identifiers)) { - return m->get_pairs().size(); - } - return 0; + auto m = find_simple_modifications(device_identifiers); + return m->get_pairs().size(); } bool libkrbn_core_configuration_get_selected_profile_simple_modification_from_json_string(size_t index, @@ -236,12 +236,11 @@ bool libkrbn_core_configuration_get_selected_profile_simple_modification_from_js buffer[0] = '\0'; } - if (auto m = find_simple_modifications(device_identifiers)) { - const auto& pairs = m->get_pairs(); - if (index < pairs.size()) { - strlcpy(buffer, pairs[index].first.c_str(), length); - return true; - } + auto m = find_simple_modifications(device_identifiers); + const auto& pairs = m->get_pairs(); + if (index < pairs.size()) { + strlcpy(buffer, pairs[index].first.c_str(), length); + return true; } return false; @@ -255,13 +254,13 @@ bool libkrbn_core_configuration_get_selected_profile_simple_modification_to_json buffer[0] = '\0'; } - if (auto m = find_simple_modifications(device_identifiers)) { - const auto& pairs = m->get_pairs(); - if (index < pairs.size()) { - strlcpy(buffer, pairs[index].second.c_str(), length); - return true; - } + auto m = find_simple_modifications(device_identifiers); + const auto& pairs = m->get_pairs(); + if (index < pairs.size()) { + strlcpy(buffer, pairs[index].second.c_str(), length); + return true; } + return false; } @@ -269,32 +268,27 @@ void libkrbn_core_configuration_replace_selected_profile_simple_modification(siz const char* from_json_string, const char* to_json_string, const libkrbn_device_identifiers* device_identifiers) { - if (auto m = find_simple_modifications(device_identifiers)) { - if (from_json_string && - to_json_string) { - m->replace_pair(index, from_json_string, to_json_string); - } + auto m = find_simple_modifications(device_identifiers); + if (from_json_string && + to_json_string) { + m->replace_pair(index, from_json_string, to_json_string); } } void libkrbn_core_configuration_push_back_selected_profile_simple_modification(const libkrbn_device_identifiers* device_identifiers) { - if (auto m = find_simple_modifications(device_identifiers)) { - m->push_back_pair(); - } + auto m = find_simple_modifications(device_identifiers); + m->push_back_pair(); } void libkrbn_core_configuration_erase_selected_profile_simple_modification(size_t index, const libkrbn_device_identifiers* device_identifiers) { - if (auto m = find_simple_modifications(device_identifiers)) { - m->erase_pair(index); - } + auto m = find_simple_modifications(device_identifiers); + m->erase_pair(index); } size_t libkrbn_core_configuration_get_selected_profile_fn_function_keys_size(const libkrbn_device_identifiers* device_identifiers) { - if (auto k = find_fn_function_keys(device_identifiers)) { - return k->get_pairs().size(); - } - return 0; + auto k = find_fn_function_keys(device_identifiers); + return k->get_pairs().size(); } bool libkrbn_core_configuration_get_selected_profile_fn_function_key_from_json_string(size_t index, @@ -305,12 +299,11 @@ bool libkrbn_core_configuration_get_selected_profile_fn_function_key_from_json_s buffer[0] = '\0'; } - if (auto k = find_fn_function_keys(device_identifiers)) { - const auto& pairs = k->get_pairs(); - if (index < pairs.size()) { - strlcpy(buffer, pairs[index].first.c_str(), length); - return true; - } + auto k = find_fn_function_keys(device_identifiers); + const auto& pairs = k->get_pairs(); + if (index < pairs.size()) { + strlcpy(buffer, pairs[index].first.c_str(), length); + return true; } return false; @@ -324,12 +317,11 @@ bool libkrbn_core_configuration_get_selected_profile_fn_function_key_to_json_str buffer[0] = '\0'; } - if (auto k = find_fn_function_keys(device_identifiers)) { - const auto& pairs = k->get_pairs(); - if (index < pairs.size()) { - strlcpy(buffer, pairs[index].second.c_str(), length); - return true; - } + auto k = find_fn_function_keys(device_identifiers); + const auto& pairs = k->get_pairs(); + if (index < pairs.size()) { + strlcpy(buffer, pairs[index].second.c_str(), length); + return true; } return false; @@ -338,11 +330,10 @@ bool libkrbn_core_configuration_get_selected_profile_fn_function_key_to_json_str void libkrbn_core_configuration_replace_selected_profile_fn_function_key(const char* from_json_string, const char* to_json_string, const libkrbn_device_identifiers* device_identifiers) { - if (auto k = find_fn_function_keys(device_identifiers)) { - if (from_json_string && - to_json_string) { - k->replace_second(from_json_string, to_json_string); - } + auto k = find_fn_function_keys(device_identifiers); + if (from_json_string && + to_json_string) { + k->replace_second(from_json_string, to_json_string); } } diff --git a/src/share/core_configuration/details/profile.hpp b/src/share/core_configuration/details/profile.hpp index b0024df86..999c6b42f 100644 --- a/src/share/core_configuration/details/profile.hpp +++ b/src/share/core_configuration/details/profile.hpp @@ -19,7 +19,9 @@ class profile final { error_handling error_handling) : json_(json), error_handling_(error_handling), - selected_(false) { + selected_(false), + simple_modifications_(std::make_shared()), + fn_function_keys_(std::make_shared()) { helper_values_.push_back_array("devices", devices_); @@ -27,7 +29,7 @@ class profile final { // Set default value // - fn_function_keys_.update(make_default_fn_function_keys_json()); + fn_function_keys_->update(make_default_fn_function_keys_json()); // // Load from json @@ -57,14 +59,14 @@ class profile final { } else if (key == "simple_modifications") { try { - simple_modifications_.update(value); + simple_modifications_->update(value); } catch (const pqrs::json::unmarshal_error& e) { throw pqrs::json::unmarshal_error(fmt::format("`{0}` error: {1}", key, e.what())); } } else if (key == "fn_function_keys") { try { - fn_function_keys_.update(value); + fn_function_keys_->update(value); } catch (const pqrs::json::unmarshal_error& e) { throw pqrs::json::unmarshal_error(fmt::format("`{0}` error: {1}", key, e.what())); } @@ -148,8 +150,8 @@ class profile final { j["name"] = name_; j["selected"] = selected_; j["parameters"] = parameters_; - j["simple_modifications"] = simple_modifications_.to_json(nlohmann::json::array()); - j["fn_function_keys"] = fn_function_keys_.to_json(make_default_fn_function_keys_json()); + j["simple_modifications"] = simple_modifications_->to_json(nlohmann::json::array()); + j["fn_function_keys"] = fn_function_keys_->to_json(make_default_fn_function_keys_json()); j["complex_modifications"] = complex_modifications_.to_json(); j["virtual_hid_keyboard"] = virtual_hid_keyboard_; @@ -180,52 +182,14 @@ class profile final { return const_cast(static_cast(*this).get_parameters()); } - const details::simple_modifications& get_simple_modifications(void) const { + gsl::not_null> get_simple_modifications(void) const { return simple_modifications_; } - details::simple_modifications& get_simple_modifications(void) { - return const_cast(static_cast(*this).get_simple_modifications()); - } - - const details::simple_modifications* find_simple_modifications(const device_identifiers& identifiers) const { - for (const auto& d : devices_) { - if (d->get_identifiers() == identifiers) { - return &(d->get_simple_modifications()); - } - } - return nullptr; - } - - details::simple_modifications* find_simple_modifications(const device_identifiers& identifiers) { - add_device(identifiers); - - return const_cast(static_cast(*this).find_simple_modifications(identifiers)); - } - - const details::simple_modifications& get_fn_function_keys(void) const { + gsl::not_null> get_fn_function_keys(void) const { return fn_function_keys_; } - details::simple_modifications& get_fn_function_keys(void) { - return const_cast(static_cast(*this).get_fn_function_keys()); - } - - const details::simple_modifications* find_fn_function_keys(const device_identifiers& identifiers) const { - for (const auto& d : devices_) { - if (d->get_identifiers() == identifiers) { - return &(d->get_fn_function_keys()); - } - } - return nullptr; - } - - details::simple_modifications* find_fn_function_keys(const device_identifiers& identifiers) { - add_device(identifiers); - - return const_cast(static_cast(*this).find_fn_function_keys(identifiers)); - } - const details::complex_modifications& get_complex_modifications(void) const { return complex_modifications_; } @@ -288,37 +252,13 @@ class profile final { } private: - std::shared_ptr find_device(const device_identifiers& identifiers) const { - auto it = std::find_if(std::begin(devices_), - std::end(devices_), - [&](auto&& d) { - return d->get_identifiers() == identifiers; - }); - if (it != std::end(devices_)) { - return *it; - } - return nullptr; - } - - gsl::not_null> add_device(const device_identifiers& identifiers) const { - if (auto d = find_device(identifiers)) { - return d; - } - - devices_.push_back(std::make_shared(nlohmann::json({ - {"identifiers", identifiers}, - }), - error_handling_)); - return devices_.back(); - } - nlohmann::json json_; error_handling error_handling_; std::string name_; bool selected_; details::parameters parameters_; - details::simple_modifications simple_modifications_; - details::simple_modifications fn_function_keys_; + gsl::not_null> simple_modifications_; + gsl::not_null> fn_function_keys_; details::complex_modifications complex_modifications_; details::virtual_hid_keyboard virtual_hid_keyboard_; mutable std::vector>> devices_; diff --git a/src/share/core_configuration/details/profile/device.hpp b/src/share/core_configuration/details/profile/device.hpp index 286598de1..2347de533 100644 --- a/src/share/core_configuration/details/profile/device.hpp +++ b/src/share/core_configuration/details/profile/device.hpp @@ -21,7 +21,9 @@ class device final { device(const nlohmann::json& json, error_handling error_handling) - : json_(json) { + : json_(json), + simple_modifications_(std::make_shared()), + fn_function_keys_(std::make_shared()) { helper_values_.push_back_value("ignore", ignore_, false); @@ -162,15 +164,15 @@ if (abs(cos(radian)) <= abs(sin(radian))) { )"); - // ---------------------------------------- + // // Set default value + // - // fn_function_keys_ - - fn_function_keys_.update(make_default_fn_function_keys_json()); + fn_function_keys_->update(make_default_fn_function_keys_json()); - // ---------------------------------------- + // // Load from json + // pqrs::json::requires_object(json, "json"); @@ -185,14 +187,14 @@ if (abs(cos(radian)) <= abs(sin(radian))) { } } else if (key == "simple_modifications") { try { - simple_modifications_.update(value); + simple_modifications_->update(value); } catch (const pqrs::json::unmarshal_error& e) { throw pqrs::json::unmarshal_error(fmt::format("`{0}` error: {1}", key, e.what())); } } else if (key == "fn_function_keys") { try { - fn_function_keys_.update(value); + fn_function_keys_->update(value); } catch (const pqrs::json::unmarshal_error& e) { throw pqrs::json::unmarshal_error(fmt::format("`{0}` error: {1}", key, e.what())); } @@ -248,7 +250,7 @@ if (abs(cos(radian)) <= abs(sin(radian))) { j["identifiers"] = identifiers_; { - auto jj = simple_modifications_.to_json(nlohmann::json::array()); + auto jj = simple_modifications_->to_json(nlohmann::json::array()); if (!jj.empty()) { j["simple_modifications"] = jj; } else { @@ -257,7 +259,7 @@ if (abs(cos(radian)) <= abs(sin(radian))) { } { - auto jj = fn_function_keys_.to_json(make_default_fn_function_keys_json()); + auto jj = fn_function_keys_->to_json(make_default_fn_function_keys_json()); if (!jj.empty()) { j["fn_function_keys"] = jj; } else { @@ -505,17 +507,11 @@ if (abs(cos(radian)) <= abs(sin(radian))) { coordinate_between_properties(); } - const simple_modifications& get_simple_modifications(void) const { - return simple_modifications_; - } - simple_modifications& get_simple_modifications(void) { + gsl::not_null> get_simple_modifications(void) const { return simple_modifications_; } - const simple_modifications& get_fn_function_keys(void) const { - return fn_function_keys_; - } - simple_modifications& get_fn_function_keys(void) { + gsl::not_null> get_fn_function_keys(void) const { return fn_function_keys_; } @@ -571,8 +567,8 @@ if (abs(cos(radian)) <= abs(sin(radian))) { std::string game_pad_stick_y_formula_; std::string game_pad_stick_vertical_wheel_formula_; std::string game_pad_stick_horizontal_wheel_formula_; - simple_modifications simple_modifications_; - simple_modifications fn_function_keys_; + gsl::not_null> simple_modifications_; + gsl::not_null> fn_function_keys_; configuration_json_helper::helper_values helper_values_; }; diff --git a/tests/src/core_configuration/src/core_configuration_test.hpp b/tests/src/core_configuration/src/core_configuration_test.hpp index ebc70be7b..69808f331 100644 --- a/tests/src/core_configuration/src/core_configuration_test.hpp +++ b/tests/src/core_configuration/src/core_configuration_test.hpp @@ -35,7 +35,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "escape"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"key_code", "spacebar"}})}).dump()); - expect(expected == configuration.get_selected_profile().get_simple_modifications().get_pairs()) << UT_SHOW_LINE; + expect(expected == configuration.get_selected_profile().get_simple_modifications()->get_pairs()) << UT_SHOW_LINE; } { auto manipulator = configuration.get_selected_profile().get_complex_modifications().get_rules()[0].get_manipulators()[0].get_json(); @@ -81,7 +81,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "f12"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"consumer_key_code", "volume_increment"}})}).dump()); - expect(expected == configuration.get_selected_profile().get_fn_function_keys().get_pairs()) << UT_SHOW_LINE; + expect(expected == configuration.get_selected_profile().get_fn_function_keys()->get_pairs()) << UT_SHOW_LINE; } { auto& complex_modifications = configuration.get_selected_profile().get_complex_modifications(); @@ -149,7 +149,7 @@ void run_core_configuration_test(void) { geteuid(), krbn::core_configuration::error_handling::strict); - expect(configuration.get_selected_profile().get_simple_modifications().get_pairs().empty()); + expect(configuration.get_selected_profile().get_simple_modifications()->get_pairs().empty()); expect(configuration.is_loaded() == false); expect(configuration.get_global_configuration().get_check_for_updates_on_startup() == true); @@ -160,7 +160,7 @@ void run_core_configuration_test(void) { expect(configuration.get_profiles().size() == 1); expect((configuration.get_profiles())[0]->get_name() == "Default profile"); expect((configuration.get_profiles())[0]->get_selected() == true); - expect((configuration.get_profiles())[0]->get_fn_function_keys().get_pairs().size() == 12); + expect((configuration.get_profiles())[0]->get_fn_function_keys()->get_pairs().size() == 12); { // to_json result is default json if is_loaded == false @@ -174,7 +174,7 @@ void run_core_configuration_test(void) { geteuid(), krbn::core_configuration::error_handling::strict); - expect(configuration.get_selected_profile().get_simple_modifications().get_pairs().empty()); + expect(configuration.get_selected_profile().get_simple_modifications()->get_pairs().empty()); expect(configuration.is_loaded() == false); } }; @@ -192,7 +192,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "escape"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"key_code", "spacebar"}})}).dump()); - expect(configuration.get_selected_profile().get_simple_modifications().get_pairs() == expected); + expect(configuration.get_selected_profile().get_simple_modifications()->get_pairs() == expected); expect(configuration.is_loaded() == true); }; @@ -289,8 +289,8 @@ void run_core_configuration_test(void) { krbn::core_configuration::error_handling::strict); expect(profile.get_name() == std::string("")); expect(profile.get_selected() == false); - expect(profile.get_simple_modifications().get_pairs().empty()); - expect(profile.get_fn_function_keys().get_pairs().size() == 12); + expect(profile.get_simple_modifications()->get_pairs().empty()); + expect(profile.get_fn_function_keys()->get_pairs().size() == 12); expect(profile.get_devices().size() == 0); expect(profile.get_device(krbn::device_identifiers(pqrs::hid::vendor_id::value_t(4176), @@ -443,7 +443,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "from 10"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"key_code", "to 10"}})}).dump()); - expect(profile.get_simple_modifications().get_pairs() == expected) << UT_SHOW_LINE; + expect(profile.get_simple_modifications()->get_pairs() == expected) << UT_SHOW_LINE; } { std::vector> expected; @@ -486,7 +486,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "f13"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"key_code", "to f13"}})}).dump()); - expect(expected == profile.get_fn_function_keys().get_pairs()) << UT_SHOW_LINE; + expect(expected == profile.get_fn_function_keys()->get_pairs()) << UT_SHOW_LINE; } { expect(profile.get_devices().size() == 3); @@ -662,7 +662,7 @@ void run_core_configuration_test(void) { expected.emplace_back(nlohmann::json::object({{"key_code", "key"}}).dump(), nlohmann::json::array({nlohmann::json::object({{"key_code", "value"}})}).dump()); - expect(expected == profile.get_simple_modifications().get_pairs()) << UT_SHOW_LINE; + expect(expected == profile.get_simple_modifications()->get_pairs()) << UT_SHOW_LINE; } } }; @@ -732,34 +732,34 @@ void run_core_configuration_test(void) { profile.get_parameters().set_delay_milliseconds_before_open_device(std::chrono::milliseconds(500)); - profile.get_simple_modifications().push_back_pair(); + profile.get_simple_modifications()->push_back_pair(); // { // "": "" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(1, - nlohmann::json{{"key_code", "from 1"}}.dump(), - nlohmann::json{{"key_code", "to 1"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(1, + nlohmann::json{{"key_code", "from 1"}}.dump(), + nlohmann::json{{"key_code", "to 1"}}.dump()); // { // "": "", // "from 1": "to 1" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(2, - nlohmann::json{{"key_code", "from 3"}}.dump(), - nlohmann::json{{"key_code", "to 3"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(2, + nlohmann::json{{"key_code", "from 3"}}.dump(), + nlohmann::json{{"key_code", "to 3"}}.dump()); // { // "": "", // "from 1": "to 1", // "from 3": "to 3" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(3, - nlohmann::json{{"key_code", "from 4"}}.dump(), - nlohmann::json{{"key_code", "to 4"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(3, + nlohmann::json{{"key_code", "from 4"}}.dump(), + nlohmann::json{{"key_code", "to 4"}}.dump()); // { // "": "", // "from 1": "to 1", @@ -767,10 +767,10 @@ void run_core_configuration_test(void) { // "from 4": "to 4" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(4, - nlohmann::json{{"key_code", "from 2"}}.dump(), - nlohmann::json{{"key_code", "to 2"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(4, + nlohmann::json{{"key_code", "from 2"}}.dump(), + nlohmann::json{{"key_code", "to 2"}}.dump()); // { // "": "", // "from 1": "to 1", @@ -779,10 +779,10 @@ void run_core_configuration_test(void) { // "from 2": "to 2" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(5, - nlohmann::json{{"key_code", "from 2"}}.dump(), - nlohmann::json{{"key_code", "to 2.0"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(5, + nlohmann::json{{"key_code", "from 2"}}.dump(), + nlohmann::json{{"key_code", "to 2.0"}}.dump()); // { // "": "", // "from 1": "to 1", @@ -792,7 +792,7 @@ void run_core_configuration_test(void) { // "from 2": "to 2.0" // } - profile.get_simple_modifications().erase_pair(2); + profile.get_simple_modifications()->erase_pair(2); // { // "": "", // "from 1": "to 1", @@ -801,10 +801,10 @@ void run_core_configuration_test(void) { // "from 2": "to 2.0" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(5, - nlohmann::json::object().dump(), - nlohmann::json{{"key_code", "to 0"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(5, + nlohmann::json::object().dump(), + nlohmann::json{{"key_code", "to 0"}}.dump()); // { // "": "", // "from 1": "to 1", @@ -814,10 +814,10 @@ void run_core_configuration_test(void) { // "": "to 0" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(6, - nlohmann::json{{"key_code", "from 0"}}.dump(), - nlohmann::json::object().dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(6, + nlohmann::json{{"key_code", "from 0"}}.dump(), + nlohmann::json::object().dump()); // { // "": "", // "from 1": "to 1", @@ -828,10 +828,10 @@ void run_core_configuration_test(void) { // "from 0": "" // } - profile.get_simple_modifications().push_back_pair(); - profile.get_simple_modifications().replace_pair(7, - nlohmann::json{{"key_code", "from 5"}}.dump(), - nlohmann::json{{"key_code", "to 5"}}.dump()); + profile.get_simple_modifications()->push_back_pair(); + profile.get_simple_modifications()->replace_pair(7, + nlohmann::json{{"key_code", "from 5"}}.dump(), + nlohmann::json{{"key_code", "to 5"}}.dump()); // { // "": "", // "from 1": "to 1", @@ -843,10 +843,10 @@ void run_core_configuration_test(void) { // "from 5": "to 5" // } - profile.get_fn_function_keys().replace_second(nlohmann::json{{"key_code", "f3"}}.dump(), - nlohmann::json{{"key_code", "to f3"}}.dump()); - profile.get_fn_function_keys().replace_second(nlohmann::json{{"key_code", "not found"}}.dump(), - nlohmann::json{{"key_code", "do nothing"}}.dump()); + profile.get_fn_function_keys()->replace_second(nlohmann::json{{"key_code", "f3"}}.dump(), + nlohmann::json{{"key_code", "to f3"}}.dump()); + profile.get_fn_function_keys()->replace_second(nlohmann::json{{"key_code", "not found"}}.dump(), + nlohmann::json{{"key_code", "do nothing"}}.dump()); profile.get_virtual_hid_keyboard().set_country_code(pqrs::hid::country_code::value_t(20)); profile.get_virtual_hid_keyboard().set_mouse_key_xy_scale(250);