Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7aa659d

Browse files
committed
update vendor
1 parent 7968ce0 commit 7aa659d

File tree

2 files changed

+34
-23
lines changed

2 files changed

+34
-23
lines changed

src/vendor/cget/cget/pkg/pqrs-org__cpp-osx-input_source_selector/install/include/pqrs/osx/input_source_selector.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
// pqrs::osx::input_source_selector v3.1
3+
// pqrs::osx::input_source_selector v3.2
44

55
// (C) Copyright Takayama Fumihiko 2019.
66
// Distributed under the Boost Software License, Version 1.0.

src/vendor/cget/cget/pkg/pqrs-org__cpp-osx-input_source_selector/install/include/pqrs/osx/input_source_selector/extra/nlohmann_json.hpp

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,47 @@ inline void to_json(nlohmann::json& j, const specifier& s) {
2929
inline void from_json(const nlohmann::json& j, specifier& s) {
3030
using namespace std::string_literals;
3131

32-
try {
33-
if (!j.is_object()) {
34-
throw pqrs::json::unmarshal_error("json must be object, but is `"s + j.dump() + "`"s);
35-
}
32+
if (!j.is_object()) {
33+
throw pqrs::json::unmarshal_error("json must be object, but is `"s + j.dump() + "`"s);
34+
}
35+
36+
for (const auto& [key, value] : j.items()) {
37+
if (key == "language") {
38+
if (!value.is_string()) {
39+
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
40+
}
3641

37-
for (const auto& [key, value] : j.items()) {
38-
if (key == "language") {
39-
if (!value.is_string()) {
40-
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
41-
}
42+
try {
4243
s.set_language(value.get<std::string>());
44+
} catch (std::regex_error& e) {
45+
throw pqrs::json::unmarshal_error(e.what() + ": `\""s + key + "\":" + value.dump() + "`"s);
46+
}
47+
48+
} else if (key == "input_source_id") {
49+
if (!value.is_string()) {
50+
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
51+
}
4352

44-
} else if (key == "input_source_id") {
45-
if (!value.is_string()) {
46-
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
47-
}
53+
try {
4854
s.set_input_source_id(value.get<std::string>());
55+
} catch (std::regex_error& e) {
56+
throw pqrs::json::unmarshal_error(e.what() + ": `\""s + key + "\":" + value.dump() + "`"s);
57+
}
4958

50-
} else if (key == "input_mode_id") {
51-
if (!value.is_string()) {
52-
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
53-
}
54-
s.set_input_mode_id(value.get<std::string>());
59+
} else if (key == "input_mode_id") {
60+
if (!value.is_string()) {
61+
throw pqrs::json::unmarshal_error("`"s + key + "` must be string, but is `"s + value.dump() + "`"s);
62+
}
5563

56-
} else {
57-
throw pqrs::json::unmarshal_error("unknown key: `"s + key + "`"s);
64+
try {
65+
s.set_input_mode_id(value.get<std::string>());
66+
} catch (std::regex_error& e) {
67+
throw pqrs::json::unmarshal_error(e.what() + ": `\""s + key + "\":" + value.dump() + "`"s);
5868
}
69+
70+
} else {
71+
throw pqrs::json::unmarshal_error("unknown key: `"s + key + "`"s);
5972
}
60-
} catch (std::regex_error& e) {
61-
throw pqrs::json::unmarshal_error(e.what() + ": `"s + j.dump() + "`"s);
6273
}
6374
}
6475
} // namespace input_source_selector

0 commit comments

Comments
 (0)