Lines Matching refs:key

64     /* Set the initial value from the key size. */
74 static QDictEntry *alloc_entry(const char *key, QObject *value)
79 entry->key = g_strdup(key);
96 * qdict_entry_key(): Return qdict entry key
103 return entry->key;
110 const char *key, unsigned int bucket)
115 if (!strcmp(entry->key, key))
124 * Insert the pair 'key:value' into 'qdict', if 'key' already exists
132 void qdict_put_obj(QDict *qdict, const char *key, QObject *value)
137 bucket = tdb_hash(key) % QDICT_BUCKET_MAX;
138 entry = qdict_find(qdict, key, bucket);
140 /* replace key's value */
145 entry = alloc_entry(key, value);
152 * qdict_get(): Lookup for a given 'key'
154 * Return a weak reference to the QObject associated with 'key' if
155 * 'key' is present in the dictionary, NULL otherwise.
157 QObject *qdict_get(const QDict *qdict, const char *key)
161 entry = qdict_find(qdict, key, tdb_hash(key) % QDICT_BUCKET_MAX);
166 * qdict_haskey(): Check if 'key' exists
168 * Return 1 if 'key' exists in the dict, 0 otherwise
170 int qdict_haskey(const QDict *qdict, const char *key)
172 unsigned int bucket = tdb_hash(key) % QDICT_BUCKET_MAX;
173 return (qdict_find(qdict, key, bucket) == NULL ? 0 : 1);
187 static QObject *qdict_get_obj(const QDict *qdict, const char *key,
192 obj = qdict_get(qdict, key);
200 * qdict_get_double(): Get an number mapped by 'key'
202 * This function assumes that 'key' exists and it stores a
205 * Return number mapped by 'key'.
207 double qdict_get_double(const QDict *qdict, const char *key)
209 QObject *obj = qdict_get(qdict, key);
223 * qdict_get_int(): Get an integer mapped by 'key'
225 * This function assumes that 'key' exists and it stores a
228 * Return integer mapped by 'key'.
230 int64_t qdict_get_int(const QDict *qdict, const char *key)
232 QObject *obj = qdict_get_obj(qdict, key, QTYPE_QINT);
237 * qdict_get_bool(): Get a bool mapped by 'key'
239 * This function assumes that 'key' exists and it stores a
242 * Return bool mapped by 'key'.
244 int qdict_get_bool(const QDict *qdict, const char *key)
246 QObject *obj = qdict_get_obj(qdict, key, QTYPE_QBOOL);
251 * qdict_get_qlist(): Get the QList mapped by 'key'
253 * This function assumes that 'key' exists and it stores a
256 * Return QList mapped by 'key'.
258 QList *qdict_get_qlist(const QDict *qdict, const char *key)
260 return qobject_to_qlist(qdict_get_obj(qdict, key, QTYPE_QLIST));
264 * qdict_get_qdict(): Get the QDict mapped by 'key'
266 * This function assumes that 'key' exists and it stores a
269 * Return QDict mapped by 'key'.
271 QDict *qdict_get_qdict(const QDict *qdict, const char *key)
273 return qobject_to_qdict(qdict_get_obj(qdict, key, QTYPE_QDICT));
278 * by 'key'
280 * This function assumes that 'key' exists and it stores a
283 * Return pointer to the string mapped by 'key'.
285 const char *qdict_get_str(const QDict *qdict, const char *key)
287 QObject *obj = qdict_get_obj(qdict, key, QTYPE_QSTRING);
292 * qdict_get_try_int(): Try to get integer mapped by 'key'
294 * Return integer mapped by 'key', if it is not present in
298 int64_t qdict_get_try_int(const QDict *qdict, const char *key,
303 obj = qdict_get(qdict, key);
311 * qdict_get_try_bool(): Try to get a bool mapped by 'key'
313 * Return bool mapped by 'key', if it is not present in the
317 int qdict_get_try_bool(const QDict *qdict, const char *key, int def_value)
321 obj = qdict_get(qdict, key);
330 * mapped by 'key'
332 * Return a pointer to the string mapped by 'key', if it is not present
336 const char *qdict_get_try_str(const QDict *qdict, const char *key)
340 obj = qdict_get(qdict, key);
354 void (*iter)(const char *key, QObject *obj, void *opaque),
362 iter(entry->key, entry->value, opaque);
396 unsigned int bucket = tdb_hash(entry->key) % QDICT_BUCKET_MAX;
418 qdict_put_obj(dest, entry->key, entry->value);
431 assert(e->key != NULL);
435 g_free(e->key);
440 * qdict_del(): Delete a 'key:value' pair from the dictionary
444 void qdict_del(QDict *qdict, const char *key)
448 entry = qdict_find(qdict, key, tdb_hash(key) % QDICT_BUCKET_MAX);
497 new_key = g_strdup_printf("%s.%s", prefix, entry->key);
504 new_key ? new_key : entry->key);
516 qdict_del(qdict, entry->key);
528 * qdict_flatten(): For each nested QDict with key x, all fields with key y
529 * are moved to this QDict and their key is renamed to "x.y". This operation
549 if (strstart(entry->key, start, &p)) {
552 qdict_del(src, entry->key);