LCOV - code coverage report
Current view: top level - gcore - nasakeywordhandler.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 3 100.0 %
Date: 2024-11-21 22:18:42 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  PDS Driver; Planetary Data System Format
       4             :  * Purpose:  Implementation of NASAKeywordHandler - a class to read
       5             :  *           keyword data from PDS, ISIS2 and ISIS3 data products.
       6             :  * Author:   Frank Warmerdam <warmerdam@pobox.com
       7             :  *
       8             :  ******************************************************************************
       9             :  * Copyright (c) 2006, Frank Warmerdam <warmerdam@pobox.com>
      10             :  * Copyright (c) 2008-2010, Even Rouault <even dot rouault at spatialys.com>
      11             :  * Copyright (c) 2017 Hobu Inc
      12             :  * Copyright (c) 2017, Dmitry Baryshnikov <polimax@mail.ru>
      13             :  * Copyright (c) 2017, NextGIS <info@nextgis.com>
      14             :  *
      15             :  * SPDX-License-Identifier: MIT
      16             :  ****************************************************************************/
      17             : 
      18             : #ifndef NASAKEYWORDHANDLER_H
      19             : #define NASAKEYWORDHANDLER_H
      20             : 
      21             : //! @cond Doxygen_Suppress
      22             : 
      23             : #include "cpl_json.h"
      24             : #include "cpl_string.h"
      25             : 
      26             : /************************************************************************/
      27             : /* ==================================================================== */
      28             : /*                          NASAKeywordHandler                          */
      29             : /* ==================================================================== */
      30             : /************************************************************************/
      31             : 
      32             : // Only exported for HDF4 plugin needs. Do not use outside of GDAL please.
      33             : 
      34             : class CPL_DLL NASAKeywordHandler
      35             : {
      36             :     CPLStringList aosKeywordList{};
      37             : 
      38             :     const char *pszHeaderNext = nullptr;
      39             : 
      40             :     CPLJSONObject oJSon{};
      41             : 
      42             :     bool m_bStripSurroundingQuotes = false;
      43             : 
      44             :     void SkipWhite();
      45             :     bool ReadWord(CPLString &osWord, bool bStripSurroundingQuotes = false,
      46             :                   bool bParseList = false, bool *pbIsString = nullptr);
      47             :     bool ReadPair(CPLString &osName, CPLString &osValue, CPLJSONObject &oCur);
      48             :     bool ReadGroup(const std::string &osPathPrefix, CPLJSONObject &oCur,
      49             :                    int nRecLevel);
      50             : 
      51             :     NASAKeywordHandler(const NASAKeywordHandler &) = delete;
      52             :     NASAKeywordHandler &operator=(const NASAKeywordHandler &) = delete;
      53             : 
      54             :   public:
      55             :     NASAKeywordHandler();
      56             :     ~NASAKeywordHandler();
      57             : 
      58         385 :     void SetStripSurroundingQuotes(bool bStripSurroundingQuotes)
      59             :     {
      60         385 :         m_bStripSurroundingQuotes = bStripSurroundingQuotes;
      61         385 :     }
      62             : 
      63             :     bool Ingest(VSILFILE *fp, int nOffset);
      64             :     bool Parse(const char *pszStr);
      65             : 
      66             :     const char *GetKeyword(const char *pszPath, const char *pszDefault);
      67             :     char **GetKeywordList();
      68             :     CPLJSONObject GetJsonObject() const;
      69             : };
      70             : 
      71             : //! @endcond
      72             : 
      73             : #endif  //  NASAKEYWORDHANDLER_H

Generated by: LCOV version 1.14