src/cx/json.h

changeset 1424
563033aa998c
parent 1417
b97faf8b7ab7
--- a/src/cx/json.h	Sat Oct 11 15:42:48 2025 +0200
+++ b/src/cx/json.h	Sun Oct 12 20:21:56 2025 +0200
@@ -90,11 +90,11 @@
      */
     CX_JSON_TOKEN_STRING,
     /**
-     * A number token that can be represented as integer.
+     * A number token that can be represented as an integer.
      */
     CX_JSON_TOKEN_INTEGER,
     /**
-     * A number token that cannot be represented as integer.
+     * A number token that cannot be represented as an integer.
      */
     CX_JSON_TOKEN_NUMBER,
     /**
@@ -196,11 +196,11 @@
  */
 typedef struct cx_mutstr_s CxJsonString;
 /**
- * Type alias for a number that can be represented as 64-bit signed integer.
+ * Type alias for a number that can be represented as a 64-bit signed integer.
  */
 typedef int64_t CxJsonInteger;
 /**
- * Type alias for number that is not an integer.
+ * Type alias for a number that is not an integer.
  */
 typedef double CxJsonNumber;
 /**
@@ -272,27 +272,27 @@
      */
     union {
         /**
-         * The array data if type is #CX_JSON_ARRAY.
+         * The array data if the type is #CX_JSON_ARRAY.
          */
         CxJsonArray array;
         /**
-         * The object data if type is #CX_JSON_OBJECT.
+         * The object data if the type is #CX_JSON_OBJECT.
          */
         CxJsonObject object;
         /**
-         * The string data if type is #CX_JSON_STRING.
+         * The string data if the type is #CX_JSON_STRING.
          */
         CxJsonString string;
         /**
-         * The integer if type is #CX_JSON_INTEGER.
+         * The integer if the type is #CX_JSON_INTEGER.
          */
         CxJsonInteger integer;
         /**
-         * The number if type is #CX_JSON_NUMBER.
+         * The number if the type is #CX_JSON_NUMBER.
          */
         CxJsonNumber number;
         /**
-         * The literal type if type is #CX_JSON_LITERAL.
+         * The literal type if the type is #CX_JSON_LITERAL.
          */
         CxJsonLiteral literal;
     } value;
@@ -377,7 +377,7 @@
 };
 
 /**
- * Status codes for the json interface.
+ * Status codes for the JSON interface.
  */
 enum cx_json_status {
     /**
@@ -391,7 +391,7 @@
     /**
      * The input ends unexpectedly.
      *
-     * Refill the buffer with cxJsonFill() to complete the json data.
+     * Refill the buffer with cxJsonFill() to complete the JSON data.
      */
     CX_JSON_INCOMPLETE_DATA,
     /**
@@ -400,7 +400,7 @@
      * You can use this enumerator to check for all "good" status results
      * by checking if the status is less than @c CX_JSON_OK.
      *
-     * A "good" status means, that you can refill data and continue parsing.
+     * A "good" status means that you can refill data and continue parsing.
      */
     CX_JSON_OK,
     /**
@@ -412,7 +412,7 @@
      */
     CX_JSON_BUFFER_ALLOC_FAILED,
     /**
-     * Allocating memory for a json value failed.
+     * Allocating memory for a JSON value failed.
      */
     CX_JSON_VALUE_ALLOC_FAILED,
     /**
@@ -426,7 +426,7 @@
 };
 
 /**
- * Typedef for the json status enum.
+ * Typedef for the JSON status enum.
  */
 typedef enum cx_json_status CxJsonStatus;
 
@@ -445,7 +445,7 @@
     /**
      * The maximum number of fractional digits in a number value.
      * The default value is 6 and values larger than 15 are reduced to 15.
-     * Note, that the actual number of digits may be lower, depending on the concrete number.
+     * Note that the actual number of digits may be lower, depending on the concrete number.
      */
     uint8_t frac_max_digits;
     /**
@@ -465,7 +465,7 @@
 };
 
 /**
- * Typedef for the json writer.
+ * Typedef for the JSON writer.
  */
 typedef struct cx_json_writer_s CxJsonWriter;
 
@@ -496,9 +496,8 @@
  * that the data is only partially written when an error occurs with no
  * way to indicate how much data was written.
  * To avoid this problem, you can use a CxBuffer as @p target which is
- * unlikely to fail a write operation and either use the buffer's flush
- * feature to relay the data or use the data in the buffer manually to
- * write it to the actual target.
+ * unlikely to fail a write operation. You can, for example, use the buffer's flush
+ * feature to relay the data.
  *
  * @param target the buffer or stream where to write to
  * @param value the value that shall be written
@@ -517,9 +516,9 @@
 );
 
 /**
- * Initializes the json interface.
+ * Initializes the JSON interface.
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @param allocator the allocator that shall be used for the produced values
  * @see cxJsonDestroy()
  */
