@@ -11,6 +11,7 @@
*/
#include "qint.h"
+#include "qfloat.h"
#include "qdict.h"
#include "qbool.h"
#include "qstring.h"
@@ -175,6 +176,20 @@ static QObject *qdict_get_obj(const QDict *qdict, const char *key,
}
/**
+ * qdict_get_double(): Get an number mapped by 'key'
+ *
+ * This function assumes that 'key' exists and it stores a
+ * QFloat object.
+ *
+ * Return number mapped by 'key'.
+ */
+double qdict_get_double(const QDict *qdict, const char *key)
+{
+ QObject *obj = qdict_get_obj(qdict, key, QTYPE_QFLOAT);
+ return qfloat_get_double(qobject_to_qfloat(obj));
+}
+
+/**
* qdict_get_int(): Get an integer mapped by 'key'
*
* This function assumes that 'key' exists and it stores a
@@ -37,6 +37,7 @@ void qdict_iter(const QDict *qdict,
qdict_put_obj(qdict, key, QOBJECT(obj))
/* High level helpers */
+double qdict_get_double(const QDict *qdict, const char *key);
int64_t qdict_get_int(const QDict *qdict, const char *key);
int qdict_get_bool(const QDict *qdict, const char *key);
QList *qdict_get_qlist(const QDict *qdict, const char *key);
Helper function just like qdict_get_int(), just for QFloat/double. Signed-off-by: Markus Armbruster <armbru@redhat.com> --- qdict.c | 15 +++++++++++++++ qdict.h | 1 + 2 files changed, 16 insertions(+), 0 deletions(-)