#include <ogrsf_frmts.h>
Public Member Functions | |
virtual const char * | GetName ()=0 |
Fetch name of driver (file format). This name should be relatively short (10-40 characters), and should reflect the underlying file format. For instance "ESRI Shapefile". | |
virtual OGRDataSource * | Open (const char *pszName, int bUpdate=FALSE)=0 |
Attempt to open file with this driver. | |
virtual int | TestCapability (const char *)=0 |
Test if capability is available. | |
virtual OGRDataSource * | CreateDataSource (const char *pszName, char **=NULL) |
This method attempts to create a new data source based on the passed driver. | |
virtual OGRErr | DeleteDataSource (const char *pszName) |
Delete a datasource. | |
virtual OGRDataSource * | CopyDataSource (OGRDataSource *poSrcDS, const char *pszNewName, char **papszOptions=NULL) |
This method creates a new datasource by copying all the layers from the source datasource. |
One OGRSFDriver derived class will normally exist for each file format registered for use, regardless of whether a file has or will be opened. The list of available drivers is normally managed by the OGRSFDriverRegistrar.
OGRDataSource * OGRSFDriver::CopyDataSource | ( | OGRDataSource * | poSrcDS, | |
const char * | pszNewName, | |||
char ** | papszOptions = NULL | |||
) | [virtual] |
This method creates a new datasource by copying all the layers from the source datasource.
It is important to call OGRDataSource::DestroyDataSource() when the datasource is no longer used to ensure that all data has been properly flushed to disk.
This method is the same as the C function OGR_Dr_CopyDataSource().
poSrcDS | source datasource | |
pszNewName | the name for the new data source. | |
papszOptions | a StringList of name=value options. Options are driver specific, and driver information can be found at the following url: http://www.gdal.org/ogr/ogr_formats.html |
References OGRDataSource::CopyLayer(), CreateDataSource(), OGRDataSource::GetLayer(), OGRDataSource::GetLayerCount(), OGRLayer::GetLayerDefn(), OGRFeatureDefn::GetName(), GetName(), and TestCapability().
OGRDataSource * OGRSFDriver::CreateDataSource | ( | const char * | pszName, | |
char ** | papszOptions = NULL | |||
) | [virtual] |
This method attempts to create a new data source based on the passed driver.
The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation.
It is important to call OGRDataSource::DestroyDataSource() when the datasource is no longer used to ensure that all data has been properly flushed to disk.
This method is the same as the C function OGR_Dr_CreateDataSource().
pszName | the name for the new data source. | |
papszOptions | a StringList of name=value options. Options are driver specific, and driver information can be found at the following url: http://www.gdal.org/ogr/ogr_formats.html |
Referenced by CopyDataSource(), and OGR_Dr_CreateDataSource().
OGRErr OGRSFDriver::DeleteDataSource | ( | const char * | pszDataSource | ) | [virtual] |
Delete a datasource.
Delete (from the disk, in the database, ...) the named datasource. Normally it would be safest if the datasource was not open at the time.
Whether this is a supported operation on this driver case be tested using TestCapability() on ODrCDeleteDataSource.
This method is the same as the C function OGR_Dr_DeleteDataSource().
pszDataSource | the name of the datasource to delete. |
const char * OGRSFDriver::GetName | ( | ) | [pure virtual] |
Fetch name of driver (file format). This name should be relatively short (10-40 characters), and should reflect the underlying file format. For instance "ESRI Shapefile".
This method is the same as the C function OGR_Dr_GetName().
Referenced by CopyDataSource(), OGRSFDriverRegistrar::Open(), and OGRSFDriverRegistrar::RegisterDriver().
OGRDataSource * OGRSFDriver::Open | ( | const char * | pszName, | |
int | bUpdate = FALSE | |||
) | [pure virtual] |
Attempt to open file with this driver.
This method is what OGRSFDriverRegistrar uses to implement its Open() method. See it for more details.
Note, drivers do not normally set their own m_poDriver value, so a direct call to this method (instead of indirectly via OGRSFDriverRegistrar) will usually result in a datasource that does not know what driver it relates to if GetDriver() is called on the datasource. The application may directly call SetDriver() after opening with this method to avoid this problem.
This method is the same as the C function OGR_Dr_Open().
pszName | the name of the file, or data source to try and open. | |
bUpdate | TRUE if update access is required, otherwise FALSE (the default). |
Referenced by OGRSFDriverRegistrar::Open().
int OGRSFDriver::TestCapability | ( | const char * | pszCapability | ) | [pure virtual] |
Test if capability is available.
One of the following data source capability names can be passed into this method, and a TRUE or FALSE value will be returned indicating whether or not the capability is available for this object.
The #define macro forms of the capability names should be used in preference to the strings themselves to avoid mispelling.
This method is the same as the C function OGR_Dr_TestCapability().
pszCapability | the capability to test. |
Referenced by CopyDataSource().