File: xbase.h

package info (click to toggle)
gnumeric 1.10.8-1squeeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 90,968 kB
  • ctags: 23,303
  • sloc: ansic: 248,235; xml: 51,894; sh: 10,491; makefile: 2,822; perl: 2,466; yacc: 1,272; python: 205
file content (41 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef GNUMERIC_PLUGIN_XBASE_XBASE_H
#define GNUMERIC_PLUGIN_XBASE_XBASE_H

#include <gnumeric.h>
#include <gsf/gsf.h>

typedef struct { /* field format */
	gchar name[11]; /* name, including terminating '\0' */
	guint8 type; /* type (single ASCII char) */
	guint8 len; /* byte length */
	guint  pos; /* position in record */
	GOFormat *fmt;
} XBfield;

typedef struct { /* database instance */
	GsfInput *input;	/* file handle */
	guint     records; /* number of records */
	guint     fields; /* number of fields */
	guint     fieldlen; /* bytes per record */
	guint     headerlen; /* bytes per record */
	XBfield **format; /* array of (pointers to) field formats */
	gsf_off_t offset; /* start of records in file */
	GIConv	  char_map;
} XBfile;

typedef struct { /* record in a db */
	XBfile *file;
	gsf_off_t row; /* record number : 1 thru file->records are valid */
	guint8 *data; /* private: all fields as binary read from file */
} XBrecord;

XBrecord *record_new  (XBfile *file);
gboolean  record_seek (XBrecord *record, int whence, gsf_off_t row);
void      record_free (XBrecord *record);
gchar	*record_get_field (XBrecord const *record, guint num);
gboolean  record_deleted (XBrecord *record);

XBfile *xbase_open (GsfInput *input, GOErrorInfo **ret_error);
void    xbase_close (XBfile *file);

#endif