shapereader
Read ESRI shapefiles
|
Record.
#include <dbf.h>
Public Member Functions | |
void | dbf_record_bytes (const dbf_record_t *record, const dbf_field_t *field, const char **pbytes, size_t *len) |
Get bytes. More... | |
int | dbf_record_date (const dbf_record_t *record, const dbf_field_t *field, struct tm *tm) |
Get a date. More... | |
int | dbf_record_datetime (const dbf_record_t *record, const dbf_field_t *field, struct tm *tm) |
Get a date and a time. More... | |
int | dbf_record_double (const dbf_record_t *record, const dbf_field_t *field, double *value) |
Get a double value. More... | |
int | dbf_record_int32 (const dbf_record_t *record, const dbf_field_t *field, int32_t *value) |
Get a 32-bit integer value. More... | |
int | dbf_record_int64 (const dbf_record_t *record, const dbf_field_t *field, int64_t *value) |
Get a 64-bit integer value. More... | |
int | dbf_record_is_deleted (const dbf_record_t *record) |
Check if a record is deleted. More... | |
int | dbf_record_is_null (const dbf_record_t *record, const dbf_field_t *field) |
Check if a field is null. More... | |
int | dbf_record_logical (const dbf_record_t *record, const dbf_field_t *field) |
Get a logical value. More... | |
int | dbf_record_logical_is_false (const dbf_record_t *record, const dbf_field_t *field) |
Check if a logical value is false. More... | |
int | dbf_record_logical_is_true (const dbf_record_t *record, const dbf_field_t *field) |
Check if a logical value is true. More... | |
char * | dbf_record_strdup (const dbf_record_t *record, const dbf_field_t *field) |
Duplicate a string. More... | |
void | dbf_record_string (const dbf_record_t *record, const dbf_field_t *field, const char **pstr, size_t *len) |
Get a string. More... | |
int | dbf_record_strtod (const dbf_record_t *record, const dbf_field_t *field, double *value) |
Convert a string to double representation. More... | |
int | dbf_record_strtol (const dbf_record_t *record, const dbf_field_t *field, int base, long *value) |
Convert a string to a long integer. More... | |
int | dbf_record_strtold (const dbf_record_t *record, const dbf_field_t *field, long double *value) |
Convert a string to long double representation. More... | |
int | dbf_record_strtoll (const dbf_record_t *record, const dbf_field_t *field, int base, long long *value) |
Convert a string to a long long integer. More... | |
int | dbf_record_strtoul (const dbf_record_t *record, const dbf_field_t *field, int base, unsigned long *value) |
Convert a string to an unsigned long integer. More... | |
int | dbf_record_strtoull (const dbf_record_t *record, const dbf_field_t *field, int base, unsigned long long *value) |
Convert a string to an unsigned long long integer. More... | |
void dbf_record_bytes | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
const char ** | pbytes, | ||
size_t * | len | ||
) |
Gets the bytes and the number of bytes from a field in a record.
record | a record. | |
field | a field in the record. | |
[out] | pbytes | a pointer to the bytes. |
[out] | len | the number of bytes. |
int dbf_record_date | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
struct tm * | tm | ||
) |
Fills a tm structure with the day, month and year from a date in the format "YYYYMMDD".
The tm_wday member is only valid after 15 October 1582 in the Gregorian calendar.
The tm_isdst member is always set to -1.
record | a record. | |
field | a field in the record. | |
[out] | tm | a tm structure. |
int dbf_record_datetime | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
struct tm * | tm | ||
) |
Fills a tm structure with a date and time from a date and time field.
The tm_isdst member is always set to -1.
record | a record. | |
field | a field in the record. | |
[out] | tm | a tm structure. |
int dbf_record_double | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
double * | value | ||
) |
Gets a floating-point number from a double field.
record | a record. | |
field | a field in the record. | |
[out] | value | the double value. |
int dbf_record_int32 | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int32_t * | value | ||
) |
Gets an integer from an auto-increment or integer field.
record | a record. | |
field | a field in the record. | |
[out] | value | the unscaled value. |
int dbf_record_int64 | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int64_t * | value | ||
) |
Gets an unscaled integer from a currency field. The scale is stored in field->decimal_places.
For example, the decimal fraction 3.45 has the unscaled value 345 and the scale 2.
record | a record. | |
field | a field in the record. | |
[out] | value | the unscaled value. |
int dbf_record_is_deleted | ( | const dbf_record_t * | record | ) |
Returns true if the record is marked as deleted.
record | a record. |
int dbf_record_is_null | ( | const dbf_record_t * | record, |
const dbf_field_t * | field | ||
) |
Returns true if the field contains an empty string, if a number field contains asterisks, if a date field is "00000000" or if a logical field is neither true nor false.
record | a record. |
field | a field in the record. |
int dbf_record_logical | ( | const dbf_record_t * | record, |
const dbf_field_t * | field | ||
) |
Returns the value of a logical field.
Possible values are:
record | a record. |
field | a field in the record. |
int dbf_record_logical_is_false | ( | const dbf_record_t * | record, |
const dbf_field_t * | field | ||
) |
Returns true if a field's value is 'F', 'f', 'N' or 'n'.
A logical value can be true, false or undefined.
record | a record. |
field | a field in the record. |
int dbf_record_logical_is_true | ( | const dbf_record_t * | record, |
const dbf_field_t * | field | ||
) |
Returns true if a field's value is 'T', 't', 'Y' or 'y'.
A logical value can be true, false or undefined.
record | a record. |
field | a field in the record. |
char * dbf_record_strdup | ( | const dbf_record_t * | record, |
const dbf_field_t * | field | ||
) |
Duplicates a string. The string is not decoded to UTF-8.
record | a record. |
field | a field in the record. |
free()
. The function returns NULL if the required memory could not be allocated. void dbf_record_string | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
const char ** | pstr, | ||
size_t * | len | ||
) |
Gets a string and its length. The string is not null-terminated and not decoded to UTF-8.
record | a record. | |
field | a field in the record. | |
[out] | pstr | a pointer to the string. |
[out] | len | the length. |
int dbf_record_strtod | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
double * | value | ||
) |
Converts a numeric string to a floating-point number. Fails if the string does not contain a number.
record | a record. | |
field | a field in the record. | |
[out] | value | the converted value. |
int dbf_record_strtol | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int | base, | ||
long * | value | ||
) |
Converts a numeric string to a long integer. Fails if the string does not contain a number with no decimal places.
record | a record. | |
field | a field in the record. | |
base | 10 for decimal. See strtol(3) for details. | |
[out] | value | the converted value. |
int dbf_record_strtold | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
long double * | value | ||
) |
Converts a numeric string field to a floating-point number. Fails if the string does not contain a number.
record | a record. | |
field | a field in the record. | |
[out] | value | the converted value. |
int dbf_record_strtoll | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int | base, | ||
long long * | value | ||
) |
Converts a numeric string to a long long integer. Fails if the string does not contain a number with no decimal places.
record | a record. | |
field | a field in the record. | |
base | 10 for decimal. See strtol(3) for details. | |
[out] | value | the converted value. |
int dbf_record_strtoul | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int | base, | ||
unsigned long * | value | ||
) |
Converts a numeric string to an unsigned long integer. Fails if the string does not contain a non-negative number with no decimal places.
record | a record. | |
field | a field in the record. | |
base | 10 for decimal. See strtoul(3) for details. | |
[out] | value | the converted value. |
int dbf_record_strtoull | ( | const dbf_record_t * | record, |
const dbf_field_t * | field, | ||
int | base, | ||
unsigned long long * | value | ||
) |
Converts a numeric string to an unsigned long long integer. Fails if the string does not contain a non-negative number with no decimal places.
record | a record. | |
field | a field in the record. | |
base | 10 for decimal. See strtoull(3) for details. | |
[out] | value | the converted value. |