* Fix list iterators for Vala 0.16 (and probably 0.14 too)

This commit is contained in:
pancake 2011-09-28 11:50:20 +02:00
parent 2a0b57d51d
commit 149a58581c
2 changed files with 18 additions and 2 deletions

View File

@ -41,6 +41,7 @@ typedef struct r_oflist_t {
#define r_list_iter_next(x) (x?1:0)
#define r_list_iter_cur(x) x->p
#define r_list_iter_unref(x) x
#define r_list_iter_free(x) x
R_API RList *r_list_new();
R_API RListIter *r_list_append(RList *list, void *data);
R_API RListIter *r_list_prepend(RList *list, void *data);

View File

@ -127,12 +127,27 @@ public class RList<G> {
public unowned G pop();
}
//[Compact]
[Compact]
[CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")]
public class RListIter<G> {
public bool next();
public RListIter<G> n;
public RListIter<G> p;
public G data;
// public G @free(G arg);
/*
public bool next();
public unowned G get();
*/
[ReturnsModifiedPointer, CCode (cname = "_vala_r_list_iter_next")]
public bool next() {
return (bool)this.n;
}
[CCode (cname = "_vala_r_list_iter_get")]
public G get () {
return this.data;
}
}
[Compact]