LCOV - code coverage report
Current view: directory - ogr/ogrsf_frmts/gml - gmlreadstate.cpp (source / functions) Found Hit Coverage
Test: gdal_filtered.info Lines: 31 31 100.0 %
Date: 2011-12-18 Functions: 7 5 71.4 %

       1                 : /**********************************************************************
       2                 :  * $Id: gmlreadstate.cpp 22954 2011-08-19 21:47:19Z rouault $
       3                 :  *
       4                 :  * Project:  GML Reader
       5                 :  * Purpose:  Implementation of GMLReadState class.
       6                 :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7                 :  *
       8                 :  **********************************************************************
       9                 :  * Copyright (c) 2002, 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 OR
      22                 :  * 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 "gmlreaderp.h"
      31                 : #include "cpl_conv.h"
      32                 : #include "cpl_string.h"
      33                 : 
      34                 : /************************************************************************/
      35                 : /*                            GMLReadState()                            */
      36                 : /************************************************************************/
      37                 : 
      38            8910 : GMLReadState::GMLReadState()
      39                 : 
      40                 : {
      41            8910 :     m_poFeature = NULL;
      42            8910 :     m_poParentState = NULL;
      43            8910 :     m_nPathLength = 0;
      44            8910 : }
      45                 : 
      46                 : /************************************************************************/
      47                 : /*                           ~GMLReadState()                            */
      48                 : /************************************************************************/
      49                 : 
      50            8910 : GMLReadState::~GMLReadState()
      51                 : 
      52                 : {
      53            8910 : }
      54                 : 
      55                 : /************************************************************************/
      56                 : /*                              Reset()                                 */
      57                 : /************************************************************************/
      58                 : 
      59            1071 : void GMLReadState::Reset()
      60                 : {
      61            1071 :     m_poFeature = NULL;
      62            1071 :     m_poParentState = NULL;
      63                 : 
      64            1071 :     osPath.resize(0);
      65            1071 :     m_nPathLength = 0;
      66            1071 : }
      67                 : 
      68                 : /************************************************************************/
      69                 : /*                              PushPath()                              */
      70                 : /************************************************************************/
      71                 : 
      72          607896 : void GMLReadState::PushPath( const char *pszElement, int nLen )
      73                 : 
      74                 : {
      75          607896 :     if (m_nPathLength > 0)
      76          561731 :         osPath.append(1, '|');
      77          607896 :     if (m_nPathLength < (int)aosPathComponents.size())
      78                 :     {
      79          550971 :         if (nLen >= 0)
      80                 :         {
      81            3984 :             aosPathComponents[m_nPathLength].assign(pszElement, nLen);
      82            3984 :             osPath.append(pszElement, nLen);
      83                 :         }
      84                 :         else
      85                 :         {
      86          546987 :             aosPathComponents[m_nPathLength].assign(pszElement);
      87          546987 :             osPath.append(pszElement);
      88                 :         }
      89                 :     }
      90                 :     else
      91                 :     {
      92           56925 :         aosPathComponents.push_back(pszElement);
      93           56925 :         osPath.append(pszElement);
      94                 :     }
      95          607896 :     m_nPathLength ++;
      96          607896 : }
      97                 : 
      98                 : /************************************************************************/
      99                 : /*                              PopPath()                               */
     100                 : /************************************************************************/
     101                 : 
     102          607875 : void GMLReadState::PopPath()
     103                 : 
     104                 : {
     105          607875 :     CPLAssert( m_nPathLength > 0 );
     106                 : 
     107          607875 :     osPath.resize(osPath.size() - (aosPathComponents[m_nPathLength-1].size() + ((m_nPathLength > 1) ? 1 : 0)));
     108          607875 :     m_nPathLength --;
     109          607875 : }

Generated by: LCOV version 1.7