They are defined in src/struct.h.
The first basic structure is not a structure, it is an union defined as :
union data {
GString *str;
int i;
float d;
GDate *date;
gboolean b;
gpointer anything;
}; |
Its main purpose is to hold different fields 'data.
FIXME : write a table with field types (T_*) and corresponding field in union data
typedef struct _record record;
struct _record {
int id;
union data *cont;
struct location *file_loc;
}; |
id is the id of the record (each record has a different id, 0 means that the record is unavailable (deleted, ...)).
cont is an array holding the different's field (therefore it has a size = number of field in the table)
file_loc is used in file operations (loading/saving)
struct _table {
gchar *name;
char short_name[5];
field *fields;
int nb_fields;
record **records;
GList **indexes;
int max_records;
GList *locations;
}; |
name and short_name are the name (and its short version) of the table
fields is an array of size nb_fields filled with field structures (see below).
records is an array of pointer to record structures, the highest array position is given by max_records but there may be NULL pointers in this array (as well as records where id equals 0)
indexes and locations shouldn't be used in plug-ins
struct _field {
gchar *name;
gchar *i18n_name;
field_type type;
property **properties;
GList *ok_if;
}; |
name and i18n_name hold the name (and its translation in the user favorite language) of the field
type holds the type of the field; given by
enum _field_type {
T_STRING = 0,
T_STRINGS = 1,
T_INTEGER = 2,
T_REAL = 3,
T_DATE = 4,
T_BOOLEAN = 5,
T_RECORD = 6,
T_RECORDS = 7,
T_MULTIMEDIA = 8
}; |
properties and ok_if aren't useful :)
struct _subtable {
gchar *name;
gchar *i18n_name;
table *table;
st_field *fields;
int nb_fields;
condition *cond;
}; |
name and i18n_name have the same meaning as for fields
table holds the table from which the subtable is derived
fields holds an array (of size nb_fields) filled with st_field (see below).
cond isn't really for you
struct _st_field {
gchar *name;
gchar *i18n_name;
int no;
field_type type;
GList *link_format;
view *v;
}; |
name and i18n_name have their usual meaning
no holds the index of the field of the table that this field is derived from (is this clear ?). It may be -1 if type is T_RECORDS
type has the same meaning as in field with the extra value T_RECORDS.
link_format and v are used for relations between tables and you don't need to know anything about them