PengZheng commented on code in PR #470:
URL: https://github.com/apache/celix/pull/470#discussion_r1382392394


##########
libs/utils/include/celix_properties.h:
##########
@@ -17,86 +17,474 @@
  * under the License.
  */
 
-#ifndef CELIX_PROPERTIES_H_
-#define CELIX_PROPERTIES_H_
+/**
+ * @file celix_properties.h
+ * @brief Header file for the Celix Properties API.
+ *
+ * The Celix Properties API provides a means for storing and manipulating 
key-value pairs, called properties,
+ * which can be used to store configuration data or metadata for a service, 
component, or framework configuration.
+ * Functions are provided for creating and destroying property sets, loading 
and storing properties from/to a file
+ * or stream, and setting, getting, and unsetting individual properties. There 
are also functions for converting
+ * property values to various types (e.g. long, bool, double) and for 
iterating over the properties in a set.
+ *
+ * Supported property value types include:
+ *  - string (char*)
+ *  - long
+ *  - double
+ *  - bool
+ *  - celix_version_t*
+ */
 
 #include <stdio.h>
-#include <stdbool.h>
 
 #include "celix_cleanup.h"
 #include "celix_compiler.h"
 #include "celix_errno.h"
 #include "celix_utils_export.h"
+#include "celix_version.h"
+
+#ifndef CELIX_PROPERTIES_H_
+#define CELIX_PROPERTIES_H_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-typedef struct hashMap celix_properties_t; //opaque struct, TODO try to make 
this a celix_properties struct
+/**
+ * @brief celix_properties_t is a type that represents a set of key-value 
pairs called properties.
+ *
+ * @note Not thread safe.
+ */
+typedef struct celix_properties celix_properties_t;
+
+/**
+ * @brief Enum representing the possible types of a property value.
+ */
+typedef enum celix_properties_value_type {
+    CELIX_PROPERTIES_VALUE_TYPE_UNSET = 0,  /**< Property value is not set. */
+    CELIX_PROPERTIES_VALUE_TYPE_STRING = 1, /**< Property value is a string. */
+    CELIX_PROPERTIES_VALUE_TYPE_LONG = 2,   /**< Property value is a long 
integer. */
+    CELIX_PROPERTIES_VALUE_TYPE_DOUBLE = 3, /**< Property value is a double. */
+    CELIX_PROPERTIES_VALUE_TYPE_BOOL = 4,   /**< Property value is a boolean. 
*/
+    CELIX_PROPERTIES_VALUE_TYPE_VERSION = 5 /**< Property value is a Celix 
version. */
+} celix_properties_value_type_e;
+
+/**
+ * @brief A structure representing a single value entry in a property set.
+ */
+typedef struct celix_properties_entry {
+    const char* value;                       /**< The string value or string 
representation of a non-string
+                                                  typed value.*/
+    celix_properties_value_type_e valueType; /**< The type of the value of the 
entry */
 
+    union {
+        const char* strValue;                /**< The string value of the 
entry. */
+        long longValue;                      /**< The long integer value of 
the entry. */
+        double doubleValue;                  /**< The double-precision 
floating point value of the entry. */
+        bool boolValue;                      /**< The boolean value of the 
entry. */
+        const celix_version_t* versionValue; /**< The Celix version value of 
the entry. */
+    } typed;                                 /**< The typed values of the 
entry. Only valid if valueType
+                                                  is not 
CELIX_PROPERTIES_VALUE_TYPE_UNSET and only the matching
+                                                  value types should be used. 
E.g typed.boolValue if valueType is
+                                                  
CELIX_PROPERTIES_VALUE_TYPE_BOOL. */
+} celix_properties_entry_t;
+
+/**
+ * @brief Represents an iterator for iterating over the entries in a 
celix_properties_t object.
+ */
 typedef struct celix_properties_iterator {
-    //private data
-    void* _data1;
-    void* _data2;
-    void* _data3;
-    int _data4;
-    int _data5;
-} celix_properties_iterator_t;
+    /**
+     * @brief The index of the current iterator.
+     */
+    size_t index;
 
+    /**
+     * @brief Te current key.

Review Comment:
   ```suggestion
        * @brief The current key.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to