fix: fix Clash subscription parser (#439)

This commit is contained in:
parhelia512 2025-06-06 15:28:56 +08:00 committed by GitHub
parent e6bf936c8e
commit abe2dc5680
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -14605,12 +14605,18 @@ inline namespace yaml_literals {
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
#if defined(__GNUC__) && (__GNUC__ > 6)
#define FK_YAML_QUOTE_OPERATOR operator""_yaml
#else
#define FK_YAML_QUOTE_OPERATOR operator"" _yaml
#endif
/// @brief The user-defined string literal which deserializes a `char` array into a `node` object.
/// @param s An input `char` array.
/// @param n The size of `s`.
/// @return The resulting `node` object deserialized from `s`.
/// @sa https://fktn-k.github.io/fkYAML/api/operator_literal_yaml/
inline fkyaml::node operator"" _yaml(const char* s, std::size_t n) {
inline fkyaml::node FK_YAML_QUOTE_OPERATOR(const char* s, std::size_t n) {
return fkyaml::node::deserialize(s, s + n);
}
@ -14619,7 +14625,7 @@ inline fkyaml::node operator"" _yaml(const char* s, std::size_t n) {
/// @param n The size of `s`.
/// @return The resulting `node` object deserialized from `s`.
/// @sa https://fktn-k.github.io/fkYAML/api/operator_literal_yaml/
inline fkyaml::node operator"" _yaml(const char16_t* s, std::size_t n) {
inline fkyaml::node FK_YAML_QUOTE_OPERATOR(const char16_t* s, std::size_t n) {
return fkyaml::node::deserialize(s, s + n);
}
@ -14628,7 +14634,7 @@ inline fkyaml::node operator"" _yaml(const char16_t* s, std::size_t n) {
/// @param n The size of `s`.
/// @return The resulting `node` object deserialized from `s`.
/// @sa https://fktn-k.github.io/fkYAML/api/operator_literal_yaml/
inline fkyaml::node operator"" _yaml(const char32_t* s, std::size_t n) {
inline fkyaml::node FK_YAML_QUOTE_OPERATOR(const char32_t* s, std::size_t n) {
return fkyaml::node::deserialize(s, s + n);
}
@ -14637,7 +14643,7 @@ inline fkyaml::node operator"" _yaml(const char32_t* s, std::size_t n) {
/// @param s An input `char8_t` array.
/// @param n The size of `s`.
/// @return The resulting `node` object deserialized from `s`.
inline fkyaml::node operator"" _yaml(const char8_t* s, std::size_t n) {
inline fkyaml::node FK_YAML_QUOTE_OPERATOR(const char8_t* s, std::size_t n) {
return fkyaml::node::deserialize((const char8_t*)s, (const char8_t*)s + n);
}

View File

@ -361,7 +361,11 @@ namespace NekoGui_sub {
int Node2Int(const fkyaml::node &n, const int &def = 0) {
try {
return n.as_int();
if (n.is_integer())
return n.as_int();
else if (n.is_string())
return atoi(n.as_str().c_str());
return def;
} catch (const fkyaml::exception &ex) {
qDebug() << ex.what();
return def;