GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 100.0% 3 / 0 / 3
Functions: 100.0% 1 / 0 / 1
Branches: 52.5% 21 / 0 / 40

shumate/vector/shumate-vector-expression-private.h
Line Branch Exec Source
1 /*
2 * Copyright (C) 2021 James Westman <james@jwestman.net>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <https://www.gnu.org/licenses/>.
16 */
17
18 #pragma once
19
20 #include <json-glib/json-glib.h>
21 #include "shumate-vector-render-scope-private.h"
22 #include "shumate-vector-symbol-info-private.h"
23 #include "../shumate-vector-value-private.h"
24 #include "shumate-vector-index-private.h"
25
26 G_BEGIN_DECLS
27
28 typedef struct _ShumateVectorExpressionContext ShumateVectorExpressionContext;
29 struct _ShumateVectorExpressionContext {
30 ShumateVectorExpressionContext *parent;
31 GHashTable *variables;
32 };
33
34 void shumate_vector_expression_context_clear (ShumateVectorExpressionContext *ctx);
35
36 6 G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (ShumateVectorExpressionContext, shumate_vector_expression_context_clear)
37
38 #define SHUMATE_TYPE_VECTOR_EXPRESSION (shumate_vector_expression_get_type())
39
21/40
None:
✓ Branch 7 → 8 taken 2 times.
✗ Branch 7 → 9 not taken.
✓ Branch 9 → 10 taken 372 times.
✗ Branch 9 → 11 not taken.
✓ Branch 11 → 12 taken 372 times.
✓ Branch 11 → 13 taken 2 times.
✗ Branch 12 → 13 not taken.
✓ Branch 12 → 14 taken 20 times.
✓ Branch 13 → 14 taken 2 times.
✗ Branch 13 → 15 not taken.
✓ Branch 14 → 15 taken 20 times.
✗ Branch 14 → 16 not taken.
✓ Branch 20 → 21 taken 2 times.
✗ Branch 20 → 22 not taken.
✓ Branch 22 → 23 taken 4 times.
✗ Branch 22 → 24 not taken.
✓ Branch 24 → 25 taken 2 times.
✗ Branch 24 → 26 not taken.
✓ Branch 26 → 27 taken 18 times.
✗ Branch 26 → 28 not taken.
✓ Branch 28 → 29 taken 18 times.
✗ Branch 28 → 30 not taken.
✓ Branch 30 → 31 taken 2 times.
✗ Branch 30 → 32 not taken.
✓ Branch 32 → 33 taken 2 times.
✗ Branch 32 → 34 not taken.
✓ Branch 60 → 61 taken 2 times.
✗ Branch 60 → 62 not taken.
✓ Branch 62 → 63 taken 2 times.
✗ Branch 62 → 64 not taken.
✗ Branch 117 → 118 not taken.
✗ Branch 117 → 256 not taken.
✓ Branch 256 → 257 taken 16 times.
✓ Branch 256 → 258 taken 2 times.
SHUMATE_IS_VECTOR_EXPRESSION:
✓ Branch 3 → 4 taken 1978 times.
✗ Branch 3 → 7 not taken.
✓ Branch 4 → 5 taken 1978 times.
✗ Branch 4 → 6 not taken.
✓ Branch 5 → 6 taken 2000 times.
✗ Branch 5 → 7 not taken.
6424 G_DECLARE_DERIVABLE_TYPE (ShumateVectorExpression, shumate_vector_expression, SHUMATE, VECTOR_EXPRESSION, GObject)
40
41 struct _ShumateVectorExpressionClass
42 {
43 GObjectClass parent_class;
44
45 gboolean (*eval) (ShumateVectorExpression *self,
46 ShumateVectorRenderScope *scope,
47 ShumateVectorValue *out);
48
49 ShumateVectorIndexBitset *(*eval_bitset) (ShumateVectorExpression *self,
50 ShumateVectorRenderScope *scope,
51 ShumateVectorIndexBitset *mask);
52
53 void (*collect_indexes) (ShumateVectorExpression *self,
54 const char *layer_name,
55 ShumateVectorIndexDescription *index_description);
56 };
57
58 ShumateVectorExpression *shumate_vector_expression_from_json (JsonNode *json,
59 GError **error);
60 ShumateVectorExpression *shumate_vector_expression_filter_from_format (const char *format,
61 GError **error);
62
63 gboolean shumate_vector_expression_eval (ShumateVectorExpression *self,
64 ShumateVectorRenderScope *scope,
65 ShumateVectorValue *out);
66
67 ShumateVectorIndexBitset *shumate_vector_expression_eval_bitset (ShumateVectorExpression *self,
68 ShumateVectorRenderScope *scope,
69 ShumateVectorIndexBitset *mask);
70
71 void shumate_vector_expression_collect_indexes (ShumateVectorExpression *self,
72 const char *layer_name,
73 ShumateVectorIndexDescription *index_description);
74
75 double shumate_vector_expression_eval_number (ShumateVectorExpression *self,
76 ShumateVectorRenderScope *scope,
77 double default_val);
78
79 gboolean shumate_vector_expression_eval_boolean (ShumateVectorExpression *self,
80 ShumateVectorRenderScope *scope,
81 gboolean default_val);
82
83
84 char *shumate_vector_expression_eval_string (ShumateVectorExpression *self,
85 ShumateVectorRenderScope *scope,
86 const char *default_val);
87
88
89 void shumate_vector_expression_eval_color (ShumateVectorExpression *self,
90 ShumateVectorRenderScope *scope,
91 GdkRGBA *color);
92
93 ShumateVectorSprite *shumate_vector_expression_eval_image (ShumateVectorExpression *self,
94 ShumateVectorRenderScope *scope);
95
96 ShumateVectorAlignment shumate_vector_expression_eval_alignment (ShumateVectorExpression *self,
97 ShumateVectorRenderScope *scope);
98 ShumateVectorPlacement shumate_vector_expression_eval_placement (ShumateVectorExpression *self,
99 ShumateVectorRenderScope *scope);
100
101 ShumateVectorAnchor shumate_vector_expression_eval_anchor (ShumateVectorExpression *self,
102 ShumateVectorRenderScope *scope);
103
104 ShumateVectorOverlap shumate_vector_expression_eval_overlap (ShumateVectorExpression *self,
105 ShumateVectorExpression *allow_overlap,
106 ShumateVectorRenderScope *scope);
107
108 G_END_DECLS
109