LCOV - code coverage report
Current view: top level - gcore - gdal_openinfo.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 2 2 100.0 %
Date: 2025-10-01 17:07:58 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Name:     gdal_openinfo.h
       4             :  * Project:  GDAL Core
       5             :  * Purpose:  Declaration of GDALOpenInfo class
       6             :  * Author:   Frank Warmerdam, warmerdam@pobox.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 1998, Frank Warmerdam
      10             :  * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
      11             :  *
      12             :  * SPDX-License-Identifier: MIT
      13             :  ****************************************************************************/
      14             : 
      15             : #ifndef GDALOPENINFO_H_INCLUDED
      16             : #define GDALOPENINFO_H_INCLUDED
      17             : 
      18             : #include "cpl_port.h"
      19             : 
      20             : #include "gdal.h"
      21             : 
      22             : /* ******************************************************************** */
      23             : /*                             GDALOpenInfo                             */
      24             : /* ******************************************************************** */
      25             : 
      26             : /** Class for dataset open functions. */
      27             : class CPL_DLL GDALOpenInfo
      28             : {
      29             :     bool bHasGotSiblingFiles = false;
      30             :     char **papszSiblingFiles = nullptr;
      31             :     int nHeaderBytesTried = 0;
      32             : 
      33             :   public:
      34             :     GDALOpenInfo(const char *pszFile, int nOpenFlagsIn,
      35             :                  const char *const *papszSiblingFiles = nullptr);
      36             :     ~GDALOpenInfo(void);
      37             : 
      38             :     /** Filename */
      39             :     char *pszFilename = nullptr;
      40             : 
      41             :     /** Result of CPLGetExtension(pszFilename); */
      42             :     std::string osExtension{};
      43             : 
      44             :     /** Open options */
      45             :     char **papszOpenOptions = nullptr;
      46             : 
      47             :     /** Access flag */
      48             :     GDALAccess eAccess = GA_ReadOnly;
      49             :     /** Open flags */
      50             :     int nOpenFlags = 0;
      51             : 
      52             :     /** Whether stat()'ing the file was successful */
      53             :     bool bStatOK = false;
      54             :     /** Whether the file is a directory */
      55             :     bool bIsDirectory = false;
      56             : 
      57             :     /** Pointer to the file */
      58             :     VSILFILE *fpL = nullptr;
      59             : 
      60             :     /** Number of bytes in pabyHeader */
      61             :     int nHeaderBytes = 0;
      62             :     /** Buffer with first bytes of the file */
      63             :     GByte *pabyHeader = nullptr;
      64             : 
      65             :     /** Allowed drivers (NULL for all) */
      66             :     const char *const *papszAllowedDrivers = nullptr;
      67             : 
      68             :     int TryToIngest(int nBytes);
      69             :     char **GetSiblingFiles();
      70             :     char **StealSiblingFiles();
      71             :     bool AreSiblingFilesLoaded() const;
      72             : 
      73             :     bool IsSingleAllowedDriver(const char *pszDriverName) const;
      74             : 
      75             :     /** Return whether the extension of the file is equal to pszExt, using
      76             :      * case-insensitive comparison.
      77             :      * @since 3.11 */
      78     1056107 :     inline bool IsExtensionEqualToCI(const char *pszExt) const
      79             :     {
      80     1056107 :         return EQUAL(osExtension.c_str(), pszExt);
      81             :     }
      82             : 
      83             :   private:
      84             :     CPL_DISALLOW_COPY_ASSIGN(GDALOpenInfo)
      85             : };
      86             : 
      87             : #endif

Generated by: LCOV version 1.14