16#ifndef _SHAPEREADER_DBF_H
17#define _SHAPEREADER_DBF_H
45 DBF_VERSION_VISUAL_FOXPRO_VARIFIELD = 0x32,
154extern void dbf_jd_to_tm(int32_t jd, int32_t jt,
struct tm *tm);
221extern int dbf_record_datetime(
const dbf_record_t *record,
279extern int dbf_record_is_deleted(
const dbf_record_t *record);
293extern int dbf_record_is_null(
const dbf_record_t *record,
312extern int dbf_record_logical(
const dbf_record_t *record,
327extern int dbf_record_logical_is_false(
const dbf_record_t *record,
342extern int dbf_record_logical_is_true(
const dbf_record_t *record,
356extern char *dbf_record_strdup(
const dbf_record_t *record,
371extern void dbf_record_string(
const dbf_record_t *record,
418extern int dbf_record_strtold(
const dbf_record_t *record,
434extern int dbf_record_strtoll(
const dbf_record_t *record,
451extern int dbf_record_strtoul(
const dbf_record_t *record,
453 unsigned long *value);
468extern int dbf_record_strtoull(
const dbf_record_t *record,
470 unsigned long long *value);
479 size_t (*fread)(
struct dbf_file_t *fh,
void *buf,
size_t count);
485 int (*fsetpos)(
struct dbf_file_t *fh,
size_t offset);
522 __attribute__((format(printf, 2, 3)));
dbf_type_t
Field types.
Definition dbf.h:61
@ DBF_TYPE_CHARACTER
String.
Definition dbf.h:69
@ DBF_TYPE_LOGICAL
Logical (1 byte)
Definition dbf.h:85
@ DBF_TYPE_DATE
Date (stored as "YYYYMMDD")
Definition dbf.h:73
@ DBF_TYPE_VARBINARY
Varbinary.
Definition dbf.h:97
@ DBF_TYPE_NUMBER
Number (stored as a string)
Definition dbf.h:91
@ DBF_TYPE_BLOB
Blob (integer stored as a string)
Definition dbf.h:67
@ DBF_TYPE_FLOAT
Number (stored as a string)
Definition dbf.h:79
@ DBF_TYPE_VARCHAR
Varchar.
Definition dbf.h:99
@ DBF_TYPE_AUTOINCREMENT
Autoincrement (4 bytes)
Definition dbf.h:63
@ DBF_TYPE_DOUBLE
Double (8 bytes)
Definition dbf.h:77
@ DBF_TYPE_BINARY_OR_DOUBLE
Binary (integer stored as a string).
Definition dbf.h:65
@ DBF_TYPE_MEMO
Memo (integer stored as a string)
Definition dbf.h:87
@ DBF_TYPE_CURRENCY
Decimal number (8 bytes)
Definition dbf.h:71
@ DBF_TYPE_PICTURE
Picture (integer stored as a string)
Definition dbf.h:93
@ DBF_TYPE_TIMESTAMP
Timestamp (8 bytes)
Definition dbf.h:95
@ DBF_TYPE_INTEGER
Integer (4 bytes)
Definition dbf.h:83
@ DBF_TYPE_NULLFLAGS
_NullFlags (bytes)
Definition dbf.h:89
@ DBF_TYPE_GENERAL
OLE (integer stored as a string)
Definition dbf.h:81
@ DBF_TYPE_DATETIME
Date and time (8 bytes)
Definition dbf.h:75
int dbf_seek_record(dbf_file_t *fh, size_t file_offset, dbf_record_t **precord)
Read a record by record number.
Definition dbf.c:1172
dbf_version_t
Versions.
Definition dbf.h:27
@ DBF_VERSION_VISUAL_OBJECTS_MEMO
Visual Objects with memo file.
Definition dbf.h:49
@ DBF_VERSION_VISUAL_OBJECTS
Visual Objects.
Definition dbf.h:39
@ DBF_VERSION_FOXPRO_MEMO
FoxPro with memo file.
Definition dbf.h:55
@ DBF_VERSION_VISUAL_FOXPRO
Visual FoxPro.
Definition dbf.h:41
@ DBF_VERSION_DBASE4_MEMO
dBase IV with memo file
Definition dbf.h:51
@ DBF_VERSION_DBASE5
dBase V
Definition dbf.h:37
@ DBF_VERSION_DBASE4
dBase IV
Definition dbf.h:35
@ DBF_VERSION_VISUAL_FOXPRO_AUTO
Visual FoxPro with Autoincrement field.
Definition dbf.h:43
@ DBF_VERSION_DBASE3
dBase III
Definition dbf.h:33
@ DBF_VERSION_DBASE2
dBase II
Definition dbf.h:31
@ DBF_VERSION_UNKNOWN
Unknown.
Definition dbf.h:29
@ DBF_VERSION_DBASE3_MEMO
dBase III with memo file
Definition dbf.h:47
@ DBF_VERSION_DBASE7
dBase 7
Definition dbf.h:53
int dbf_yyyymmdd_to_tm(const char *ymd, size_t n, struct tm *tm)
Converts a date string in the format "YYYYMMDD" into a tm structure.
Definition dbf.c:253
int dbf_read(dbf_file_t *fh, dbf_header_callback_t handle_header, dbf_record_callback_t handle_record)
Read a data file.
Definition dbf.c:1200
dbf_file_t * dbf_init_file(dbf_file_t *fh, FILE *stream, void *user_data)
Initialize a file handle.
Definition dbf.c:55
void dbf_set_error(dbf_file_t *fh, const char *format,...)
Set an error message.
Definition dbf.c:75
int(* dbf_record_callback_t)(dbf_file_t *fh, const dbf_header_t *header, const dbf_record_t *record, size_t file_offset)
Handle a record.
Definition dbf.h:554
int(* dbf_header_callback_t)(dbf_file_t *fh, const dbf_header_t *header)
Handle the file header.
Definition dbf.h:538
void dbf_jd_to_tm(int32_t jd, int32_t jt, struct tm *tm)
Convert a Julian date into a tm structure.
Definition dbf.c:195
int dbf_read_record(dbf_file_t *fh, dbf_record_t **precord)
Read a record.
Definition dbf.c:1107
int dbf_read_header(dbf_file_t *fh, dbf_header_t **pheader)
Read the file header.
Definition dbf.c:1060
Field.
Definition dbf.h:105
struct dbf_field_t * next
Next field or NULL.
Definition dbf.h:106
size_t length
Number of bytes.
Definition dbf.h:109
unsigned char reserved[14]
Reserved bytes.
Definition dbf.h:111
char name[32]
Name.
Definition dbf.h:107
size_t decimal_places
Number of decimal places in a number.
Definition dbf.h:110
dbf_type_t type
Type.
Definition dbf.h:108
File handle.
Definition dbf.h:475
char error[128]
Error message.
Definition dbf.h:491
void * user_data
Callback data.
Definition dbf.h:487
size_t num_bytes
Number of bytes read.
Definition dbf.h:489
Record.
Definition dbf.h:135