GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
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)   (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)   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 charDBFReadStringAttribute (DBFHandle psDBF, int iRecord, int iField)
 
const charDBFReadLogicalAttribute (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 charDBFReadTuple (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 charDBFGetCodePage (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)    x

Definition at line 72 of file dbfopen.c.

◆ 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.

◆ FALSE

#define FALSE   0

Definition at line 55 of file dbfopen.c.

◆ HEADER_RECORD_TERMINATOR

#define HEADER_RECORD_TERMINATOR   0x0D

Definition at line 62 of file dbfopen.c.

◆ STRCASECMP

#define STRCASECMP (   a,
  b 
)    (strcasecmp(a, b))

Definition at line 36 of file dbfopen.c.

◆ TRUE

#define TRUE   1

Definition at line 56 of file dbfopen.c.

◆ XBASE_FILEHDR_SZ

#define XBASE_FILEHDR_SZ   32

Definition at line 60 of file dbfopen.c.

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, and FTString.

◆ DBFAddNativeFieldType()

int DBFAddNativeFieldType ( DBFHandle  psDBF,
const char pszFieldName,
char  chType,
int  nWidth,
int  nDecimals 
)

◆ DBFAlterFieldDefn()

int DBFAlterFieldDefn ( DBFHandle  psDBF,
int  iField,
const char pszFieldName,
char  chType,
int  nWidth,
int  nDecimals 
)

◆ DBFCloneEmpty()

DBFHandle DBFCloneEmpty ( const DBFHandle  psDBF,
const char pszFilename 
)

◆ DBFClose()

void DBFClose ( DBFHandle  psDBF)

Definition at line 568 of file dbfopen.c.

References CPL_IGNORE_RET_VAL_INT, DBFUpdateHeader(), UntypedStream::fp, free(), and SHPLIB_NULLPTR.

Referenced by DBFCloneEmpty(), and DBFOpenLL().

◆ DBFCreate()

DBFHandle DBFCreate ( const char pszFilename)

Definition at line 616 of file dbfopen.c.

References DBFCreateEx().

◆ DBFCreateEx()

DBFHandle DBFCreateEx ( const char pszFilename,
const char pszCodePage 
)

Definition at line 627 of file dbfopen.c.

References DBFCreateLL(), and SASetupDefaultHooks().

Referenced by DBFCreate().

◆ DBFCreateLL()

DBFHandle DBFCreateLL ( const char pszFilename,
const char pszCodePage,
const SAHooks psHooks 
)

◆ DBFDeleteField()

int DBFDeleteField ( DBFHandle  psDBF,
int  iField 
)

◆ DBFGetCodePage()

const char * DBFGetCodePage ( const DBFHandle  psDBF)

Definition at line 1834 of file dbfopen.c.

References SHPLIB_NULLPTR.

◆ DBFGetFieldCount()

int DBFGetFieldCount ( const DBFHandle  psDBF)

Definition at line 1253 of file dbfopen.c.

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.

◆ DBFGetRecordCount()

int DBFGetRecordCount ( const DBFHandle  psDBF)

Definition at line 1264 of file dbfopen.c.

◆ DBFIsAttributeNULL()

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

Definition at line 1235 of file dbfopen.c.

References DBFReadStringAttribute(), SHPLIB_NULLPTR, and TRUE.

◆ DBFIsRecordDeleted()

int DBFIsRecordDeleted ( const DBFHandle  psDBF,
int  iShape 
)

Definition at line 1776 of file dbfopen.c.

References FALSE, and TRUE.

◆ DBFMarkRecordDeleted()

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

Definition at line 1800 of file dbfopen.c.

References FALSE, and TRUE.

◆ DBFOpen()

DBFHandle DBFOpen ( const char pszFilename,
const char pszAccess 
)

Definition at line 300 of file dbfopen.c.

References DBFOpenLL(), and SASetupDefaultHooks().

Referenced by DBFCloneEmpty().

◆ DBFOpenLL()

◆ DBFReadDateAttribute()

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

Definition at line 1146 of file dbfopen.c.

References SHPDate::day, SHPDate::month, SHPLIB_NULLPTR, STATIC_CAST, and SHPDate::year.

◆ DBFReadDoubleAttribute()

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

Definition at line 1102 of file dbfopen.c.

References SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadIntegerAttribute()

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

Definition at line 1084 of file dbfopen.c.

References SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadLogicalAttribute()

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

Definition at line 1134 of file dbfopen.c.

References STATIC_CAST.

◆ DBFReadStringAttribute()

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

Definition at line 1121 of file dbfopen.c.

References STATIC_CAST.

Referenced by DBFIsAttributeNULL().

◆ DBFReadTuple()

const char * DBFReadTuple ( DBFHandle  psDBF,
int  hEntity 
)

Definition at line 1662 of file dbfopen.c.

References SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReorderFields()

int DBFReorderFields ( DBFHandle  psDBF,
const int panMap 
)

◆ DBFSetLastModifiedDate()

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

Definition at line 286 of file dbfopen.c.

Referenced by DBFCreateLL(), and DBFOpenLL().

◆ DBFSetWriteEndOfFileChar()

void DBFSetWriteEndOfFileChar ( DBFHandle  psDBF,
int  bWriteFlag 
)

Definition at line 2357 of file dbfopen.c.

Referenced by DBFCreateLL(), and DBFOpenLL().

◆ DBFUpdateHeader()

void DBFUpdateHeader ( DBFHandle  psDBF)

◆ DBFWriteAttributeDirectly()

int DBFWriteAttributeDirectly ( DBFHandle  psDBF,
int  hEntity,
int  iField,
const void pValue 
)

Definition at line 1451 of file dbfopen.c.

References FALSE, REINTERPRET_CAST, STATIC_CAST, and TRUE.

Referenced by DBFWriteDateAttribute().

◆ DBFWriteDateAttribute()

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

Definition at line 1587 of file dbfopen.c.

References DBFWriteAttributeDirectly(), and SHPLIB_NULLPTR.

◆ DBFWriteDoubleAttribute()

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

Definition at line 1520 of file dbfopen.c.

References STATIC_CAST.

◆ DBFWriteIntegerAttribute()

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

Definition at line 1533 of file dbfopen.c.

References 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, and STATIC_CAST.

◆ DBFWriteNULLAttribute()

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

Definition at line 1562 of file dbfopen.c.

References 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, and STATIC_CAST.

◆ DBFWriteTuple()

int DBFWriteTuple ( DBFHandle  psDBF,
int  hEntity,
const void pRawTuple 
)

Definition at line 1611 of file dbfopen.c.

References FALSE, REINTERPRET_CAST, and TRUE.