apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
165 stars 86 forks source link

Type aware properties improvements #674

Open pnoltes opened 11 months ago

pnoltes commented 11 months ago

Intro

Improve celix properties so that properties can be stored and loaded to/from file with type information and encode (serialize) to/from netstring with type information.

Store / Load

Ensure that properties stored using celix_properties_store contain type information if the entry is not a string (i.e. long, double, boolean or version) and that properties loaded using celix_properties_load, celix_properties_loadWithStream or celix_properties_loadFromString used the optional type information to load a type aware properties set.

Properties netstring encoding

Add some util functions that can encode/decode a celix properties set to/from a netstring sequence.

The properties can be a netstring sequence where the content is:

Array support

Currently properties do not support a array of typed entries. Support for typed arrays for the following types (string, long, double, bool and celix_version_t) would be nice to have.

PengZheng commented 11 months ago

It will be nice to have array support. If we went one step further to support embedding properties, celix properties will become json.

pnoltes commented 7 months ago

In PR #727, element types for the array list were introduced.

To ensure the introduction of array list element types is backwards compatible, a potential element type value of CELIX_ARRAY_LIST_ELEMENT_TYPE_UNDEFINED was added. The support for the CELIX_ARRAY_LIST_ELEMENT_TYPE_UNDEFINED element type is intended to be temporary. This addition allows for a separate PR that focuses solely on refactoring Celix array list usage.