LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/csv - ogr_csv.h (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2010-01-09 Functions: 4 4 100.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_csv.h 17495 2009-08-02 11:44:13Z rouault $
       3                 :  *
       4                 :  * Project:  CSV Translator
       5                 :  * Purpose:  Definition of classes for OGR .csv driver.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2004,  Frank Warmerdam
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  *
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  *
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
      22                 :  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : #ifndef _OGR_CSV_H_INCLUDED
      31                 : #define _OGR_CSV_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : typedef enum
      36                 : {
      37                 :     OGR_CSV_GEOM_NONE,
      38                 :     OGR_CSV_GEOM_AS_WKT,
      39                 :     OGR_CSV_GEOM_AS_XYZ,
      40                 :     OGR_CSV_GEOM_AS_XY,
      41                 :     OGR_CSV_GEOM_AS_YX,
      42                 : } OGRCSVGeometryFormat;
      43                 : 
      44                 : class OGRCSVDataSource;
      45                 : 
      46                 : /************************************************************************/
      47                 : /*                             OGRCSVLayer                              */
      48                 : /************************************************************************/
      49                 : 
      50                 : class OGRCSVLayer : public OGRLayer
      51                 : {
      52                 :     OGRFeatureDefn     *poFeatureDefn;
      53                 : 
      54                 :     FILE               *fpCSV;
      55                 : 
      56                 :     int                 nNextFID;
      57                 : 
      58                 :     int                 bHasFieldNames;
      59                 : 
      60                 :     OGRFeature *        GetNextUnfilteredFeature();
      61                 : 
      62                 :     int                 bNew;
      63                 :     int                 bInWriteMode;
      64                 :     int                 bUseCRLF;
      65                 :     int                 bNeedRewindBeforeRead;
      66                 :     OGRCSVGeometryFormat eGeometryFormat;
      67                 : 
      68                 :     char*               pszFilename;
      69                 :     int                 bCreateCSVT;
      70                 :     char                chDelimiter;
      71                 : 
      72                 :     int                 iWktGeomReadField;
      73                 :     int                 bFirstFeatureAppendedDuringSession;
      74                 : 
      75                 :   public:
      76                 :     OGRCSVLayer( const char *pszName, FILE *fp, const char *pszFilename,
      77                 :                  int bNew, int bInWriteMode, char chDelimiter );
      78                 :   ~OGRCSVLayer();
      79                 : 
      80                 :     void                ResetReading();
      81                 :     OGRFeature *        GetNextFeature();
      82                 : 
      83             275 :     OGRFeatureDefn *    GetLayerDefn() { return poFeatureDefn; }
      84                 : 
      85                 :     int                 TestCapability( const char * );
      86                 : 
      87                 :     virtual OGRErr      CreateField( OGRFieldDefn *poField,
      88                 :                                      int bApproxOK = TRUE );
      89                 : 
      90                 :     virtual OGRErr      CreateFeature( OGRFeature *poFeature );
      91                 : 
      92                 :     void                SetCRLF(int);
      93                 :     void                SetWriteGeometry(OGRCSVGeometryFormat eGeometryFormat);
      94                 :     void                SetCreateCSVT(int bCreateCSVT);
      95                 : };
      96                 : 
      97                 : /************************************************************************/
      98                 : /*                           OGRCSVDataSource                           */
      99                 : /************************************************************************/
     100                 : 
     101                 : class OGRCSVDataSource : public OGRDataSource
     102                 : {
     103                 :     char                *pszName;
     104                 : 
     105                 :     OGRCSVLayer       **papoLayers;
     106                 :     int                 nLayers;
     107                 : 
     108                 :     int                 bUpdate;
     109                 :     
     110                 :   public:
     111                 :                         OGRCSVDataSource();
     112                 :                         ~OGRCSVDataSource();
     113                 : 
     114                 :     int                 Open( const char * pszFilename,
     115                 :                               int bUpdate, int bForceAccept );
     116                 :     int                 OpenTable( const char * pszFilename );
     117                 :     
     118              13 :     const char          *GetName() { return pszName; }
     119                 : 
     120              45 :     int                 GetLayerCount() { return nLayers; }
     121                 :     OGRLayer            *GetLayer( int );
     122                 : 
     123                 :     virtual OGRLayer   *CreateLayer( const char *pszName, 
     124                 :                                      OGRSpatialReference *poSpatialRef = NULL,
     125                 :                                      OGRwkbGeometryType eGType = wkbUnknown,
     126                 :                                      char ** papszOptions = NULL );
     127                 : 
     128                 :     virtual OGRErr      DeleteLayer(int);
     129                 : 
     130                 :     int                 TestCapability( const char * );
     131                 : };
     132                 : 
     133                 : /************************************************************************/
     134                 : /*                             OGRCSVDriver                             */
     135                 : /************************************************************************/
     136                 : 
     137                 : class OGRCSVDriver : public OGRSFDriver
     138              64 : {
     139                 :   public:
     140                 :                 ~OGRCSVDriver();
     141                 :                 
     142                 :     const char *GetName();
     143                 :     OGRDataSource *Open( const char *, int );
     144                 :     OGRDataSource *CreateDataSource( const char *, char ** );
     145                 :     int         TestCapability( const char * );
     146                 : 
     147                 :     virtual OGRErr      DeleteDataSource( const char *pszName );
     148                 :     
     149                 : };
     150                 : 
     151                 : 
     152                 : #endif /* ndef _OGR_CSV_H_INCLUDED */

Generated by: LCOV version 1.7