summaryrefslogtreecommitdiff
path: root/keyword.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-05 21:43:47 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-05 21:49:29 -0300
commit2898adab6fde190d09f87cac58862c67ee193559 (patch)
tree7e0575564952a14c07a747e8968aa7a490713844 /keyword.h
parent16f20cd4834c6a004246a80ca18033ca80224b56 (diff)
keyword: Add `get_keyword_cb`, and add `get_callback` to `struct keyword`
This will be used for creating a getter callback for keywords. I also renamed `keyword_cb` to `set_keyword_cb`, aswell as renamed `callback` to `set_callback` in `struct keyword`.
Diffstat (limited to 'keyword.h')
-rw-r--r--keyword.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/keyword.h b/keyword.h
index 5fccbc4..c39f13c 100644
--- a/keyword.h
+++ b/keyword.h
@@ -6,7 +6,8 @@
typedef enum keyword_type keyword_type;
typedef struct keyword keyword;
typedef union keyword_val keyword_val;
-typedef int (keyword_cb)(void *ctx, void *ret, const keyword *key, keyword_val val);
+typedef int (set_keyword_cb)(void *ctx, void *ret, const keyword *key, keyword_val val);
+typedef int (get_keyword_cb)(void *ctx, void *data, const keyword *key, keyword_val *val);
typedef int (parse_callback)(void **ret, void *ctx, char *buf);
enum keyword_type {
@@ -20,12 +21,13 @@ enum keyword_type {
};
struct keyword {
- const char *key; /* Keyword. */
- const char *desc; /* Description of the keyword. */
- const char *time_fmt; /* Format string used to parse a timestamp (if needed). */
- keyword_type type; /* Datatype of the keyword. */
- size_t *offsets; /* Offset(s) of member(s) in a struct (if needed). */
- keyword_cb *callback; /* Callback to keyword specific parsing function (if needed). */
+ const char *key; /* Keyword. */
+ const char *desc; /* Description of the keyword. */
+ const char *time_fmt; /* Format string used to parse a timestamp (if needed). */
+ keyword_type type; /* Datatype of the keyword. */
+ size_t *offsets; /* Offset(s) of member(s) in a struct (if needed). */
+ set_keyword_cb *set_callback; /* Callback to keyword specific setter function (if needed). */
+ get_keyword_cb *get_callback; /* Callback to keyword specific getter function (if needed). */
};
union keyword_val {