GnuCash  5.6-150-g038405b370+
gtable.h
Go to the documentation of this file.
1 /********************************************************************\
2  * gtable.h -- glib -- basic datatype for 2D array of values *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License*
15  * along with this program; if not, contact: *
16  * *
17  * Free Software Foundation Voice: +1-617-542-5942 *
18  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
19  * Boston, MA 02110-1301, USA gnu@gnu.org *
20  * *
21 \********************************************************************/
22 
23 #ifndef G_TABLE_H
24 #define G_TABLE_H
25 
26 #include <glib.h>
27 
36 typedef struct GTable GTable;
37 
38 typedef void (*g_table_entry_constructor) (gpointer entry, gpointer user_data);
39 typedef void (*g_table_entry_destroyer) (gpointer entry, gpointer user_data);
40 
41 
45 GTable * g_table_new (guint entry_size,
46  g_table_entry_constructor constructor,
47  g_table_entry_destroyer destroyer,
48  gpointer user_data);
49 
51 void g_table_destroy (GTable *gtable);
52 
55 gpointer g_table_index (GTable *gtable, int row, int col);
56 
63 void g_table_resize (GTable *gtable, int rows, int cols);
64 
66 int g_table_rows (GTable *gtable);
67 
69 int g_table_cols (GTable *gtable);
70 
72 #endif
int g_table_cols(GTable *gtable)
Return the number of table columns.
Definition: gtable.c:165
GTable * g_table_new(guint entry_size, g_table_entry_constructor constructor, g_table_entry_destroyer destroyer, gpointer user_data)
Create a new table with the given entry constructor and destroyer.
Definition: gtable.c:44
gpointer g_table_index(GTable *gtable, int row, int col)
Return the element at the given row and column.
Definition: gtable.c:84
Definition: gtable.c:28
int g_table_rows(GTable *gtable)
Return the number of table rows.
Definition: gtable.c:156
void g_table_destroy(GTable *gtable)
Free the table and all associated table elements.
Definition: gtable.c:69
void g_table_resize(GTable *gtable, int rows, int cols)
Resize the table, allocating and deallocating extra table members if needed.
Definition: gtable.c:104