1 #ifndef SHAPEFILE_H_INCLUDED
2 #define SHAPEFILE_H_INCLUDED
3 
4 /******************************************************************************
5  * $Id: shapefil.h 28337 2015-01-21 21:10:33Z rouault $
6  *
7  * Project:  Shapelib
8  * Purpose:  Primary include file for Shapelib.
9  * Author:   Frank Warmerdam, warmerdam@pobox.com
10  *
11  ******************************************************************************
12  * Copyright (c) 1999, Frank Warmerdam
13  * Copyright (c) 2012-2013, Even Rouault <even dot rouault at mines-paris dot org>
14  *
15  * This software is available under the following "MIT Style" license,
16  * or at the option of the licensee under the LGPL (see LICENSE.LGPL).  This
17  * option is discussed in more detail in shapelib.html.
18  *
19  * --
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining a
22  * copy of this software and associated documentation files (the "Software"),
23  * to deal in the Software without restriction, including without limitation
24  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
25  * and/or sell copies of the Software, and to permit persons to whom the
26  * Software is furnished to do so, subject to the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be included
29  * in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
37  * DEALINGS IN THE SOFTWARE.
38  ******************************************************************************
39  *
40  * $Log: shapefil.h,v $
41  * Revision 1.52  2011-12-11 22:26:46  fwarmerdam
42  * upgrade .qix access code to use SAHooks (gdal #3365)
43  *
44  * Revision 1.51  2011-07-24 05:59:25  fwarmerdam
45  * minimize use of CPLError in favor of SAHooks.Error()
46  *
47  * Revision 1.50  2011-05-13 17:35:17  fwarmerdam
48  * added DBFReorderFields() and DBFAlterFields() functions (from Even)
49  *
50  * Revision 1.49  2011-04-16 14:38:21  fwarmerdam
51  * avoid warnings with gcc on SHP_CVSID
52  *
53  * Revision 1.48  2010-08-27 23:42:52  fwarmerdam
54  * add SHPAPI_CALL attribute in code
55  *
56  * Revision 1.47  2010-01-28 11:34:34  fwarmerdam
57  * handle the shape file length limits more gracefully (#3236)
58  *
59  * Revision 1.46  2008-11-12 14:28:15  fwarmerdam
60  * DBFCreateField() now works on files with records
61  *
62  * Revision 1.45  2008/11/11 17:47:10  fwarmerdam
63  * added DBFDeleteField() function
64  *
65  * Revision 1.44  2008/01/16 20:05:19  bram
66  * Add file hooks that accept UTF-8 encoded filenames on some platforms.  Use SASetupUtf8Hooks
67  *  tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability.  Currently, this
68  *  is only available on the Windows platform that decodes the UTF-8 filenames to wide
69  *  character strings and feeds them to _wfopen and _wremove.
70  *
71  * Revision 1.43  2008/01/10 16:35:30  fwarmerdam
72  * avoid _ prefix on #defined symbols (bug 1840)
73  *
74  * Revision 1.42  2007/12/18 18:28:14  bram
75  * - create hook for client specific atof (bugzilla ticket 1615)
76  * - check for NULL handle before closing cpCPG file, and close after reading.
77  *
78  * Revision 1.41  2007/12/15 20:25:32  bram
79  * dbfopen.c now reads the Code Page information from the DBF file, and exports
80  * this information as a string through the DBFGetCodePage function.  This is
81  * either the number from the LDID header field ("LDID/<number>") or as the
82  * content of an accompanying .CPG file.  When creating a DBF file, the code can
83  * be set using DBFCreateEx.
84  *
85  * Revision 1.40  2007/12/06 07:00:25  fwarmerdam
86  * dbfopen now using SAHooks for fileio
87  *
88  * Revision 1.39  2007/12/04 20:37:56  fwarmerdam
89  * preliminary implementation of hooks api for io and errors
90  *
91  * Revision 1.38  2007/11/21 22:39:56  fwarmerdam
92  * close shx file in readonly mode (GDAL #1956)
93  *
94  * Revision 1.37  2007/10/27 03:31:14  fwarmerdam
95  * limit default depth of tree to 12 levels (gdal ticket #1594)
96  *
97  * Revision 1.36  2007/09/10 23:33:15  fwarmerdam
98  * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
99  * of GDAL (gdal ticket #1810).
100  *
101  * Revision 1.35  2007/09/03 19:48:10  fwarmerdam
102  * move DBFReadAttribute() static dDoubleField into dbfinfo
103  *
104  * Revision 1.34  2006/06/17 15:33:32  fwarmerdam
105  * added pszWorkField - bug 1202 (rso)
106  *
107  * Revision 1.33  2006/02/15 01:14:30  fwarmerdam
108  * added DBFAddNativeFieldType
109  *
110  * Revision 1.32  2006/01/26 15:07:32  fwarmerdam
111  * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
112  *
113  * Revision 1.31  2006/01/05 01:27:27  fwarmerdam
114  * added dbf deletion mark/fetch
115  *
116  * Revision 1.30  2005/01/03 22:30:13  fwarmerdam
117  * added support for saved quadtrees
118  *
119  * Revision 1.29  2004/09/26 20:09:35  fwarmerdam
120  * avoid rcsid warnings
121  *
122  * Revision 1.28  2003/12/29 06:02:18  fwarmerdam
123  * added cpl_error.h option
124  *
125  * Revision 1.27  2003/04/21 18:30:37  warmerda
126  * added header write/update public methods
127  *
128  * Revision 1.26  2002/09/29 00:00:08  warmerda
129  * added FTLogical and logical attribute read/write calls
130  *
131  * Revision 1.25  2002/05/07 13:46:30  warmerda
132  * added DBFWriteAttributeDirectly().
133  *
134  * Revision 1.24  2002/04/10 16:59:54  warmerda
135  * added SHPRewindObject
136  *
137  * Revision 1.23  2002/01/15 14:36:07  warmerda
138  * updated email address
139  *
140  * Revision 1.22  2002/01/15 14:32:00  warmerda
141  * try to improve SHPAPI_CALL docs
142  */
143 
144 #include <stdio.h>
145 
146 #ifdef USE_DBMALLOC
147 #include <dbmalloc.h>
148 #endif
149 
150 #ifdef USE_CPL
151 #include "cpl_conv.h"
152 #endif
153 
154 #ifdef __cplusplus
155 extern "C" {
156 #endif
157 
158 /************************************************************************/
159 /*                        Configuration options.                        */
160 /************************************************************************/
161 
162 /* -------------------------------------------------------------------- */
163 /*      Should the DBFReadStringAttribute() strip leading and           */
164 /*      trailing white space?                                           */
165 /* -------------------------------------------------------------------- */
166 #define TRIM_DBF_WHITESPACE
167 
168 /* -------------------------------------------------------------------- */
169 /*      Should we write measure values to the Multipatch object?        */
170 /*      Reportedly ArcView crashes if we do write it, so for now it     */
171 /*      is disabled.                                                    */
172 /* -------------------------------------------------------------------- */
173 #define DISABLE_MULTIPATCH_MEASURE
174 
175 /* -------------------------------------------------------------------- */
176 /*      SHPAPI_CALL                                                     */
177 /*                                                                      */
178 /*      The following two macros are present to allow forcing           */
179 /*      various calling conventions on the Shapelib API.                */
180 /*                                                                      */
181 /*      To force __stdcall conventions (needed to call Shapelib         */
182 /*      from Visual Basic and/or Dephi I believe) the makefile could    */
183 /*      be modified to define:                                          */
184 /*                                                                      */
185 /*        /DSHPAPI_CALL=__stdcall                                       */
186 /*                                                                      */
187 /*      If it is desired to force export of the Shapelib API without    */
188 /*      using the shapelib.def file, use the following definition.      */
189 /*                                                                      */
190 /*        /DSHAPELIB_DLLEXPORT                                          */
191 /*                                                                      */
192 /*      To get both at once it will be necessary to hack this           */
193 /*      include file to define:                                         */
194 /*                                                                      */
195 /*        #define SHPAPI_CALL __declspec(dllexport) __stdcall           */
196 /*        #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall        */
197 /*                                                                      */
198 /*      The complexity of the situtation is partly caused by the        */
199 /*      peculiar requirement of Visual C++ that __stdcall appear        */
200 /*      after any "*"'s in the return value of a function while the     */
201 /*      __declspec(dllexport) must appear before them.                  */
202 /* -------------------------------------------------------------------- */
203 
204 #ifdef SHAPELIB_DLLEXPORT
205 #  define SHPAPI_CALL __declspec(dllexport)
206 #  define SHPAPI_CALL1(x)  __declspec(dllexport) x
207 #endif
208 
209 #ifndef SHPAPI_CALL
210 #  if defined(USE_GCC_VISIBILITY_FLAG)
211 #    define SHPAPI_CALL     __attribute__ ((visibility("default")))
212 #    define SHPAPI_CALL1(x) __attribute__ ((visibility("default")))     x
213 #  else
214 #    define SHPAPI_CALL
215 #  endif
216 #endif
217 
218 #ifndef SHPAPI_CALL1
219 #  define SHPAPI_CALL1(x)      x SHPAPI_CALL
220 #endif
221 
222 /* -------------------------------------------------------------------- */
223 /*      Macros for controlling CVSID and ensuring they don't appear     */
224 /*      as unreferenced variables resulting in lots of warnings.        */
225 /* -------------------------------------------------------------------- */
226 #ifndef DISABLE_CVSID
227 #  if defined(__GNUC__) && __GNUC__ >= 4
228 #    define SHP_CVSID(string)     static char cpl_cvsid[] __attribute__((used)) = string;
229 #  else
230 #    define SHP_CVSID(string)     static char cpl_cvsid[] = string; \
231 static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
232 #  endif
233 #else
234 #  define SHP_CVSID(string)
235 #endif
236 
237 /* -------------------------------------------------------------------- */
238 /*      On some platforms, additional file IO hooks are defined that    */
239 /*      UTF-8 encoded filenames Unicode filenames                       */
240 /* -------------------------------------------------------------------- */
241 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
242 #	define SHPAPI_WINDOWS
243 #	define SHPAPI_UTF8_HOOKS
244 #endif
245 
246 /* -------------------------------------------------------------------- */
247 /*      IO/Error hook functions.                                        */
248 /* -------------------------------------------------------------------- */
249 typedef int *SAFile;
250 
251 #ifndef SAOffset
252 typedef unsigned long SAOffset;
253 #endif
254 
255 typedef struct {
256     SAFile     (*FOpen) ( const char *filename, const char *access);
257     SAOffset   (*FRead) ( void *p, SAOffset size, SAOffset nmemb, SAFile file);
258     SAOffset   (*FWrite)( void *p, SAOffset size, SAOffset nmemb, SAFile file);
259     SAOffset   (*FSeek) ( SAFile file, SAOffset offset, int whence );
260     SAOffset   (*FTell) ( SAFile file );
261     int        (*FFlush)( SAFile file );
262     int        (*FClose)( SAFile file );
263     int        (*Remove) ( const char *filename );
264 
265     void       (*Error) ( const char *message );
266     double     (*Atof)  ( const char *str );
267 } SAHooks;
268 
269 void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
270 #ifdef SHPAPI_UTF8_HOOKS
271 void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
272 #endif
273 
274 /************************************************************************/
275 /*                             SHP Support.                             */
276 /************************************************************************/
277 typedef struct tagSHPObject SHPObject;
278 
279 typedef struct
280 {
281     SAHooks sHooks;
282 
283     SAFile      fpSHP;
284     SAFile 	fpSHX;
285 
286     int		nShapeType;				/* SHPT_* */
287 
288     unsigned int 	nFileSize;				/* SHP file */
289 
290     int         nRecords;
291     int		nMaxRecords;
292     unsigned int		*panRecOffset;
293     unsigned int		*panRecSize;
294 
295     double	adBoundsMin[4];
296     double	adBoundsMax[4];
297 
298     int		bUpdated;
299 
300     unsigned char *pabyRec;
301     int         nBufSize;
302 
303     int            bFastModeReadObject;
304     unsigned char *pabyObjectBuf;
305     int            nObjectBufSize;
306     SHPObject*     psCachedObject;
307 } SHPInfo;
308 
309 typedef SHPInfo * SHPHandle;
310 
311 /* -------------------------------------------------------------------- */
312 /*      Shape types (nSHPType)                                          */
313 /* -------------------------------------------------------------------- */
314 #define SHPT_NULL	0
315 #define SHPT_POINT	1
316 #define SHPT_ARC	3
317 #define SHPT_POLYGON	5
318 #define SHPT_MULTIPOINT	8
319 #define SHPT_POINTZ	11
320 #define SHPT_ARCZ	13
321 #define SHPT_POLYGONZ	15
322 #define SHPT_MULTIPOINTZ 18
323 #define SHPT_POINTM	21
324 #define SHPT_ARCM	23
325 #define SHPT_POLYGONM	25
326 #define SHPT_MULTIPOINTM 28
327 #define SHPT_MULTIPATCH 31
328 
329 
330 /* -------------------------------------------------------------------- */
331 /*      Part types - everything but SHPT_MULTIPATCH just uses           */
332 /*      SHPP_RING.                                                      */
333 /* -------------------------------------------------------------------- */
334 
335 #define SHPP_TRISTRIP	0
336 #define SHPP_TRIFAN	1
337 #define SHPP_OUTERRING	2
338 #define SHPP_INNERRING	3
339 #define SHPP_FIRSTRING	4
340 #define SHPP_RING	5
341 
342 /* -------------------------------------------------------------------- */
343 /*      SHPObject - represents on shape (without attributes) read       */
344 /*      from the .shp file.                                             */
345 /* -------------------------------------------------------------------- */
346 struct tagSHPObject
347 {
348     int		nSHPType;
349 
350     int		nShapeId; /* -1 is unknown/unassigned */
351 
352     int		nParts;
353     int		*panPartStart;
354     int		*panPartType;
355 
356     int		nVertices;
357     double	*padfX;
358     double	*padfY;
359     double	*padfZ;
360     double	*padfM;
361 
362     double	dfXMin;
363     double	dfYMin;
364     double	dfZMin;
365     double	dfMMin;
366 
367     double	dfXMax;
368     double	dfYMax;
369     double	dfZMax;
370     double	dfMMax;
371 
372     int		bMeasureIsUsed;
373     int     bFastModeReadObject;
374 };
375 
376 /* -------------------------------------------------------------------- */
377 /*      SHP API Prototypes                                              */
378 /* -------------------------------------------------------------------- */
379 
380 /* If pszAccess is read-only, the fpSHX field of the returned structure */
381 /* will be NULL as it is not necessary to keep the SHX file open */
382 SHPHandle SHPAPI_CALL
383       SHPOpen( const char * pszShapeFile, const char * pszAccess );
384 SHPHandle SHPAPI_CALL
385       SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
386                  SAHooks *psHooks );
387 
388 /* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the SHPHandle. */
389 /* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
390 /* The SHPObject padfZ and padfM members may be NULL depending on the geometry */
391 /* type. It is illegal to free at hand any of the pointer members of the SHPObject structure */
392 void SHPAPI_CALL SHPSetFastModeReadObject( SHPHandle hSHP, int bFastMode );
393 
394 SHPHandle SHPAPI_CALL
395       SHPCreate( const char * pszShapeFile, int nShapeType );
396 SHPHandle SHPAPI_CALL
397       SHPCreateLL( const char * pszShapeFile, int nShapeType,
398                    SAHooks *psHooks );
399 void SHPAPI_CALL
400       SHPGetInfo( SHPHandle hSHP, int * pnEntities, int * pnShapeType,
401                   double * padfMinBound, double * padfMaxBound );
402 
403 SHPObject SHPAPI_CALL1(*)
404       SHPReadObject( SHPHandle hSHP, int iShape );
405 int SHPAPI_CALL
406       SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject * psObject );
407 
408 void SHPAPI_CALL
409       SHPDestroyObject( SHPObject * psObject );
410 void SHPAPI_CALL
411       SHPComputeExtents( SHPObject * psObject );
412 SHPObject SHPAPI_CALL1(*)
413       SHPCreateObject( int nSHPType, int nShapeId, int nParts,
414                        const int * panPartStart, const int * panPartType,
415                        int nVertices,
416                        const double * padfX, const double * padfY,
417                        const double * padfZ, const double * padfM );
418 SHPObject SHPAPI_CALL1(*)
419       SHPCreateSimpleObject( int nSHPType, int nVertices,
420                              const double * padfX,
421                              const double * padfY,
422                              const double * padfZ );
423 
424 int SHPAPI_CALL
425       SHPRewindObject( SHPHandle hSHP, SHPObject * psObject );
426 
427 void SHPAPI_CALL SHPClose( SHPHandle hSHP );
428 void SHPAPI_CALL SHPWriteHeader( SHPHandle hSHP );
429 
430 const char SHPAPI_CALL1(*)
431       SHPTypeName( int nSHPType );
432 const char SHPAPI_CALL1(*)
433       SHPPartTypeName( int nPartType );
434 
435 /* -------------------------------------------------------------------- */
436 /*      Shape quadtree indexing API.                                    */
437 /* -------------------------------------------------------------------- */
438 
439 /* this can be two or four for binary or quad tree */
440 #define MAX_SUBNODE	4
441 
442 /* upper limit of tree levels for automatic estimation */
443 #define MAX_DEFAULT_TREE_DEPTH 12
444 
445 typedef struct shape_tree_node
446 {
447     /* region covered by this node */
448     double	adfBoundsMin[4];
449     double	adfBoundsMax[4];
450 
451     /* list of shapes stored at this node.  The papsShapeObj pointers
452        or the whole list can be NULL */
453     int		nShapeCount;
454     int		*panShapeIds;
455     SHPObject   **papsShapeObj;
456 
457     int		nSubNodes;
458     struct shape_tree_node *apsSubNode[MAX_SUBNODE];
459 
460 } SHPTreeNode;
461 
462 typedef struct
463 {
464     SHPHandle   hSHP;
465 
466     int		nMaxDepth;
467     int		nDimension;
468     int         nTotalCount;
469 
470     SHPTreeNode	*psRoot;
471 } SHPTree;
472 
473 SHPTree SHPAPI_CALL1(*)
474       SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
475                      double *padfBoundsMin, double *padfBoundsMax );
476 void    SHPAPI_CALL
477       SHPDestroyTree( SHPTree * hTree );
478 
479 int	SHPAPI_CALL
480       SHPWriteTree( SHPTree *hTree, const char * pszFilename );
481 
482 int	SHPAPI_CALL
483       SHPTreeAddShapeId( SHPTree * hTree, SHPObject * psObject );
484 int	SHPAPI_CALL
485       SHPTreeRemoveShapeId( SHPTree * hTree, int nShapeId );
486 
487 void 	SHPAPI_CALL
488       SHPTreeTrimExtraNodes( SHPTree * hTree );
489 
490 int    SHPAPI_CALL1(*)
491       SHPTreeFindLikelyShapes( SHPTree * hTree,
492                                double * padfBoundsMin,
493                                double * padfBoundsMax,
494                                int * );
495 int     SHPAPI_CALL
496       SHPCheckBoundsOverlap( double *, double *, double *, double *, int );
497 
498 int SHPAPI_CALL1(*)
499 SHPSearchDiskTree( FILE *fp,
500                    double *padfBoundsMin, double *padfBoundsMax,
501                    int *pnShapeCount );
502 
503 
504 typedef struct SHPDiskTreeInfo* SHPTreeDiskHandle;
505 
506 SHPTreeDiskHandle SHPAPI_CALL
507     SHPOpenDiskTree( const char* pszQIXFilename,
508                      SAHooks *psHooks );
509 
510 void SHPAPI_CALL
511     SHPCloseDiskTree( SHPTreeDiskHandle hDiskTree );
512 
513 int SHPAPI_CALL1(*)
514 SHPSearchDiskTreeEx( SHPTreeDiskHandle hDiskTree,
515                    double *padfBoundsMin, double *padfBoundsMax,
516                    int *pnShapeCount );
517 
518 int SHPAPI_CALL
519     SHPWriteTreeLL(SHPTree *hTree, const char *pszFilename, SAHooks *psHooks );
520 
521 
522 /* -------------------------------------------------------------------- */
523 /*      SBN Search API                                                  */
524 /* -------------------------------------------------------------------- */
525 
526 typedef struct SBNSearchInfo* SBNSearchHandle;
527 
528 SBNSearchHandle SHPAPI_CALL
529     SBNOpenDiskTree( const char* pszSBNFilename,
530                  SAHooks *psHooks );
531 
532 void SHPAPI_CALL
533     SBNCloseDiskTree( SBNSearchHandle hSBN );
534 
535 int SHPAPI_CALL1(*)
536 SBNSearchDiskTree( SBNSearchHandle hSBN,
537                    double *padfBoundsMin, double *padfBoundsMax,
538                    int *pnShapeCount );
539 
540 int SHPAPI_CALL1(*)
541 SBNSearchDiskTreeInteger( SBNSearchHandle hSBN,
542                           int bMinX, int bMinY, int bMaxX, int bMaxY,
543                           int *pnShapeCount );
544 
545 void SHPAPI_CALL SBNSearchFreeIds( int* panShapeId );
546 
547 /************************************************************************/
548 /*                             DBF Support.                             */
549 /************************************************************************/
550 typedef	struct
551 {
552     SAHooks sHooks;
553 
554     SAFile	fp;
555 
556     int         nRecords;
557 
558     int		nRecordLength;
559     int		nHeaderLength;
560     int		nFields;
561     int		*panFieldOffset;
562     int		*panFieldSize;
563     int		*panFieldDecimals;
564     char	*pachFieldType;
565 
566     char	*pszHeader;
567 
568     int		nCurrentRecord;
569     int		bCurrentRecordModified;
570     char	*pszCurrentRecord;
571 
572     int         nWorkFieldLength;
573     char        *pszWorkField;
574 
575     int		bNoHeader;
576     int		bUpdated;
577 
578     union
579     {
580         double      dfDoubleField;
581         int         nIntField;
582     } fieldValue;
583 
584     int         iLanguageDriver;
585     char        *pszCodePage;
586 
587     int         nUpdateYearSince1900; /* 0-255 */
588     int         nUpdateMonth; /* 1-12 */
589     int         nUpdateDay; /* 1-31 */
590 } DBFInfo;
591 
592 typedef DBFInfo * DBFHandle;
593 
594 typedef enum {
595   FTString,
596   FTInteger,
597   FTDouble,
598   FTLogical,
599   FTInvalid
600 } DBFFieldType;
601 
602 #define XBASE_FLDHDR_SZ       32
603 
604 
605 DBFHandle SHPAPI_CALL
606       DBFOpen( const char * pszDBFFile, const char * pszAccess );
607 DBFHandle SHPAPI_CALL
608       DBFOpenLL( const char * pszDBFFile, const char * pszAccess,
609                  SAHooks *psHooks );
610 DBFHandle SHPAPI_CALL
611       DBFCreate( const char * pszDBFFile );
612 DBFHandle SHPAPI_CALL
613       DBFCreateEx( const char * pszDBFFile, const char * pszCodePage );
614 DBFHandle SHPAPI_CALL
615       DBFCreateLL( const char * pszDBFFile, const char * pszCodePage, SAHooks *psHooks );
616 
617 int	SHPAPI_CALL
618       DBFGetFieldCount( DBFHandle psDBF );
619 int	SHPAPI_CALL
620       DBFGetRecordCount( DBFHandle psDBF );
621 int	SHPAPI_CALL
622       DBFAddField( DBFHandle hDBF, const char * pszFieldName,
623                    DBFFieldType eType, int nWidth, int nDecimals );
624 
625 int	SHPAPI_CALL
626       DBFAddNativeFieldType( DBFHandle hDBF, const char * pszFieldName,
627                              char chType, int nWidth, int nDecimals );
628 
629 int	SHPAPI_CALL
630       DBFDeleteField( DBFHandle hDBF, int iField );
631 
632 int SHPAPI_CALL
633       DBFReorderFields( DBFHandle psDBF, int* panMap );
634 
635 int SHPAPI_CALL
636       DBFAlterFieldDefn( DBFHandle psDBF, int iField, const char * pszFieldName,
637                          char chType, int nWidth, int nDecimals );
638 
639 DBFFieldType SHPAPI_CALL
640       DBFGetFieldInfo( DBFHandle psDBF, int iField,
641                        char * pszFieldName, int * pnWidth, int * pnDecimals );
642 
643 int SHPAPI_CALL
644       DBFGetFieldIndex(DBFHandle psDBF, const char *pszFieldName);
645 
646 int 	SHPAPI_CALL
647       DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField );
648 double 	SHPAPI_CALL
649       DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField );
650 const char SHPAPI_CALL1(*)
651       DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField );
652 const char SHPAPI_CALL1(*)
653       DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField );
654 int     SHPAPI_CALL
655       DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField );
656 
657 int SHPAPI_CALL
658       DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField,
659                                 int nFieldValue );
660 int SHPAPI_CALL
661       DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
662                                double dFieldValue );
663 int SHPAPI_CALL
664       DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
665                                const char * pszFieldValue );
666 int SHPAPI_CALL
667      DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField );
668 
669 int SHPAPI_CALL
670      DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
671 			       const char lFieldValue);
672 int SHPAPI_CALL
673      DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
674                                void * pValue );
675 const char SHPAPI_CALL1(*)
676       DBFReadTuple(DBFHandle psDBF, int hEntity );
677 int SHPAPI_CALL
678       DBFWriteTuple(DBFHandle psDBF, int hEntity, void * pRawTuple );
679 
680 int SHPAPI_CALL DBFIsRecordDeleted( DBFHandle psDBF, int iShape );
681 int SHPAPI_CALL DBFMarkRecordDeleted( DBFHandle psDBF, int iShape,
682                                       int bIsDeleted );
683 
684 DBFHandle SHPAPI_CALL
685       DBFCloneEmpty(DBFHandle psDBF, const char * pszFilename );
686 
687 void	SHPAPI_CALL
688       DBFClose( DBFHandle hDBF );
689 void    SHPAPI_CALL
690       DBFUpdateHeader( DBFHandle hDBF );
691 char    SHPAPI_CALL
692       DBFGetNativeFieldType( DBFHandle hDBF, int iField );
693 
694 const char SHPAPI_CALL1(*)
695       DBFGetCodePage(DBFHandle psDBF );
696 
697 void SHPAPI_CALL
698     DBFSetLastModifiedDate( DBFHandle psDBF, int nYYSince1900, int nMM, int nDD );
699 
700 #ifdef __cplusplus
701 }
702 #endif
703 
704 #endif /* ndef SHAPEFILE_H_INCLUDED */
705