Skip to content

Commit

Permalink
filterx/object-primitive: add primitive base class
Browse files Browse the repository at this point in the history
Signed-off-by: Attila Szakacs <[email protected]>
  • Loading branch information
alltilla committed Jul 29, 2024
1 parent 52d08b7 commit 9a9615d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/filterx/object-primitive.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,27 +355,26 @@ _repr(FilterXObject *s, GString *repr)
return filterx_object_marshal_append(s, repr, &t);
}

FILTERX_DEFINE_TYPE(integer, FILTERX_TYPE_NAME(object),
FILTERX_DEFINE_TYPE(primitive, FILTERX_TYPE_NAME(object),
.truthy = _truthy,
.repr = _repr,
);

FILTERX_DEFINE_TYPE(integer, FILTERX_TYPE_NAME(primitive),
.marshal = _integer_marshal,
.map_to_json = _integer_map_to_json,
.repr = _repr,
.add = _integer_add,
);

FILTERX_DEFINE_TYPE(double, FILTERX_TYPE_NAME(object),
.truthy = _truthy,
FILTERX_DEFINE_TYPE(double, FILTERX_TYPE_NAME(primitive),
.marshal = _double_marshal,
.map_to_json = _double_map_to_json,
.repr = _repr,
.add = _double_add,
);

FILTERX_DEFINE_TYPE(boolean, FILTERX_TYPE_NAME(object),
.truthy = _truthy,
FILTERX_DEFINE_TYPE(boolean, FILTERX_TYPE_NAME(primitive),
.marshal = _bool_marshal,
.map_to_json = _bool_map_to_json,
.repr = _repr,
);

void
Expand Down
1 change: 1 addition & 0 deletions lib/filterx/object-primitive.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "filterx/filterx-object.h"
#include "generic-number.h"

FILTERX_DECLARE_TYPE(primitive);
FILTERX_DECLARE_TYPE(integer);
FILTERX_DECLARE_TYPE(double);
FILTERX_DECLARE_TYPE(boolean);
Expand Down

0 comments on commit 9a9615d

Please sign in to comment.