变体数据类型库对于C [英] Variant datatype library for C

查看:214
本文介绍了变体数据类型库对于C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有存储和处理结果一个体面的开源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.

请注意:我不认为这是问题的<一个副本href=\"http://stackoverflow.com/questions/649649/any-library-for-generic-datatypes-in-c\">http://stackoverflow.com/questions/649649/any-library-for-generic-datatypes-in-c ,这是指队列,树,地图,列表。我说的是更侧重于制定与SQL数据库大致顺利,因为在跨preTED语言与他们合作的工作。

Note: I do not believe this is question is a duplicate of http://stackoverflow.com/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的形式一般价值类型:
http://library.gnome.org/devel/gobject/unstable /gobject-Generic-values​​.html

GLib has implementation of generic value types in form of GValue: http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html

这篇关于变体数据类型库对于C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