mirror of https://github.com/xemu-project/xemu.git
QDict: Introduce functions to retrieve QDictEntry values
Next commit will introduce a new QDict iteration API which returns QDictEntry entries, but we don't want users to directly access its members since QDictEntry should be private to QDict. In the near future this kind of data type will be turned into a forward reference. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
c8bc3cd72b
commit
0d078b2ade
21
qdict.c
21
qdict.c
|
@ -82,6 +82,27 @@ static QDictEntry *alloc_entry(const char *key, QObject *value)
|
|||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* qdict_entry_value(): Return qdict entry value
|
||||
*
|
||||
* Return weak reference.
|
||||
*/
|
||||
QObject *qdict_entry_value(const QDictEntry *entry)
|
||||
{
|
||||
return entry->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* qdict_entry_key(): Return qdict entry key
|
||||
*
|
||||
* Return a *pointer* to the string, it has to be duplicated before being
|
||||
* stored.
|
||||
*/
|
||||
const char *qdict_entry_key(const QDictEntry *entry)
|
||||
{
|
||||
return entry->key;
|
||||
}
|
||||
|
||||
/**
|
||||
* qdict_find(): List lookup function
|
||||
*/
|
||||
|
|
2
qdict.h
2
qdict.h
|
@ -34,6 +34,8 @@ typedef struct QDict {
|
|||
|
||||
/* Object API */
|
||||
QDict *qdict_new(void);
|
||||
const char *qdict_entry_key(const QDictEntry *entry);
|
||||
QObject *qdict_entry_value(const QDictEntry *entry);
|
||||
size_t qdict_size(const QDict *qdict);
|
||||
void qdict_put_obj(QDict *qdict, const char *key, QObject *value);
|
||||
void qdict_del(QDict *qdict, const char *key);
|
||||
|
|
Loading…
Reference in New Issue