blob: afdc4465bfd362eea135eeda0f0cb1ee4c64b0b1 [file] [log] [blame]
Luiz Capitulinoa6fd08e2009-10-07 13:41:48 -03001/*
2 * QList data type header.
3 *
4 * Copyright (C) 2009 Red Hat Inc.
5 *
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
11 */
12#ifndef QLIST_H
13#define QLIST_H
14
15#include "qobject.h"
16#include "qemu-queue.h"
17#include "qemu-common.h"
18
19typedef struct QListEntry {
20 QObject *value;
21 QTAILQ_ENTRY(QListEntry) next;
22} QListEntry;
23
24typedef struct QList {
25 QObject_HEAD;
26 QTAILQ_HEAD(,QListEntry) head;
27} QList;
28
29#define qlist_append(qlist, obj) \
30 qlist_append_obj(qlist, QOBJECT(obj))
31
32QList *qlist_new(void);
Anthony Liguori033815f2009-11-11 10:48:51 -060033QList *qlist_copy(QList *src);
Luiz Capitulinoa6fd08e2009-10-07 13:41:48 -030034void qlist_append_obj(QList *qlist, QObject *obj);
35void qlist_iter(const QList *qlist,
36 void (*iter)(QObject *obj, void *opaque), void *opaque);
Anthony Liguori033815f2009-11-11 10:48:51 -060037QObject *qlist_pop(QList *qlist);
38QObject *qlist_peek(QList *qlist);
39int qlist_empty(const QList *qlist);
Luiz Capitulinoa6fd08e2009-10-07 13:41:48 -030040QList *qobject_to_qlist(const QObject *obj);
41
42#endif /* QLIST_H */