GRASS GIS 8 Programmer's Manual 8.4.1(2025)-45ca3179ab
Loading...
Searching...
No Matches
dbfopen.c File Reference
#include "shapefil.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)
 
#define STATIC_CAST(type, x)
 
#define REINTERPRET_CAST(type, x)
 
#define CONST_CAST(type, x)
 
#define SHPLIB_NULLPTR   NULL
 

Functions

void SHPAPI_CALL DBFUpdateHeader (DBFHandle psDBF)
 
void SHPAPI_CALL DBFSetLastModifiedDate (DBFHandle psDBF, int nYYSince1900, int nMM, int nDD)
 
DBFHandle SHPAPI_CALL DBFOpen (const char *pszFilename, const char *pszAccess)
 
DBFHandle SHPAPI_CALL DBFOpenLL (const char *pszFilename, const char *pszAccess, SAHooks *psHooks)
 
void SHPAPI_CALL DBFClose (DBFHandle psDBF)
 
DBFHandle SHPAPI_CALL DBFCreate (const char *pszFilename)
 
DBFHandle SHPAPI_CALL DBFCreateEx (const char *pszFilename, const char *pszCodePage)
 
DBFHandle SHPAPI_CALL DBFCreateLL (const char *pszFilename, const char *pszCodePage, SAHooks *psHooks)
 
int SHPAPI_CALL DBFAddField (DBFHandle psDBF, const char *pszFieldName, DBFFieldType eType, int nWidth, int nDecimals)
 
int SHPAPI_CALL DBFAddNativeFieldType (DBFHandle psDBF, const char *pszFieldName, char chType, int nWidth, int nDecimals)
 
int SHPAPI_CALL DBFReadIntegerAttribute (DBFHandle psDBF, int iRecord, int iField)
 
double SHPAPI_CALL DBFReadDoubleAttribute (DBFHandle psDBF, int iRecord, int iField)
 
const char SHPAPI_CALL1DBFReadStringAttribute (DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'C')
 
