#include <ogrsf_frmts.h>
Public Member Functions | |
OGRDataSource * | OpenShared (const char *pszName, int bUpdate=FALSE, OGRSFDriver **ppoDriver=NULL) |
OGRErr | ReleaseDataSource (OGRDataSource *) |
void | RegisterDriver (OGRSFDriver *poDriver) |
Add a driver to the list of registered drivers. | |
void | DeregisterDriver (OGRSFDriver *poDriver) |
Remove the passed driver from the list of registered drivers. | |
int | GetDriverCount (void) |
Fetch the number of registered drivers. | |
OGRSFDriver * | GetDriver (int iDriver) |
Fetch the indicated driver. | |
OGRSFDriver * | GetDriverByName (const char *) |
Fetch the indicated driver. | |
int | GetOpenDSCount () |
Return the number of opened datasources. | |
OGRDataSource * | GetOpenDS (int) |
Return the iDS th datasource opened. | |
void | AutoLoadDrivers () |
Static Public Member Functions | |
static OGRSFDriverRegistrar * | GetRegistrar () |
Return the driver manager, creating one if none exist. | |
static OGRDataSource * | Open (const char *pszName, int bUpdate=FALSE, OGRSFDriver **ppoDriver=NULL) |
Open a file / data source with one of the registered drivers. |
Singleton manager for OGRSFDriver instances that will be used to try and open datasources. Normally the registrar is populated with standard drivers using the OGRRegisterAll() function and does not need to be directly accessed. The driver registrar and all registered drivers may be cleaned up on shutdown using OGRCleanupAll().
void OGRSFDriverRegistrar::DeregisterDriver | ( | OGRSFDriver * | poDriver | ) |
Remove the passed driver from the list of registered drivers.
This method is the same as the C function OGRDeregisterDriver().
poDriver | the driver to deregister. |
OGRSFDriver * OGRSFDriverRegistrar::GetDriver | ( | int | iDriver | ) |
Fetch the indicated driver.
This method is the same as the C function OGRGetDriver().
iDriver | the driver index, from 0 to GetDriverCount()-1. |
OGRSFDriver * OGRSFDriverRegistrar::GetDriverByName | ( | const char * | pszName | ) |
Fetch the indicated driver.
This method is the same as the C function OGRGetDriverByName
pszName | the driver name |
int OGRSFDriverRegistrar::GetDriverCount | ( | void | ) |
Fetch the number of registered drivers.
This method is the same as the C function OGRGetDriverCount().
OGRDataSource * OGRSFDriverRegistrar::GetOpenDS | ( | int | iDS | ) |
Return the iDS th datasource opened.
This method is the same as the C function OGRGetOpenDS().
iDS | the index of the dataset to return (between 0 and GetOpenDSCount() - 1) |
int OGRSFDriverRegistrar::GetOpenDSCount | ( | ) | [inline] |
Return the number of opened datasources.
This method is the same as the C function OGRGetOpenDSCount()
OGRSFDriverRegistrar * OGRSFDriverRegistrar::GetRegistrar | ( | ) | [static] |
Return the driver manager, creating one if none exist.
OGRDataSource * OGRSFDriverRegistrar::Open | ( | const char * | pszName, | |
int | bUpdate = FALSE , |
|||
OGRSFDriver ** | ppoDriver = NULL | |||
) | [static] |
Open a file / data source with one of the registered drivers.
This method loops through all the drivers registered with the driver manager trying each until one succeeds with the given data source. This method is static. Applications don't normally need to use any other OGRSFDriverRegistrar methods directly, nor do they normally need to have a pointer to an OGRSFDriverRegistrar instance.
If this method fails, CPLGetLastErrorMsg() can be used to check if there is an error message explaining why.
For drivers supporting the VSI virtual file API, it is possible to open a file in a .zip archive (see VSIInstallZipFileHandler()), in a .tar/.tar.gz/.tgz archive (see VSIInstallTarFileHandler()) or on a HTTP / FTP server (see VSIInstallCurlFileHandler())
This method is the same as the C function OGROpen().
pszName | the name of the file, or data source to open. UTF-8 encoded. | |
bUpdate | FALSE for read-only access (the default) or TRUE for read-write access. | |
ppoDriver | if non-NULL, this argument will be updated with a pointer to the driver which was used to open the data source. |
Example:
OGRDataSource *poDS;
poDS = OGRSFDriverRegistrar::Open( "polygon.shp" ); if( poDS == NULL ) { return; }
... use the data source ...
OGRDataSource::DestroyDataSource(poDS);
void OGRSFDriverRegistrar::RegisterDriver | ( | OGRSFDriver * | poDriver | ) |
Add a driver to the list of registered drivers.
If the passed driver is already registered (based on pointer comparison) then the driver isn't registered. New drivers are added at the end of the list of registered drivers.
This method is the same as the C function OGRRegisterDriver().
poDriver | the driver to add. |