Re: Glist in Glist



Hy,

Yep I think it is a regular way of using them.
To read back your data you can do it like that :

g_list_foreach(BigGList, ReadRow);


And then you declare a function which has this prototype :
void ReadRow(gpointer pxData_I)
{
    GList    *paBigList = (GList *)pxData_I;
    GList    *paRowList = NULL;
    gpointer    pxInfoCell = NULL;

    /* paBigList points on one of the element of your list */
    /* So we just have to retrieve the GList contained into this element */
    paRowList = (GList *)paBigList->data;

    /* Now if you want to read one element of your GList, you do it like
that : */
    pxInfoCell = (g_list_nth(paRowList, 4))->data;

    /* Or if you want to read the whole row */
    g_list_foreach(paRowList, ReadCell);
    /* Where RowCell is a function of this form : void ReadCell(gpointer
pxData_I); */
}


Best regards,
---
Jean-Christophe Berthon

Cap Gemini -- Ernst & Young
France
Skill IS -- Image Quality
Email: Jean-Christophe Berthon cgey com
Tel: (+33) 561 31 6639


----- Original Message -----
From: "Ivan Suchy" <is sth sk>
To: <gtk-app-devel-list gnome org>
Sent: Friday, November 09, 2001 4:54 PM
Subject: Glist in Glist


Hello all.

I would ask you if is it REGULAR to store glist in data part of another
glist. Target is create a virual table of data in memory, where one
list will represent rows and in every row will be stored second list
representing fields data (columns).
I tryied something like this, but I don't know how to read data back


Could someone help to me?

Thank you very much.

Ivan.








[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]