aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2016-12-13 00:50:23 +0100
committerKatharina Fey <kookie@spacekookie.de>2019-06-04 20:21:53 +0200
commitced46bac3291118e136f5e3d50bc898b018276fc (patch)
tree2ff60aa032748480b56e8a1f554484a59a368cac
parente8e503ed6ef043f0ca9d540290adc5ca61b8551e (diff)
Updating the dtree API to contain a boolean value and be comfigurable to support long long numerals
-rw-r--r--include/dtree/dtree.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/include/dtree/dtree.h b/include/dtree/dtree.h
index c0ab824..b74ea33 100644
--- a/include/dtree/dtree.h
+++ b/include/dtree/dtree.h
@@ -26,10 +26,6 @@
/* A helpful macro that can take care of \0 termated strings! */
#define REAL_STRLEN(str) (strlen(str) + 1)
-#define DYNTREE_ENCODE_NONE 0x0
-#define DYNTREE_JSON_MINIFIED 0xA
-#define DYNTREE_JSON_HUMAN 0xB
-
/* Also make sure we're _always_ interpreted as a C file */
#ifdef __cplusplus
extern "C" {
@@ -49,9 +45,15 @@ typedef struct dtree {
short copy;
union {
char *literal;
- long numeral;
+ bool bool;
struct dtree *(*list);
void *pointer;
+#ifdef __LONG_LONG_SUPPORT__
+ long long numeral;
+#else
+ long numeral;
+#endif
+
} payload;
} dtree;
@@ -97,7 +99,6 @@ dt_err dtree_resettype(dtree *data);
*
* @param data Reference to a dtree object
* @param literal String to store
- * @param length TRUE string length to use.
* @return
*/
dt_err dtree_addliteral(dtree *data, const char *literal);
@@ -114,6 +115,17 @@ dt_err dtree_addnumeral(dtree *data, long numeral);
/**
+ * Set the data element to a boolean. Do you really
+ * need this? Consider using @dtree_add_numeral instead.
+ *
+ * @param data Reference to a dtree object
+ * @param b boolean value (true, false)
+ * @return
+ */
+dt_err dtree_addboolean(dtree *data, bool b);
+
+
+/**
* Add two new elements as a PAIR node under an existing node
*
* @param data dtree node to become the sub-root