LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/xplane - ogr_xplane.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 5
Code covered: 60.0 % Executed lines: 3

       1                 : /******************************************************************************
       2                 :  * $Id: ogr_xplane.h $
       3                 :  *
       4                 :  * Project:  X-Plane aeronautical data reader
       5                 :  * Purpose:  Definition of classes for OGR X-Plane aeronautical data driver.
       6                 :  * Author:   Even Rouault, even dot rouault at mines dash paris dot org
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 2008, Even Rouault
      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_XPLANE_H_INCLUDED
      31                 : #define _OGR_XPLANE_H_INCLUDED
      32                 : 
      33                 : #include "ogrsf_frmts.h"
      34                 : 
      35                 : class OGRXPlaneReader;
      36                 : class OGRXPlaneDataSource;
      37                 : 
      38                 : /************************************************************************/
      39                 : /*                             OGRXPlaneLayer                           */
      40                 : /************************************************************************/
      41                 : 
      42                 : class OGRXPlaneLayer : public OGRLayer
      43                 : {
      44                 :   private:
      45                 :     int                nFID;
      46                 :     int                nFeatureArraySize;
      47                 :     int                nFeatureArrayMaxSize;
      48                 :     int                nFeatureArrayIndex;
      49                 :     
      50                 :     OGRFeature**       papoFeatures;
      51                 :     OGRSpatialReference *poSRS;
      52                 :     
      53                 :     OGRXPlaneDataSource* poDS;
      54                 : 
      55                 :   protected:
      56                 :     OGRXPlaneReader*   poReader;
      57                 :     OGRFeatureDefn*    poFeatureDefn;
      58                 :                        OGRXPlaneLayer(const char* pszLayerName);
      59                 : 
      60                 :     void               RegisterFeature(OGRFeature* poFeature);
      61                 : 
      62                 :   public:
      63                 :     virtual                   ~OGRXPlaneLayer();
      64                 :     
      65                 :     void                      SetDataSource(OGRXPlaneDataSource* poDS);
      66                 : 
      67                 :     void                      SetReader(OGRXPlaneReader* poReader);
      68               0 :     int                       IsEmpty() { return nFeatureArraySize == 0; }
      69                 :     void                      AutoAdjustColumnsWidth();
      70                 : 
      71                 :     virtual void              ResetReading();
      72                 :     virtual OGRFeature *      GetNextFeature();
      73                 :     virtual OGRFeature *      GetFeature( long nFID );
      74                 :     virtual OGRErr            SetNextByIndex( long nIndex );
      75                 :     virtual int               GetFeatureCount( int bForce = TRUE );
      76               0 :     virtual OGRSpatialReference * GetSpatialRef() { return poSRS; }
      77                 : 
      78                 :     virtual OGRFeatureDefn *  GetLayerDefn();
      79                 :     virtual int               TestCapability( const char * pszCap );
      80                 : };
      81                 : 
      82                 : 
      83                 : /************************************************************************/
      84                 : /*                           OGRXPlaneDataSource                        */
      85                 : /************************************************************************/
      86                 : 
      87                 : class OGRXPlaneDataSource : public OGRDataSource
      88                 : {
      89                 :     char*               pszName;
      90                 : 
      91                 :     OGRXPlaneLayer**    papoLayers;
      92                 :     int                 nLayers;
      93                 : 
      94                 :     OGRXPlaneReader*    poReader;
      95                 :     int                 bReadWholeFile;
      96                 :     int                 bWholeFiledReadingDone;
      97                 : 
      98                 :     void                Reset();
      99                 : 
     100                 :   public:
     101                 :                         OGRXPlaneDataSource();
     102                 :                         ~OGRXPlaneDataSource();
     103                 : 
     104                 :     int                 Open( const char * pszFilename, int bReadWholeFile = TRUE );
     105                 : 
     106                 :     void                RegisterLayer( OGRXPlaneLayer* poLayer );
     107                 : 
     108             374 :     virtual int         GetLayerCount() { return nLayers; }
     109                 :     virtual OGRLayer*   GetLayer( int );
     110               5 :     virtual const char* GetName() { return pszName; }
     111                 : 
     112                 :     virtual int         TestCapability( const char * pszCap );
     113                 :     
     114                 :     void                ReadWholeFileIfNecessary();
     115                 : };
     116                 : 
     117                 : /************************************************************************/
     118                 : /*                             OGRXPlaneDriver                          */
     119                 : /************************************************************************/
     120                 : 
     121                 : class OGRXPlaneDriver : public OGRSFDriver
     122             152 : {
     123                 :   public:
     124                 : 
     125                 :     virtual const char* GetName();
     126                 :     OGRDataSource*      Open( const char *, int );
     127                 : 
     128                 :     virtual int         TestCapability( const char * pszCap );
     129                 : };
     130                 : 
     131                 : 
     132                 : #endif /* ndef _OGR_XPLANE_H_INCLUDED */

Generated by: LTP GCOV extension version 1.5