345 |
%} |
%} |
346 |
|
|
347 |
|
|
348 |
|
/* The commit method implementation |
349 |
|
* |
350 |
|
* The method relies on the DBFUpdateHeader method which is not |
351 |
|
* available in shapelib <= 1.2.10. setup.py defines |
352 |
|
* HAVE_UPDATE_HEADER's value depending on whether the function is |
353 |
|
* available in the shapelib version the code is compiled with. |
354 |
|
*/ |
355 |
|
%{ |
356 |
|
static |
357 |
|
void |
358 |
|
DBFInfo_commit(DBFHandle handle) |
359 |
|
{ |
360 |
|
#if HAVE_UPDATE_HEADER |
361 |
|
DBFUpdateHeader(handle); |
362 |
|
#endif |
363 |
|
} |
364 |
|
%} |
365 |
|
|
366 |
|
|
367 |
/* |
/* |
368 |
* The SWIG Interface definition. |
* The SWIG Interface definition. |
369 |
*/ |
*/ |
521 |
dict_or_sequence); |
dict_or_sequence); |
522 |
} |
} |
523 |
|
|
524 |
int commit() { |
void commit() { |
525 |
return DBFCommit(self->handle); |
DBFInfo_commit(self->handle); |
526 |
} |
} |
527 |
|
/* Delete the commit method from the class if it doesn't have a |
528 |
|
* real implementation. |
529 |
|
*/ |
530 |
|
%pragma(python) addtomethod="__class__:if not dbflibc._have_commit: del commit" |
531 |
|
|
532 |
|
/* The __del__ method generated by the old SWIG version we're |
533 |
|
* tries to access self.thisown which may not be set at all when |
534 |
|
* there was an exception during construction. Therefore we |
535 |
|
* override it with our own version. |
536 |
|
* FIXME: It would be better to upgrade to a newer SWIG version |
537 |
|
* or to get rid of SWIG entirely. |
538 |
|
*/ |
539 |
|
%pragma(python) addtoclass = " |
540 |
|
def __del__(self,dbflibc=dbflibc): |
541 |
|
if getattr(self, 'thisown', 0): |
542 |
|
dbflibc.delete_DBFFile(self) |
543 |
|
" |
544 |
|
|
545 |
|
|
546 |
} |
} |
547 |
} DBFFile; |
} DBFFile; |
587 |
FTDouble, |
FTDouble, |
588 |
FTInvalid |
FTInvalid |
589 |
} DBFFieldType; |
} DBFFieldType; |
590 |
|
|
591 |
|
|
592 |
|
/* Put the value of the HAVE_UPDATE_HEADER preprocessor macro into the |
593 |
|
* wrapper so that the __class__ pragma above knows when to remove the |
594 |
|
* commit method |
595 |
|
*/ |
596 |
|
const int _have_commit = HAVE_UPDATE_HEADER; |
597 |
|
|