src/cx/json.h

changeset 1009
7650e722437e
parent 1007
81b2986d2b04
child 1012
21884374edbb
--- a/src/cx/json.h	Tue Dec 10 00:52:15 2024 +0100
+++ b/src/cx/json.h	Tue Dec 10 21:40:39 2024 +0100
@@ -294,73 +294,73 @@
 CxJsonStatus cxJsonNext(CxJson *json, CxJsonValue **value);
 
 cx_attr_nonnull
-static inline bool cxJsonIsObject(CxJsonValue *value) {
+static inline bool cxJsonIsObject(const CxJsonValue *value) {
     return value->type == CX_JSON_OBJECT;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsArray(CxJsonValue *value) {
+static inline bool cxJsonIsArray(const CxJsonValue *value) {
     return value->type == CX_JSON_ARRAY;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsString(CxJsonValue *value) {
+static inline bool cxJsonIsString(const CxJsonValue *value) {
     return value->type == CX_JSON_STRING;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsNumber(CxJsonValue *value) {
+static inline bool cxJsonIsNumber(const CxJsonValue *value) {
     return value->type == CX_JSON_NUMBER || value->type == CX_JSON_INTEGER;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsInteger(CxJsonValue *value) {
+static inline bool cxJsonIsInteger(const CxJsonValue *value) {
     return value->type == CX_JSON_INTEGER;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsLiteral(CxJsonValue *value) {
+static inline bool cxJsonIsLiteral(const CxJsonValue *value) {
     return value->type == CX_JSON_LITERAL;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsBool(CxJsonValue *value) {
+static inline bool cxJsonIsBool(const CxJsonValue *value) {
     return cxJsonIsLiteral(value) && value->value.literal != CX_JSON_NULL;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsTrue(CxJsonValue *value) {
+static inline bool cxJsonIsTrue(const CxJsonValue *value) {
     return cxJsonIsLiteral(value) && value->value.literal == CX_JSON_TRUE;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsFalse(CxJsonValue *value) {
+static inline bool cxJsonIsFalse(const CxJsonValue *value) {
     return cxJsonIsLiteral(value) && value->value.literal == CX_JSON_FALSE;
 }
 
 cx_attr_nonnull
-static inline bool cxJsonIsNull(CxJsonValue *value) {
+static inline bool cxJsonIsNull(const CxJsonValue *value) {
     return cxJsonIsLiteral(value) && value->value.literal == CX_JSON_NULL;
 }
 
 cx_attr_nonnull
 cx_attr_returns_nonnull
-static inline char *cxJsonAsString(CxJsonValue *value) {
+static inline char *cxJsonAsString(const CxJsonValue *value) {
     return value->value.string.ptr;
 }
 
 cx_attr_nonnull
-static inline cxstring cxJsonAsCxString(CxJsonValue *value) {
+static inline cxstring cxJsonAsCxString(const CxJsonValue *value) {
     return cx_strcast(value->value.string);
 }
 
 cx_attr_nonnull
-static inline cxmutstr cxJsonAsCxMutStr(CxJsonValue *value) {
+static inline cxmutstr cxJsonAsCxMutStr(const CxJsonValue *value) {
     return value->value.string;
 }
 
 cx_attr_nonnull
-static inline double cxJsonAsDouble(CxJsonValue *value) {
+static inline double cxJsonAsDouble(const CxJsonValue *value) {
     if (value->type == CX_JSON_INTEGER) {
         return (double) value->value.integer;
     } else {
@@ -369,7 +369,7 @@
 }
 
 cx_attr_nonnull
-static inline int64_t cxJsonAsInteger(CxJsonValue *value) {
+static inline int64_t cxJsonAsInteger(const CxJsonValue *value) {
     if (value->type == CX_JSON_INTEGER) {
         return value->value.integer;
     } else {
@@ -378,18 +378,18 @@
 }
 
 cx_attr_nonnull
-static inline bool cxJsonAsBool(CxJsonValue *value) {
+static inline bool cxJsonAsBool(const CxJsonValue *value) {
     return value->value.literal == CX_JSON_TRUE;
 }
 
 cx_attr_nonnull
-static inline size_t cxJsonArrSize(CxJsonValue *value) {
+static inline size_t cxJsonArrSize(const CxJsonValue *value) {
     return value->value.array.array_size;
 }
 
 cx_attr_nonnull
 cx_attr_returns_nonnull
-CxJsonValue *cxJsonArrGet(CxJsonValue *value, size_t index);
+CxJsonValue *cxJsonArrGet(const CxJsonValue *value, size_t index);
 
 // TODO: add cxJsonArrIter()
 
@@ -397,7 +397,7 @@
 cx_attr_nonnull
 cx_attr_returns_nonnull
 cx_attr_cstr_arg(2)
-CxJsonValue *cxJsonObjGet(CxJsonValue *value, const char* name);
+CxJsonValue *cxJsonObjGet(const CxJsonValue *value, const char* name);
 
 #ifdef __cplusplus
 }

mercurial