[libshumate] vector: Add explicit "get" expression
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libshumate] vector: Add explicit "get" expression
- Date: Wed, 13 Jul 2022 13:46:25 +0000 (UTC)
commit d451a469ae65ea6574caf472cee0044e4059058c
Author: James Westman <james jwestman net>
Date: Sat Jun 25 22:51:31 2022 -0500
vector: Add explicit "get" expression
shumate/vector/shumate-vector-expression-filter.c | 6 ++++++
tests/vector-expression.c | 1 +
2 files changed, 7 insertions(+)
---
diff --git a/shumate/vector/shumate-vector-expression-filter.c
b/shumate/vector/shumate-vector-expression-filter.c
index d7a51ff..de64cbd 100644
--- a/shumate/vector/shumate-vector-expression-filter.c
+++ b/shumate/vector/shumate-vector-expression-filter.c
@@ -103,6 +103,12 @@ shumate_vector_expression_filter_from_json_array (JsonArray *array, GError **err
expect_exprs = 1;
lookup_first_arg = FALSE;
}
+ else if (g_strcmp0 ("get", op) == 0)
+ {
+ self->type = EXPR_GET;
+ expect_exprs = 1;
+ lookup_first_arg = FALSE;
+ }
else if (g_strcmp0 ("in", op) == 0)
{
self->type = EXPR_IN;
diff --git a/tests/vector-expression.c b/tests/vector-expression.c
index 1f319f5..2d2ae46 100644
--- a/tests/vector-expression.c
+++ b/tests/vector-expression.c
@@ -192,6 +192,7 @@ test_vector_expression_feature_filter (void)
scope.feature = scope.layer->features[0];
g_assert_true (filter_with_scope (&scope, "[\"==\", \"name\", \"Hello, world!\"]"));
+ g_assert_true (filter_with_scope (&scope, "[\"==\", [\"get\", \"name\"], \"Hello, world!\"]"));
g_assert_false (filter_with_scope (&scope, "[\"==\", \"name\", \"Goodbye, world!\"]"));
g_assert_true (filter_with_scope (&scope, "[\"has\", \"name\"]"));
g_assert_false (filter_with_scope (&scope, "[\"!has\", \"name\"]"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]