Revision 83aba69e qdict.c
b/qdict.c | ||
---|---|---|
272 | 272 |
* |
273 | 273 |
* Return integer mapped by 'key', if it is not present in |
274 | 274 |
* the dictionary or if the stored object is not of QInt type |
275 |
* 'err_value' will be returned.
|
|
275 |
* 'def_value' will be returned.
|
|
276 | 276 |
*/ |
277 | 277 |
int64_t qdict_get_try_int(const QDict *qdict, const char *key, |
278 |
int64_t err_value)
|
|
278 |
int64_t def_value)
|
|
279 | 279 |
{ |
280 | 280 |
QObject *obj; |
281 | 281 |
|
282 | 282 |
obj = qdict_get(qdict, key); |
283 | 283 |
if (!obj || qobject_type(obj) != QTYPE_QINT) |
284 |
return err_value;
|
|
284 |
return def_value;
|
|
285 | 285 |
|
286 | 286 |
return qint_get_int(qobject_to_qint(obj)); |
287 | 287 |
} |
Also available in: Unified diff