LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/tiger - tigertlidrange.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 11 10 90.9 %
Date: 2011-12-18 Functions: 2 1 50.0 %

       1                 : /******************************************************************************
       2                 :  * $Id: tigertlidrange.cpp 22961 2011-08-20 17:09:59Z rouault $
       3                 :  *
       4                 :  * Project:  TIGER/Line Translator
       5                 :  * Purpose:  Implements TigerTLIDRange, providing access to .RTR files.
       6                 :  * Author:   Frank Warmerdam, warmerda@home.com
       7                 :  *
       8                 :  ******************************************************************************
       9                 :  * Copyright (c) 1999, 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                 : #include "ogr_tiger.h"
      31                 : #include "cpl_conv.h"
      32                 : 
      33                 : CPL_CVSID("$Id: tigertlidrange.cpp 22961 2011-08-20 17:09:59Z rouault $");
      34                 : 
      35                 : #define FILE_CODE "R"
      36                 : 
      37                 : static const TigerFieldInfo rtR_2002_fields[] = {
      38                 :   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
      39                 :   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
      40                 :   { "FILE",       'L', 'N', OFTInteger,    6,  10,   5,       1,   1,     1 },
      41                 :   { "CENID",      'L', 'A', OFTString,    11,  15,   5,       1,   1,     1 },
      42                 :   { "TLMAXID",    'R', 'N', OFTInteger,   16,  25,  10,       1,   1,     1 },
      43                 :   { "TLMINID",    'R', 'N', OFTInteger,   26,  35,  10,       1,   1,     1 },
      44                 :   { "TLIGHID",    'R', 'N', OFTInteger,   36,  45,  10,       1,   1,     1 },
      45                 :   { "TZMAXID",    'R', 'N', OFTInteger,   46,  55,  10,       1,   1,     1 },
      46                 :   { "TZMINID",    'R', 'N', OFTInteger,   56,  65,  10,       1,   1,     1 },
      47                 :   { "TZHIGHID",   'R', 'N', OFTInteger,   66,  75,  10,       1,   1,     1 },
      48                 :   { "FILLER",     'L', 'A', OFTString,    76,  76,   1,       1,   1,     1 },
      49                 : };
      50                 : static const TigerRecordInfo rtR_2002_info =
      51                 :   {
      52                 :     rtR_2002_fields,
      53                 :     sizeof(rtR_2002_fields) / sizeof(TigerFieldInfo),
      54                 :     76
      55                 :   };
      56                 : 
      57                 : static const TigerFieldInfo rtR_fields[] = {
      58                 :   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
      59                 :   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
      60                 :   { "FILE",       'L', 'N', OFTString,     6,  10,   5,       1,   1,     1 },
      61                 :   { "STATE",      'L', 'N', OFTInteger,    6,   7,   2,       1,   1,     1 },
      62                 :   { "COUNTY",     'L', 'N', OFTInteger,    8,  10,   3,       1,   1,     1 },
      63                 :   { "CENID",      'L', 'A', OFTString,    11,  15,   5,       1,   1,     1 },
      64                 :   { "MAXID",      'R', 'N', OFTInteger,   16,  25,  10,       1,   1,     1 },
      65                 :   { "MINID",      'R', 'N', OFTInteger,   26,  35,  10,       1,   1,     1 },
      66                 :   { "HIGHID",     'R', 'N', OFTInteger,   36,  45,  10,       1,   1,     1 }
      67                 : };
      68                 : 
      69                 : static const TigerRecordInfo rtR_info =
      70                 :   {
      71                 :     rtR_fields,
      72                 :     sizeof(rtR_fields) / sizeof(TigerFieldInfo),
      73                 :     46
      74                 :   };
      75                 : 
      76                 : /************************************************************************/
      77                 : /*                           TigerTLIDRange()                           */
      78                 : /************************************************************************/
      79                 : 
      80               7 : TigerTLIDRange::TigerTLIDRange( OGRTigerDataSource * poDSIn,
      81               7 :                             const char * pszPrototypeModule ) : TigerFileBase(NULL, FILE_CODE)
      82                 : 
      83                 : {
      84               7 :     poDS = poDSIn;
      85               7 :     poFeatureDefn = new OGRFeatureDefn( "TLIDRange" );
      86               7 :     poFeatureDefn->Reference();
      87               7 :     poFeatureDefn->SetGeomType( wkbNone );
      88                 : 
      89               7 :     if (poDS->GetVersion() >= TIGER_2002) {
      90               7 :       psRTInfo = &rtR_2002_info;
      91                 :     } else {
      92               0 :       psRTInfo = &rtR_info;
      93                 :     }
      94                 : 
      95                 :     /* -------------------------------------------------------------------- */
      96                 :     /*      Fields from type R record.                                      */
      97                 :     /* -------------------------------------------------------------------- */
      98                 : 
      99               7 :     AddFieldDefns( psRTInfo, poFeatureDefn );
     100                 : 
     101               7 : }

Generated by: LCOV version 1.7