Revision 83aba69e
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 |
} |
b/qdict.h | ||
---|---|---|
56 | 56 |
QDict *qdict_get_qdict(const QDict *qdict, const char *key); |
57 | 57 |
const char *qdict_get_str(const QDict *qdict, const char *key); |
58 | 58 |
int64_t qdict_get_try_int(const QDict *qdict, const char *key, |
59 |
int64_t err_value);
|
|
59 |
int64_t def_value);
|
|
60 | 60 |
const char *qdict_get_try_str(const QDict *qdict, const char *key); |
61 | 61 |
|
62 | 62 |
#endif /* QDICT_H */ |
Also available in: Unified diff