GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
#include <grass/shapefil.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | CPLsprintf sprintf |
#define | FALSE 0 |
#define | TRUE 1 |
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_CALL1 * | DBFReadStringAttribute (DBFHandle psDBF, int iRecord, int iField){ return((const char *) DBFReadAttribute(psDBF, iRecord, iField, 'C') |
const char SHPAPI_CALL1 * | DBFReadLogicalAttribute (DBFHandle psDBF, int iRecord, int iField){ return((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_CALL1 * | DBFReadTuple (DBFHandle psDBF, int hEntity){ if(hEntity< 0||hEntity >=psDBF->nRecords) return(NULL |
if (!DBFLoadRecord(psDBF, hEntity)) return NULL | |
return (const char *) | |
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_CALL1 * | DBFGetCodePage (DBFHandle psDBF){ if(psDBF==NULL) return NULL;return psDBF->pszCodePage;}int SHPAPI_CALLDBFDeleteField(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) |
#define FALSE 0 |
Definition at line 182 of file dbfopen.c.
Referenced by DBFAlterFieldDefn(), DBFCreateLL(), DBFGetCodePage(), DBFMarkRecordDeleted(), DBFOpenLL(), DBFWriteAttributeDirectly(), and DBFWriteTuple().
#define TRUE 1 |
Definition at line 183 of file dbfopen.c.
Referenced by DBFCreateLL(), DBFIsAttributeNULL(), DBFIsRecordDeleted(), DBFReorderFields(), and return().
int SHPAPI_CALL DBFAddField | ( | DBFHandle | psDBF, |
const char * | pszFieldName, | ||
DBFFieldType | eType, | ||
int | nWidth, | ||
int | nDecimals | ||
) |
Definition at line 809 of file dbfopen.c.
References DBFAddNativeFieldType(), FTLogical, and FTString.
int SHPAPI_CALL DBFAddNativeFieldType | ( | DBFHandle | psDBF, |
const char * | pszFieldName, | ||
char | chType, | ||
int | nWidth, | ||
int | nDecimals | ||
) |
Definition at line 854 of file dbfopen.c.
Referenced by DBFAddField().
int SHPAPI_CALL DBFAlterFieldDefn | ( | DBFHandle | psDBF, |
int | iField, | ||
const char * | pszFieldName, | ||
char | chType, | ||
int | nWidth, | ||
int | nDecimals | ||
) |
Definition at line 2049 of file dbfopen.c.
References FALSE, and DBFInfo::nFields.
void SHPAPI_CALL DBFClose | ( | DBFHandle | psDBF | ) |
Definition at line 612 of file dbfopen.c.
References DBFInfo::bNoHeader, and NULL.
DBFHandle SHPAPI_CALL DBFCreate | ( | const char * | pszFilename | ) |
Definition at line 662 of file dbfopen.c.
References DBFCreateEx(), and SHPAPI_CALL.
DBFHandle SHPAPI_CALL DBFCreateEx | ( | const char * | pszFilename, |
const char * | pszCodePage | ||
) |
Definition at line 675 of file dbfopen.c.
References DBFCreateLL(), SASetupDefaultHooks(), and SHPAPI_CALL.
Referenced by DBFCreate(), and return().
DBFHandle SHPAPI_CALL DBFCreateLL | ( | const char * | pszFilename, |
const char * | pszCodePage, | ||
SAHooks * | psHooks | ||
) |
Definition at line 692 of file dbfopen.c.
References DBFInfo::bCurrentRecordModified, DBFInfo::bNoHeader, DBFSetLastModifiedDate(), FALSE, SAHooks::FClose, SAHooks::FOpen, DBFInfo::fp, free(), SAHooks::FWrite, DBFInfo::iLanguageDriver, malloc(), DBFInfo::nCurrentRecord, DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::nRecords, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCodePage, DBFInfo::pszCurrentRecord, DBFInfo::pszHeader, SAHooks::Remove, DBFInfo::sHooks, SHPAPI_CALL, and TRUE.
Referenced by DBFCreateEx().
const char SHPAPI_CALL1* DBFGetCodePage | ( | DBFHandle | psDBF | ) |
Definition at line 1810 of file dbfopen.c.
References DBFDeleteField(), FALSE, DBFInfo::nFields, NULL, and SHPAPI_CALL.
int SHPAPI_CALL DBFGetFieldCount | ( | DBFHandle | psDBF | ) |
Definition at line 1225 of file dbfopen.c.
References DBFInfo::nFields, and SHPAPI_CALL.
int SHPAPI_CALL DBFGetFieldIndex | ( | DBFHandle | psDBF, |
const char * | pszFieldName | ||
) |
DBFFieldType SHPAPI_CALL DBFGetFieldInfo | ( | DBFHandle | psDBF, |
int | iField, | ||
char * | pszFieldName, | ||
int * | pnWidth, | ||
int * | pnDecimals | ||
) |
Definition at line 1251 of file dbfopen.c.
References FTDouble, FTInteger, FTInvalid, FTLogical, FTString, DBFInfo::nFields, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldSize, and DBFInfo::pszHeader.
char SHPAPI_CALL DBFGetNativeFieldType | ( | DBFHandle | psDBF, |
int | iField | ||
) |
Definition at line 1680 of file dbfopen.c.
References DBFInfo::pachFieldType.
int SHPAPI_CALL DBFGetRecordCount | ( | DBFHandle | psDBF | ) |
Definition at line 1238 of file dbfopen.c.
References DBFInfo::nRecords, and SHPAPI_CALL.
int SHPAPI_CALL DBFIsAttributeNULL | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) |
Definition at line 1205 of file dbfopen.c.
References DBFReadStringAttribute(), NULL, and TRUE.
int SHPAPI_CALL DBFIsRecordDeleted | ( | DBFHandle | psDBF, |
int | iShape | ||
) |
Definition at line 1743 of file dbfopen.c.
References DBFInfo::nRecords, and TRUE.
int SHPAPI_CALL DBFMarkRecordDeleted | ( | DBFHandle | psDBF, |
int | iShape, | ||
int | bIsDeleted | ||
) |
Definition at line 1768 of file dbfopen.c.
References FALSE, and DBFInfo::nRecords.
DBFHandle SHPAPI_CALL DBFOpen | ( | const char * | pszFilename, |
const char * | pszAccess | ||
) |
Definition at line 395 of file dbfopen.c.
References DBFOpenLL(), SASetupDefaultHooks(), and SHPAPI_CALL.
DBFHandle SHPAPI_CALL DBFOpenLL | ( | const char * | pszFilename, |
const char * | pszAccess, | ||
SAHooks * | psHooks | ||
) |
Definition at line 412 of file dbfopen.c.
References DBFInfo::bCurrentRecordModified, DBFInfo::bNoHeader, DBFSetLastModifiedDate(), FALSE, SAHooks::FClose, SAHooks::FOpen, DBFInfo::fp, SAHooks::FRead, free(), DBFInfo::iLanguageDriver, malloc(), DBFInfo::nCurrentRecord, DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, DBFInfo::nRecords, NULL, DBFInfo::pszCodePage, DBFInfo::pszCurrentRecord, and DBFInfo::sHooks.
Referenced by DBFOpen().
double SHPAPI_CALL DBFReadDoubleAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) |
int SHPAPI_CALL DBFReadIntegerAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) |
const char SHPAPI_CALL1* DBFReadLogicalAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) | const |
const char SHPAPI_CALL1* DBFReadStringAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) | const |
Referenced by DBFIsAttributeNULL().
const char SHPAPI_CALL1* DBFReadTuple | ( | DBFHandle | psDBF, |
int | hEntity | ||
) | -> nRecords) return(NULL |
int SHPAPI_CALL DBFReorderFields | ( | DBFHandle | psDBF, |
int * | panMap | ||
) |
Definition at line 1940 of file dbfopen.c.
References DBFInfo::nFields, and TRUE.
void SHPAPI_CALL DBFSetLastModifiedDate | ( | DBFHandle | psDBF, |
int | nYYSince1900, | ||
int | nMM, | ||
int | nDD | ||
) |
Definition at line 381 of file dbfopen.c.
References DBFInfo::nUpdateDay, DBFInfo::nUpdateMonth, DBFInfo::nUpdateYearSince1900, and SHPAPI_CALL.
Referenced by DBFCreateLL(), and DBFOpenLL().
void SHPAPI_CALL DBFUpdateHeader | ( | DBFHandle | psDBF | ) |
Definition at line 348 of file dbfopen.c.
References DBFInfo::bNoHeader.
int SHPAPI_CALL DBFWriteAttributeDirectly | ( | DBFHandle | psDBF, |
int | hEntity, | ||
int | iField, | ||
void * | pValue | ||
) |
Definition at line 1418 of file dbfopen.c.
References DBFInfo::bNoHeader, FALSE, and DBFInfo::nRecords.
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 DBFWriteLogicalAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField, | ||
const char | lValue | ||
) |
int SHPAPI_CALL DBFWriteNULLAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField | ||
) |
int SHPAPI_CALL DBFWriteStringAttribute | ( | DBFHandle | psDBF, |
int | iRecord, | ||
int | iField, | ||
const char * | pszValue | ||
) |
int SHPAPI_CALL DBFWriteTuple | ( | DBFHandle | psDBF, |
int | hEntity, | ||
void * | pRawTuple | ||
) |
Definition at line 1557 of file dbfopen.c.
References DBFInfo::bNoHeader, FALSE, and DBFInfo::nRecords.
if | ( | ! | DBFLoadRecordpsDBF, hEntity | ) |
return | ( | const char * | ) |
Definition at line 1621 of file dbfopen.c.
References DBFInfo::bNoHeader, DBFInfo::bUpdated, DBFCreateEx(), malloc(), DBFInfo::nFields, DBFInfo::nHeaderLength, DBFInfo::nRecordLength, NULL, DBFInfo::pachFieldType, DBFInfo::panFieldDecimals, DBFInfo::panFieldOffset, DBFInfo::panFieldSize, DBFInfo::pszCodePage, DBFInfo::pszHeader, TRUE, and XBASE_FLDHDR_SZ.
Referenced by gvl_file_set_slices_param().