const char SHPAPI_CALL1DBFReadLogicalAttribute (DBFHandle psDBF, int iRecord, int iField){ return STATIC_CAST(const char *, DBFReadAttribute(psDBF, iRecord, iField, 'L')
 
int SHPAPI_CALL DBFIsAttributeNULL (DBFHandle psDBF, int iRecord, int iField)
 
int SHPAPI_CALL DBFGetFieldCount (DBFHandle psDBF)
 
int SHPAPI_CALL DBFGetRecordCount (DBFHandle psDBF)
 
DBFFieldType SHPAPI_CALL DBFGetFieldInfo (DBFHandle psDBF, int iField, char *pszFieldName, int *pnWidth, int *pnDecimals)
 
int SHPAPI_CALL DBFWriteAttributeDirectly (DBFHandle psDBF, int hEntity, int iField, void *pValue)
 
int SHPAPI_CALL DBFWriteDoubleAttribute (DBFHandle psDBF, int iRecord, int iField, double dValue)
 
int SHPAPI_CALL DBFWriteIntegerAttribute (DBFHandle psDBF, int iRecord, int iField, int nValue)
 
int SHPAPI_CALL DBFWriteStringAttribute (DBFHandle psDBF, int iRecord, int iField, const char *pszValue)
 
int SHPAPI_CALL DBFWriteNULLAttribute (DBFHandle psDBF, int iRecord, int iField)
 
int SHPAPI_CALL DBFWriteLogicalAttribute (DBFHandle psDBF, int iRecord, int iField, const char lValue)
 
int SHPAPI_CALL DBFWriteTuple (DBFHandle psDBF, int hEntity, void *pRawTuple)
 
const char SHPAPI_CALL1DBFReadTuple (DBFHandle psDBF, int hEntity){ if(hEntity< 0||hEntity >=psDBF->nRecords) return SHPLIB_NULLPTR;if(!DBFLoadRecord(psDBF, hEntity)) return SHPLIB_NULLPTR;return STATIC_CAST(const char *, psDBF->pszCurrentRecord
 
DBFHandle SHPAPI_CALL DBFCloneEmpty (DBFHandle psDBF, const char *pszFilename)
 
char SHPAPI_CALL DBFGetNativeFieldType (DBFHandle psDBF, int iField)
 
int SHPAPI_CALL DBFGetFieldIndex (DBFHandle psDBF, const char *pszFieldName)
 
int SHPAPI_CALL DBFIsRecordDeleted (DBFHandle psDBF, int iShape)
 
int SHPAPI_CALL DBFMarkRecordDeleted (DBFHandle psDBF, int iShape, int bIsDeleted)
 
const char SHPAPI_CALL1DBFGetCodePage (DBFHandle psDBF){ if(psDBF==SHPLIB_NULLPTR) return SHPLIB_NULLPTR;return psDBF->pszCodePage;}int SHPAPI_CALL DBFDeleteField(DBFHandle psDBF, int iField
 
int SHPAPI_CALL DBFReorderFields (DBFHandle psDBF, int *panMap)
 
int SHPAPI_CALL DBFAlterFieldDefn (DBFHandle psDBF, int iField, const char *pszFieldName, char chType, int nWidth, int nDecimals)
 
void SHPAPI_CALL DBFSetWriteEndOfFileChar (DBFHandle psDBF, int bWriteFlag)
 

Macro Definition Documentation

◆ CONST_CAST

#define CONST_CAST ( type,
x )
Value:
((type)(x))
#define x

Definition at line 102 of file dbfopen.c.

Referenced by DBFCreateLL(), DBFWriteLogicalAttribute(), and DBFWriteStringAttribute().

◆ CPL_IGNORE_RET_VAL_INT

#define CPL_IGNORE_RET_VAL_INT ( x)
Value:

Definition at line 91 of file dbfopen.c.

Referenced by DBFClose().

◆ CPLsnprintf

#define CPLsnprintf   snprintf

Definition at line 68 of file dbfopen.c.

◆ CPLsprintf

#define CPLsprintf   sprintf

Definition at line 67 of file dbfopen.c.

◆ END_OF_FILE_CHARACTER

#define END_OF_FILE_CHARACTER   0x1A

Definition at line 84 of file dbfopen.c.

Referenced by DBFAddNativeFieldType(), and DBFAlterFieldDefn().

◆ FALSE

◆ HEADER_RECORD_TERMINATOR

#define HEADER_RECORD_TERMINATOR   0x0D

Definition at line 81 of file dbfopen.c.

Referenced by DBFOpenLL().

◆ REINTERPRET_CAST

#define REINTERPRET_CAST ( type,
x )
Value:
((type)(x))

Definition at line 101 of file dbfopen.c.

Referenced by DBFOpenLL(), DBFWriteAttributeDirectly(), and DBFWriteTuple().

◆ SHPLIB_NULLPTR

◆ STATIC_CAST

◆ STRCASECMP

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

Definition at line 54 of file dbfopen.c.

Referenced by DBFGetFieldIndex().

◆ TRUE

◆ XBASE_FILEHDR_SZ

#define XBASE_FILEHDR_SZ   32

Definition at line 79 of file dbfopen.c.

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

Function Documentation

◆ DBFAddField()

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

Definition at line 748 of file dbfopen.c.

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

◆ DBFAddNativeFieldType()

◆ DBFAlterFieldDefn()

◆ DBFCloneEmpty()

◆ DBFClose()

◆ DBFCreate()

DBFHandle SHPAPI_CALL DBFCreate ( const char * pszFilename)

Definition at line 620 of file dbfopen.c.

References DBFCreateEx(), and SHPAPI_CALL.

◆ DBFCreateEx()

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

Definition at line 631 of file dbfopen.c.

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

Referenced by DBFCloneEmpty(), and DBFCreate().

◆ DBFCreateLL()

◆ DBFGetCodePage()

const char SHPAPI_CALL1 * DBFGetCodePage ( DBFHandle psDBF)

Definition at line 1730 of file dbfopen.c.

References DBFGetCodePage(), and SHPLIB_NULLPTR.

Referenced by DBFGetCodePage(), and DBFReadTuple().

◆ DBFGetFieldCount()

int SHPAPI_CALL DBFGetFieldCount ( DBFHandle psDBF)

Definition at line 1174 of file dbfopen.c.

References DBFInfo::nFields, and SHPAPI_CALL.

Referenced by DBFGetFieldIndex().

◆ DBFGetFieldIndex()

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

◆ DBFGetFieldInfo()

◆ DBFGetNativeFieldType()

char SHPAPI_CALL DBFGetNativeFieldType ( DBFHandle psDBF,
int iField )

Definition at line 1632 of file dbfopen.c.

References DBFInfo::pachFieldType, and SHPAPI_CALL.

Referenced by DBFReadTuple().

◆ DBFGetRecordCount()

int SHPAPI_CALL DBFGetRecordCount ( DBFHandle psDBF)

Definition at line 1186 of file dbfopen.c.

References DBFInfo::nRecords, and SHPAPI_CALL.

◆ DBFIsAttributeNULL()

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

◆ DBFIsRecordDeleted()

int SHPAPI_CALL DBFIsRecordDeleted ( DBFHandle psDBF,
int iShape )

Definition at line 1668 of file dbfopen.c.

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

Referenced by DBFReadTuple().

◆ DBFMarkRecordDeleted()

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

◆ DBFOpen()

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

Definition at line 346 of file dbfopen.c.

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

Referenced by DBFCloneEmpty().

◆ DBFOpenLL()

◆ DBFReadDoubleAttribute()

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

Definition at line 1068 of file dbfopen.c.

References SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadIntegerAttribute()

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

Definition at line 1050 of file dbfopen.c.

References SHPAPI_CALL, SHPLIB_NULLPTR, and STATIC_CAST.

◆ DBFReadLogicalAttribute()

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

◆ DBFReadStringAttribute()

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

◆ DBFReadTuple()

const char SHPAPI_CALL1 * DBFReadTuple ( DBFHandle psDBF,
int hEntity ) -> nRecords) return SHPLIB_NULLPTR;if(!DBFLoadRecord(psDBF, hEntity)) return SHPLIB_NULLPTR;return STATIC_CAST(const char *, psDBF->pszCurrentRecord

◆ DBFReorderFields()

◆ DBFSetLastModifiedDate()

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

◆ DBFSetWriteEndOfFileChar()

void SHPAPI_CALL DBFSetWriteEndOfFileChar ( DBFHandle psDBF,
int bWriteFlag )

Definition at line 2228 of file dbfopen.c.

References DBFInfo::bWriteEndOfFileChar, and SHPAPI_CALL.

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

◆ DBFUpdateHeader()

◆ DBFWriteAttributeDirectly()

◆ DBFWriteDoubleAttribute()

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

Definition at line 1436 of file dbfopen.c.

References SHPAPI_CALL, and STATIC_CAST.

Referenced by DBFReadStringAttribute().

◆ DBFWriteIntegerAttribute()

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

Definition at line 1449 of file dbfopen.c.

References SHPAPI_CALL, and STATIC_CAST.

Referenced by DBFReadStringAttribute().

◆ DBFWriteLogicalAttribute()

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

Definition at line 1491 of file dbfopen.c.

References CONST_CAST, SHPAPI_CALL, and STATIC_CAST.

Referenced by DBFReadStringAttribute().

◆ DBFWriteNULLAttribute()

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

Definition at line 1479 of file dbfopen.c.

References SHPAPI_CALL, and SHPLIB_NULLPTR.

Referenced by DBFReadStringAttribute().

◆ DBFWriteStringAttribute()

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

Definition at line 1464 of file dbfopen.c.

References CONST_CAST, SHPAPI_CALL, and STATIC_CAST.

Referenced by DBFReadStringAttribute().

◆ DBFWriteTuple()