@@ -528,9 +527,9 @@
 void cxJsonInit(CxJson *json, const CxAllocator *allocator);
 
 /**
- * Destroys the json interface.
+ * Destroys the JSON interface.
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @see cxJsonInit()
  */
 cx_attr_nonnull
@@ -538,12 +537,12 @@
 void cxJsonDestroy(CxJson *json);
 
 /**
- * Destroys and re-initializes the json interface.
+ * Destroys and re-initializes the JSON interface.
  *
- * You might want to use this, to reset the parser after
+ * You might want to use this to reset the parser after
  * encountering a syntax error.
  *
- * @param json the json interface
+ * @param json the JSON interface
  */
 cx_attr_nonnull
 static inline void cxJsonReset(CxJson *json) {
@@ -563,7 +562,7 @@
  * the additional data is appended - inevitably leading to
  * an allocation of a new buffer and copying the previous contents.
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @param buf the source buffer
  * @param len the length of the source buffer
  * @retval zero success
@@ -579,7 +578,7 @@
 /**
  * Internal function, do not use.
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @param str the string
  * @retval zero success
  * @retval non-zero internal allocation error
@@ -600,7 +599,7 @@
  * the additional data is appended - inevitably leading to
  * an allocation of a new buffer and copying the previous contents.
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @param str the source string
  * @retval zero success
  * @retval non-zero internal allocation error
@@ -917,8 +916,8 @@
  * Recursively deallocates the memory of a JSON value.
  *
  * @remark The type of each deallocated value will be changed
- * to #CX_JSON_NOTHING and values of such type will be skipped
- * by the de-allocation. That means, this function protects
+ * to #CX_JSON_NOTHING, and values of such a type will be skipped
+ * by the deallocation. That means this function protects
  * you from double-frees when you are accidentally freeing
  * a nested value and then the parent value (or vice versa).
  *
@@ -937,7 +936,7 @@
  * add the missing data with another invocation of cxJsonFill()
  * and then repeat the call to cxJsonNext().
  *
- * @param json the json interface
+ * @param json the JSON interface
  * @param value a pointer where the next value shall be stored
  * @retval CX_JSON_NO_ERROR successfully retrieve the @p value
  * @retval CX_JSON_NO_DATA there is no (more) data in the buffer to read from
@@ -993,7 +992,7 @@
 /**
  * Checks if the specified value is a JSON number.
  *
- * This function will return true for both floating point and
+ * This function will return true for both floating-point and
  * integer numbers.
  *
  * @param value a pointer to the value
@@ -1053,7 +1052,7 @@
 /**
  * Checks if the specified value is @c true.
  *
- * @remark Be advised, that this is not the same as
+ * @remark Be advised that this is different from
  * testing @c !cxJsonIsFalse(v).
  *
  * @param value a pointer to the value
@@ -1070,7 +1069,7 @@
 /**
  * Checks if the specified value is @c false.
  *
- * @remark Be advised, that this is not the same as
+ * @remark Be advised that this is different from
  * testing @c !cxJsonIsTrue(v).
  *
  * @param value a pointer to the value
@@ -1141,7 +1140,7 @@
 }
 
 /**
- * Obtains a double-precision floating point value from the given JSON value.
+ * Obtains a double-precision floating-point value from the given JSON value.
  *
  * If the @p value is not a JSON number, the behavior is undefined.
  *

mercurial