1 /**********************************************************************
2  * $Id: mitab_ogr_driver.h 1a84c3072423a876ffe2262fef692f9eac43d5ed 2020-01-16 16:32:14 +0300 Dmitry Baryshnikov $
3  *
4  * Name:     mitab_ogr_drive.h
5  * Project:  Mid/mif tab ogr support
6  * Language: C++
7  * Purpose:  Header file containing public definitions for the library.
8  * Author:   Stephane Villeneuve, stephane.v@videotron.ca
9  *
10  **********************************************************************
11  * Copyright (c) 1999, 2000, Stephane Villeneuve
12  * Copyright (c) 2014, Even Rouault <even.rouault at spatialys.com>
13  *
14  * Permission is hereby granted, free of charge, to any person obtaining a
15  * copy of this software and associated documentation files (the "Software"),
16  * to deal in the Software without restriction, including without limitation
17  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
18  * and/or sell copies of the Software, and to permit persons to whom the
19  * Software is furnished to do so, subject to the following conditions:
20  *
21  * The above copyright notice and this permission notice shall be included
22  * in all copies or substantial portions of the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  **********************************************************************/
32 
33 #include "mitab.h"
34 #include "ogrsf_frmts.h"
35 
36 #ifndef MITAB_OGR_DRIVER_H_INCLUDED_
37 #define MITAB_OGR_DRIVER_H_INCLUDED_
38 
39 /*=====================================================================
40  *            OGRTABDataSource Class
41  *
42  * These classes handle all the file types supported by the MITAB lib.
43  * through the IMapInfoFile interface.
44  *====================================================================*/
45 class OGRTABDataSource : public OGRDataSource
46 {
47     CPL_DISALLOW_COPY_ASSIGN(OGRTABDataSource)
48 
49   private:
50     char                *m_pszName;
51     char                *m_pszDirectory;
52 
53     int                 m_nLayerCount;
54     IMapInfoFile        **m_papoLayers;
55 
56     char                **m_papszOptions;
57     int                 m_bCreateMIF;
58     int                 m_bSingleFile;
59     int                 m_bSingleLayerAlreadyCreated;
60     GBool               m_bQuickSpatialIndexMode;
61     int                 m_nBlockSize;
62 
63   private:
GetUpdate()64     inline bool         GetUpdate() const { return eAccess == GA_Update; }
65 
66   public:
67                 OGRTABDataSource();
68     virtual     ~OGRTABDataSource();
69 
70     int         Open( GDALOpenInfo* poOpenInfo, int bTestOpen );
71     int         Create( const char *pszName, char ** papszOptions );
72 
GetName()73     const char  *GetName() override { return m_pszName; }
74     int          GetLayerCount() override;
75     OGRLayer    *GetLayer( int ) override;
76     int          TestCapability( const char * ) override;
77 
78     OGRLayer    *ICreateLayer(const char *,
79                              OGRSpatialReference * = nullptr,
80                              OGRwkbGeometryType = wkbUnknown,
81                              char ** = nullptr ) override;
82 
83     char        **GetFileList() override;
84 
85     virtual OGRLayer *  ExecuteSQL( const char *pszStatement,
86                                     OGRGeometry *poSpatialFilter,
87                                     const char *pszDialect ) override;
88 };
89 
90 void CPL_DLL RegisterOGRTAB();
91 
92 #endif /* MITAB_OGR_DRIVER_H_INCLUDED_ */
93