LCOV - code coverage report
Current view: top level - frmts/pdf - pdfio.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 5 60.0 %
Date: 2025-03-29 15:49:56 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  PDF driver
       4             :  * Purpose:  GDALDataset driver for PDF dataset.
       5             :  * Author:   Even Rouault, <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2010-2013, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef PDFIO_H_INCLUDED
      14             : #define PDFIO_H_INCLUDED
      15             : 
      16             : #include "cpl_vsi_virtual.h"
      17             : 
      18             : /************************************************************************/
      19             : /*                         VSIPDFFileStream                             */
      20             : /************************************************************************/
      21             : 
      22             : #define BUFFER_SIZE 1024
      23             : 
      24             : class VSIPDFFileStream final : public BaseStream
      25             : {
      26             :   public:
      27             :     VSIPDFFileStream(VSILFILE *f, const char *pszFilename, Object &&dictA);
      28             :     VSIPDFFileStream(VSIPDFFileStream *poParent, vsi_l_offset startA,
      29             :                      bool limitedA, vsi_l_offset lengthA, Object &&dictA);
      30             :     virtual ~VSIPDFFileStream();
      31             : 
      32             :     virtual BaseStream *copy() override;
      33             : 
      34             :     virtual Stream *makeSubStream(Goffset startA, bool limitedA,
      35             :                                   Goffset lengthA, Object &&dictA) override;
      36             :     virtual Goffset getPos() override;
      37             :     virtual Goffset getStart() override;
      38             : 
      39             :     virtual void setPos(Goffset pos, int dir = 0) override;
      40             :     virtual void moveStart(Goffset delta) override;
      41             : 
      42             :     virtual StreamKind getKind() const override;
      43             : 
      44             :     virtual GooString *getFileName() override;
      45             : 
      46             :     virtual int getChar() override;
      47             :     virtual int getUnfilteredChar() override;
      48             :     virtual int lookChar() override;
      49             : 
      50             : #if POPPLER_MAJOR_VERSION > 25 ||                                              \
      51             :     (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
      52             :     virtual bool reset() override;
      53             : #else
      54             :     virtual void reset() override;
      55             : #endif
      56             : 
      57           3 :     static void resetNoCheckReturnValue(Stream *str)
      58             :     {
      59             : #if POPPLER_MAJOR_VERSION > 25 ||                                              \
      60             :     (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
      61             :         CPL_IGNORE_RET_VAL(str->reset());
      62             : #else
      63           3 :         str->reset();
      64             : #endif
      65           3 :     }
      66             : 
      67             : #if POPPLER_MAJOR_VERSION > 25 ||                                              \
      68             :     (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
      69             :     virtual bool unfilteredReset() override;
      70             : #else
      71             :     virtual void unfilteredReset() override;
      72             : #endif
      73             : 
      74             :     virtual void close() override;
      75             : 
      76           0 :     bool FoundLinearizedHint() const
      77             :     {
      78           0 :         return bFoundLinearizedHint;
      79             :     }
      80             : 
      81             :   private:
      82             :     virtual bool hasGetChars() override;
      83             :     virtual int getChars(int nChars, unsigned char *buffer) override;
      84             : 
      85             :     VSIPDFFileStream *poParent = nullptr;
      86             :     GooString *poFilename = nullptr;
      87             :     VSILFILE *f = nullptr;
      88             :     vsi_l_offset nStart = 0;
      89             :     bool bLimited = false;
      90             :     vsi_l_offset nLength = 0;
      91             : 
      92             :     vsi_l_offset nCurrentPos = VSI_L_OFFSET_MAX;
      93             :     int bHasSavedPos = FALSE;
      94             :     vsi_l_offset nSavedPos = 0;
      95             : 
      96             :     GByte abyBuffer[BUFFER_SIZE];
      97             :     int nPosInBuffer = -1;
      98             :     int nBufferLength = -1;
      99             : 
     100             :     bool bFoundLinearizedHint = false;
     101             : 
     102             :     int FillBuffer();
     103             : 
     104             :     CPL_DISALLOW_COPY_ASSIGN(VSIPDFFileStream)
     105             : };
     106             : 
     107             : #endif  // PDFIO_H_INCLUDED

Generated by: LCOV version 1.14