Revision acc3b033 qdict.c
b/qdict.c | ||
---|---|---|
11 | 11 |
*/ |
12 | 12 |
|
13 | 13 |
#include "qint.h" |
14 |
#include "qfloat.h" |
|
14 | 15 |
#include "qdict.h" |
15 | 16 |
#include "qbool.h" |
16 | 17 |
#include "qstring.h" |
... | ... | |
175 | 176 |
} |
176 | 177 |
|
177 | 178 |
/** |
179 |
* qdict_get_double(): Get an number mapped by 'key' |
|
180 |
* |
|
181 |
* This function assumes that 'key' exists and it stores a |
|
182 |
* QFloat or QInt object. |
|
183 |
* |
|
184 |
* Return number mapped by 'key'. |
|
185 |
*/ |
|
186 |
double qdict_get_double(const QDict *qdict, const char *key) |
|
187 |
{ |
|
188 |
QObject *obj = qdict_get(qdict, key); |
|
189 |
|
|
190 |
assert(obj); |
|
191 |
switch (qobject_type(obj)) { |
|
192 |
case QTYPE_QFLOAT: |
|
193 |
return qfloat_get_double(qobject_to_qfloat(obj)); |
|
194 |
case QTYPE_QINT: |
|
195 |
return qint_get_int(qobject_to_qint(obj)); |
|
196 |
default: |
|
197 |
assert(0); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
201 |
/** |
|
178 | 202 |
* qdict_get_int(): Get an integer mapped by 'key' |
179 | 203 |
* |
180 | 204 |
* This function assumes that 'key' exists and it stores a |
Also available in: Unified diff