qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v2 2/8] QDict: New qdict_get_double()
Date: Wed, 20 Jan 2010 17:08:16 +0100	[thread overview]
Message-ID: <1264003702-17329-3-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1264003702-17329-1-git-send-email-armbru@redhat.com>

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(-)

diff --git a/qdict.c b/qdict.c
index ba8eef0..de278b1 100644
--- a/qdict.c
+++ b/qdict.c
@@ -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
diff --git a/qdict.h b/qdict.h
index 5fef1ea..5649ccf 100644
--- a/qdict.h
+++ b/qdict.h
@@ -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);
-- 
1.6.6

  parent reply	other threads:[~2010-01-20 16:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 16:08 [Qemu-devel] [PATCH v2 0/8] Convert migrate_set_speed, migrate_set_downtime to QObject Markus Armbruster
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 1/8] monitor: Document argument type 'M' Markus Armbruster
2010-01-20 16:41   ` Krumme, Chris
2010-01-20 17:15     ` Markus Armbruster
2010-01-20 16:08 ` Markus Armbruster [this message]
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 3/8] monitor: New argument type 'b' Markus Armbruster
2010-01-21 13:17   ` Luiz Capitulino
2010-01-21 14:04     ` Markus Armbruster
2010-01-21 14:28       ` Luiz Capitulino
2010-01-21 14:59         ` Markus Armbruster
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 4/8] monitor: Use argument type 'b' for migrate_set_speed() Markus Armbruster
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 5/8] monitor: convert do_migrate_set_speed() to QObject Markus Armbruster
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 6/8] monitor: New argument type 'T' Markus Armbruster
2010-01-21 13:26   ` Luiz Capitulino
2010-01-21 13:54     ` Markus Armbruster
2010-01-21 14:19       ` Luiz Capitulino
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 7/8] monitor: Use argument type 'T' for migrate_set_downtime() Markus Armbruster
2010-01-20 16:08 ` [Qemu-devel] [PATCH v2 8/8] monitor: convert do_migrate_set_downtime() to QObject Markus Armbruster
2010-01-20 16:09 ` [Qemu-devel] Re: [PATCH v2 0/8] Convert migrate_set_speed, migrate_set_downtime " Markus Armbruster
2010-01-22 17:45 ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264003702-17329-3-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).