GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

nasakeywordhandler.h
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 * Permission is hereby granted, free of charge, to any person obtaining a
16 * copy of this software and associated documentation files (the "Software"),
17 * to deal in the Software without restriction, including without limitation
18 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
19 * and/or sell copies of the Software, and to permit persons to whom the
20 * Software is furnished to do so, subject to the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included
23 * in all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
26 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
28 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
31 * DEALINGS IN THE SOFTWARE.
32 ****************************************************************************/
33
34 #ifndef NASAKEYWORDHANDLER_H
35 #define NASAKEYWORDHANDLER_H
36
38
39 #include "cpl_json.h"
40 #include "cpl_string.h"
41
42 /************************************************************************/
43 /* ==================================================================== */
44 /* NASAKeywordHandler */
45 /* ==================================================================== */
46 /************************************************************************/
47
48 // Only exported for HDF4 plugin needs. Do not use outside of GDAL please.
49
50 class CPL_DLL NASAKeywordHandler
51 {
52 char **papszKeywordList = nullptr;
53
54 CPLString osHeaderText{};
55 const char *pszHeaderNext = nullptr;
56
57 CPLJSONObject oJSon{};
58
59 bool m_bStripSurroundingQuotes = false;
60
61 void SkipWhite();
62 int ReadWord( CPLString &osWord,
63 bool bStripSurroundingQuotes = false,
64 bool bParseList = false,
65 bool* pbIsString = nullptr);
66 int ReadPair( CPLString &osName, CPLString &osValue, CPLJSONObject &oCur );
67 int ReadGroup( const char *pszPathPrefix, CPLJSONObject &oCur, int nRecLevel );
68
69 NASAKeywordHandler(const NASAKeywordHandler&) = delete;
70 NASAKeywordHandler& operator=(const NASAKeywordHandler&) = delete;
71
72 public:
73 NASAKeywordHandler();
74 ~NASAKeywordHandler();
75
76 void SetStripSurroundingQuotes( bool bStripSurroundingQuotes )
77 { m_bStripSurroundingQuotes = bStripSurroundingQuotes; }
78
79 int Ingest( VSILFILE *fp, int nOffset );
80
81 const char *GetKeyword( const char *pszPath, const char *pszDefault );
82 char **GetKeywordList();
83 CPLJSONObject GetJsonObject() const;
84 };
85
87
88 #endif // NASAKEYWORDHANDLER_H
VSILFILE
FILE VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition: cpl_vsi.h:156
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:332
CPLJSONObject
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:53
cpl_string.h
Various convenience functions for working with strings and string lists.
cpl_json.h
Interface for read and write JSON documents.