GRASS 8 Programmer's Manual 8.5.0RC1(2026)-3334b87d9c
Loading...
Searching...
No Matches
dbfopen.c File Reference
#include "shapefil_private.h"
#include <assert.h>
#include <errno.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <strings.h>
Include dependency graph for dbfopen.c:

Go to the source code of this file.

Macros

#define STRCASECMP(a, b)
#define CPLsprintf   sprintf
#define CPLsnprintf   snprintf
#define FALSE   0
#define TRUE   1
#define XBASE_FILEHDR_SZ   32
#define HEADER_RECORD_TERMINATOR   0x0D
#define END_OF_FILE_CHARACTER   0x1A
#define CPL_IGNORE_RET_VAL_INT(x)

Functions

void DBFUpdateHeader (DBFHandle psDBF)
void DBFSetLastModifiedDate (DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
DBFHandle DBFOpen (const char *pszFilename, const char *pszAccess)
DBFHandle DBFOpenLL (const char *pszFilename, const char *pszAccess, const SAHooks *psHooks)
void DBFClose (DBFHandle psDBF)
DBFHandle DBFCreate (const char *pszFilename)
DBFHandle DBFCreateEx (const char *pszFilename, const char *pszCodePage)
DBFHandle DBFCreateLL (const char *pszFilename, const char *pszCodePage, const SAHooks *psHooks)
int DBFAddField (DBFHandle psDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
int DBFAddNativeFieldType (DBFHandle psDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
int DBFReadIntegerAttribute (DBFHandle psDBF, int iRecord, int iField)
double DBFReadDoubleAttribute (DBFHandle psDBF, int iRecord, int iField)
const char * DBFReadStringAttribute (DBFHandle psDBF, int iRecord, int iField)
const char * DBFReadLogicalAttribute (DBFHandle psDBF, int iRecord, int iField)
SHPDate DBFReadDateAttribute (DBFHandle psDBF, int iRecord, int iField)
int DBFIsAttributeNULL (const DBFHandle psDBF, int iRecord, int iField)
int DBFGetFieldCount (const DBFHandle psDBF)
int DBFGetRecordCount (const DBFHandle psDBF)
DBFFieldType DBFGetFieldInfo (const DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
int DBFWriteAttributeDirectly (DBFHandle psDBF, int hEntity, int iField, const void *pValue)
int DBFWriteDoubleAttribute (DBFHandle psDBF, int iRecord, int iField, double dValue)
int DBFWriteIntegerAttribute (DBFHandle psDBF, int iRecord, int iField, int nValue)
int DBFWriteStringAttribute (DBFHandle psDBF, int iRecord, int iField, const char *pszValue)
int DBFWriteNULLAttribute (DBFHandle psDBF, int iRecord, int iField)
int DBFWriteLogicalAttribute (DBFHandle psDBF, int iRecord, int iField, const char lValue)
int DBFWriteDateAttribute (DBFHandle psDBF, int iRecord, int iField, const SHPDate *lValue)
int DBFWriteTuple (DBFHandle psDBF, int hEntity, const void *pRawTuple)
const char * DBFReadTuple (DBFHandle psDBF, int hEntity)
DBFHandle DBFCloneEmpty (const DBFHandle psDBF, const char *pszFilename)
char DBFGetNativeFieldType (const DBFHandle psDBF, int iField)
int DBFGetFieldIndex (const DBFHandle psDBF, const char *pszFieldName)
int DBFIsRecordDeleted (const DBFHandle psDBF, int iShape)
int DBFMarkRecordDeleted (DBFHandle psDBF, int iShape, int bIsDeleted)
const char * DBFGetCodePage (const DBFHandle psDBF)
int DBFDeleteField (DBFHandle psDBF, int iField)
int DBFReorderFields (DBFHandle psDBF, const int *panMap)
int DBFAlterFieldDefn (DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
void DBFSetWriteEndOfFileChar (DBFHandle psDBF, int bWriteFlag)

Macro Definition Documentation

◆ CPL_IGNORE_RET_VAL_INT

#define CPL_IGNORE_RET_VAL_INT ( x)
Value:
#define x

Definition at line 72 of file dbfopen.c.

Referenced by DBFClose().

◆ CPLsnprintf

#define CPLsnprintf   snprintf

Definition at line 51 of file dbfopen.c.

◆ CPLsprintf

#define CPLsprintf   sprintf

Definition at line 50 of file dbfopen.c.

◆ END_OF_FILE_CHARACTER

#define END_OF_FILE_CHARACTER   0x1A

Definition at line 65 of file dbfopen.c.

Referenced by DBFAddNativeFieldType(), DBFAlterFieldDefn(), and DBFDeleteField().

◆ FALSE

◆ HEADER_RECORD_TERMINATOR

#define HEADER_RECORD_TERMINATOR   0x0D

Definition at line 62 of file dbfopen.c.

Referenced by DBFOpenLL().

◆ STRCASECMP

#define STRCASECMP ( a,
b )
Value:
(strcasecmp(a, b))
double b

Definition at line 36 of file dbfopen.c.

Referenced by DBFGetFieldIndex().

◆ TRUE

◆ XBASE_FILEHDR_SZ

#define XBASE_FILEHDR_SZ   32

Definition at line 60 of file dbfopen.c.

Referenced by DBFCreateLL(), DBFOpenLL(), and DBFUpdateHeader().

Function Documentation

◆ DBFAddField()

int DBFAddField ( DBFHandle psDBF,
const char * pszFieldName,
DBFFieldType eType,
int nWidth,
int nDecimals )

Definition at line 751 of file dbfopen.c.

References DBFAddNativeFieldType(), FTDate, FTLogical, FTString, and SHPAPI_CALL.

◆ DBFAddNativeFieldType()

◆ DBFAlterFieldDefn()

◆ DBFCloneEmpty()

◆ DBFClose()

◆ DBFCreate()

DBFHandle DBFCreate ( const char * pszFilename)

Definition at line 616 of file dbfopen.c.

References DBFCreateEx(), and SHPAPI_CALL.

◆ DBFCreateEx()

DBFHandle DBFCreateEx ( const char * pszFilename,
const char * pszCodePage )

Definition at line 627 of file dbfopen.c.

References DBFCreateLL(), SASetupDefaultHooks(), and SHPAPI_CALL.

Referenced by DBFCreate().

◆ DBFCreateLL()

◆ DBFDeleteField()

◆ DBFGetCodePage()

const char * DBFGetCodePage ( const DBFHandle psDBF)

Definition at line 1834 of file dbfopen.c.

References DBFGetCodePage(), and SHPLIB_NULLPTR.

Referenced by DBFGetCodePage().

◆ DBFGetFieldCount()

int DBFGetFieldCount ( const DBFHandle psDBF)

Definition at line 1253 of file dbfopen.c.

References DBFInfo::nFields, and SHPAPI_CALL.

Referenced by DBFGetFieldIndex().

◆ DBFGetFieldIndex()

int DBFGetFieldIndex ( const DBFHandle psDBF,
const char * pszFieldName )

◆ DBFGetFieldInfo()

DBFFieldType DBFGetFieldInfo ( const DBFHandle psDBF,
int iField,
char * pszFieldName,
int * pnWidth,
int * pnDecimals )

◆ DBFGetNativeFieldType()

char DBFGetNativeFieldType ( const DBFHandle psDBF,
int iField )

Definition at line 1740 of file dbfopen.c.

References DBFInfo::pachFieldType, and SHPAPI_CALL.

◆ DBFGetRecordCount()

int DBFGetRecordCount ( const DBFHandle psDBF)

Definition at line 1264 of file dbfopen.c.

References DBFInfo::nRecords, and SHPAPI_CALL.

◆ DBFIsAttributeNULL()

int DBFIsAttributeNULL ( const DBFHandle psDBF,
int iRecord,
int iField )

◆ DBFIsRecordDeleted()

int DBFIsRecordDeleted ( const DBFHandle psDBF,
int iShape )

Definition at line 1776 of file dbfopen.c.

References FALSE, DBFInfo::nRecords, DBFInfo::pszCurrentRecord, SHPAPI_CALL, and TRUE.

◆ DBFMarkRecordDeleted()

int DBFMarkRecordDeleted ( DBFHandle psDBF,
int iShape,
int bIsDeleted )

◆ DBFOpen()

DBFHandle DBFOpen ( const char * pszFilename,
const char * pszAccess )

Definition at line 300 of file dbfopen.c.

References DBFOpenLL(), SASetupDefaultHooks(), and SHPAPI_CALL.

Referenced by DBFCloneEmpty().

◆ DBFOpenLL()

◆ DBFReadDateAttribute()

SHPDate DBFReadDateAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

◆ DBFReadDoubleAttribute()

double DBFReadDoubleAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

Definition at line 1102 of file dbfopen.c.

References SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadIntegerAttribute()

int DBFReadIntegerAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

Definition at line 1084 of file dbfopen.c.

References SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadLogicalAttribute()

const char * DBFReadLogicalAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

Definition at line 1134 of file dbfopen.c.

References DBFReadLogicalAttribute(), and STATIC_CAST.

Referenced by DBFReadLogicalAttribute().

◆ DBFReadStringAttribute()

const char * DBFReadStringAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

Definition at line 1121 of file dbfopen.c.

References DBFReadStringAttribute(), and STATIC_CAST.

Referenced by DBFIsAttributeNULL(), and DBFReadStringAttribute().

◆ DBFReadTuple()

const char * DBFReadTuple ( DBFHandle psDBF,
int hEntity )

Definition at line 1662 of file dbfopen.c.

References DBFReadTuple(), SHPLIB_NULLPTR, and STATIC_CAST.

Referenced by DBFReadTuple().

◆ DBFReorderFields()

◆ DBFSetLastModifiedDate()

void DBFSetLastModifiedDate ( DBFHandle psDBF,
int nYYSince1900,
int nMM,
int nDD )

◆ DBFSetWriteEndOfFileChar()

void DBFSetWriteEndOfFileChar ( DBFHandle psDBF,
int bWriteFlag )

Definition at line 2357 of file dbfopen.c.

References DBFInfo::bWriteEndOfFileChar, and SHPAPI_CALL.

Referenced by DBFCreateLL(), and DBFOpenLL().

◆ DBFUpdateHeader()

◆ DBFWriteAttributeDirectly()

◆ DBFWriteDateAttribute()

int DBFWriteDateAttribute ( DBFHandle psDBF,
int iRecord,
int iField,
const SHPDate * lValue )

◆ DBFWriteDoubleAttribute()

int DBFWriteDoubleAttribute ( DBFHandle psDBF,
int iRecord,
int iField,
double dValue )

Definition at line 1520 of file dbfopen.c.

References SHPAPI_CALL, and STATIC_CAST.

◆ DBFWriteIntegerAttribute()

int DBFWriteIntegerAttribute ( DBFHandle psDBF,
int iRecord,
int iField,
int nValue )

Definition at line 1533 of file dbfopen.c.

References SHPAPI_CALL, and STATIC_CAST.

◆ DBFWriteLogicalAttribute()

int DBFWriteLogicalAttribute ( DBFHandle psDBF,
int iRecord,
int iField,
const char lValue )

Definition at line 1573 of file dbfopen.c.

References CONST_CAST, SHPAPI_CALL, and STATIC_CAST.

◆ DBFWriteNULLAttribute()

int DBFWriteNULLAttribute ( DBFHandle psDBF,
int iRecord,
int iField )

Definition at line 1562 of file dbfopen.c.

References SHPAPI_CALL, and SHPLIB_NULLPTR.

◆ DBFWriteStringAttribute()

int DBFWriteStringAttribute ( DBFHandle psDBF,
int iRecord,
int iField,
const char * pszValue )

Definition at line 1548 of file dbfopen.c.

References CONST_CAST, SHPAPI_CALL, and STATIC_CAST.

◆ DBFWriteTuple()