diff --git a/cmake/deps.cmake b/cmake/deps.cmake index d9d1fe05..89300df1 100644 --- a/cmake/deps.cmake +++ b/cmake/deps.cmake @@ -15,7 +15,7 @@ CPMAddPackage( "EXPECTED_BUILD_TESTS OFF" "EXPECTED_BUILD_PACKAGE_DEB OFF") CPMAddPackage( - URI "gh:Klebert-Engineering/simfil@0.6.3#improvement/generic-resolve" + URI "gh:Klebert-Engineering/simfil#byte-array" OPTIONS "SIMFIL_WITH_MODEL_JSON ON" "SIMFIL_SHARED OFF") diff --git a/libs/model/include/mapget/model/featurelayer.h b/libs/model/include/mapget/model/featurelayer.h index fb7dc307..5833a994 100644 --- a/libs/model/include/mapget/model/featurelayer.h +++ b/libs/model/include/mapget/model/featurelayer.h @@ -241,7 +241,7 @@ class TileFeatureLayer : public TileLayer, public simfil::ModelPool * @param query Simfil query * @param node Model root node to query * @param anyMode Auto-wrap expression in `any(...)` - * @param autoWildcard Auto expand constant expressions to `** = ` + * @param autoWildcard Auto expand constant expressions to `** == ` */ struct QueryResult { // The list of values resulting from the query evaluation. diff --git a/libs/model/src/featureid.cpp b/libs/model/src/featureid.cpp index b8154038..6ae25696 100644 --- a/libs/model/src/featureid.cpp +++ b/libs/model/src/featureid.cpp @@ -3,6 +3,8 @@ #include +#include "mapget/log.h" + namespace mapget { @@ -30,8 +32,11 @@ std::string FeatureId::toString() const auto addIdPart = [&result](auto&& v) { - if constexpr (!std::is_same_v, std::monostate>) + if constexpr (std::is_same_v, simfil::ByteArray>) { + raiseFmt("FeatureId part value 'b\"{}\"' cannot be a ByteArray.", v.toHex()); + } else if constexpr (!std::is_same_v, std::monostate>) { result << "." << v; + } }; // Add common id-part fields @@ -94,7 +99,11 @@ KeyValueViewPairs FeatureId::keyValuePairs() const std::visit( [&result, &keyStr](auto&& v) { - if constexpr (!std::is_same_v, std::monostate> && !std::is_same_v, double>) { + using T = std::decay_t; + if constexpr (std::is_same_v) { + raiseFmt("FeatureId part '{}' cannot be a ByteArray.", keyStr ? *keyStr : ""); + } + else if constexpr (!std::is_same_v && !std::is_same_v) { result.emplace_back(*keyStr, v); } }, diff --git a/libs/pymapget/binding/py-layer.h b/libs/pymapget/binding/py-layer.h index bc641193..8b149852 100644 --- a/libs/pymapget/binding/py-layer.h +++ b/libs/pymapget/binding/py-layer.h @@ -96,8 +96,17 @@ void bindTileLayer(py::module_& m) std::visit( [&](auto&& vv) { - if constexpr (!std::is_same_v, std::monostate>) + using V = std::decay_t; + if constexpr (std::is_same_v) { + return; + } + else if constexpr (std::is_same_v) { + // Store bytes in hex to keep JSON valid and readable. + self.setInfo(k, vv.toHex()); + } + else { self.setInfo(k, vv); + } }, v); }, @@ -106,7 +115,7 @@ void bindTileLayer(py::module_& m) R"pbdoc( Set a JSON field to store sizes, construction times, and other arbitrary meta-information. The value may be - bool, int, double or string. + bool, int, double or string. ByteArray values are stored as hex strings. )pbdoc") .def( "set_prefix",