是否有存储和处理结果一个体面的开源C库动态类型变量(亦称变种)?我在原子值(INT8,INT16,INT32,UINT,字符串,斑点等)的主要兴趣,而JSON风格的数组和对象以及自定义对象也将是不错。其中,这样的库将是有益的一个重要案例是使用SQL数据库。
Is there a decent open-source C library for storing and manipulating dynamically-typed variables (a.k.a. variants)? I'm primarily interested in atomic values (int8, int16, int32, uint, strings, blobs, etc.), while JSON-style arrays and objects as well as custom objects would also be nice. A major case where such a library would be useful is in working with SQL databases.
这样的库的最明显的特征是对所有支持的价值观单一类型的,例如:
The most obvious feature of such a library would be a single type for all supported values, e.g.:
struct Variant { enum Type type; union { int8_t int8_; int16_t int16_; // ... }; };其他功能可能包括转换变反对/从C结构(使用绑定表),从字符串值转换为/,并集成了现有的数据库的库如SQLite的。
Other features might include converting Variant objects to/from C structures (using a binding table), converting values to/from strings, and integration with an existing database library such as SQLite.
请注意:我不认为这是问题的stackoverflow/questions/649649/any-library-for-generic-datatypes-in-c ,这是指队列,树,地图,列表。我说的是更侧重于制定与SQL数据库大致顺利,因为在跨preTED语言与他们合作的工作。
Note: I do not believe this is question is a duplicate of stackoverflow/questions/649649/any-library-for-generic-datatypes-in-c , which refers to "queues, trees, maps, lists". What I'm talking about focuses more on making working with SQL databases roughly as smooth as working with them in interpreted languages.
推荐答案GLib的具有实施的GValue的形式一般价值类型: library.gnome/devel/gobject/unstable /gobject-Generic-values.html
GLib has implementation of generic value types in form of GValue: library.gnome/devel/gobject/unstable/gobject-Generic-values.html
更多推荐
变体数据类型库对于C
发布评论