Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: VICAR Driver; JPL/MIPL VICAR Format 4 : * Purpose: Implementation of VICARKeywordHandler - a class to read 5 : * keyword data from VICAR data products. 6 : * Authors: Sebastian Walter <sebastian dot walter at fu-berlin dot de> 7 : * 8 : * NOTE: This driver code is loosely based on the ISIS and PDS drivers. 9 : * It is not intended to diminish the contribution of the authors. 10 : ****************************************************************************** 11 : * Copyright (c) 2014, Sebastian Walter <sebastian dot walter at fu-berlin dot 12 : *de> 13 : * 14 : * SPDX-License-Identifier: MIT 15 : ****************************************************************************/ 16 : 17 : #ifndef VICARKEYWORDHANDLER_H 18 : #define VICARKEYWORDHANDLER_H 19 : 20 : #include "cpl_json.h" 21 : 22 : class VICARKeywordHandler 23 : { 24 : char **papszKeywordList{}; 25 : 26 : CPLString osHeaderText{}; 27 : const char *pszHeaderNext{}; 28 : 29 : CPLJSONObject oJSon{}; 30 : 31 : void SkipWhite(); 32 : bool ReadName(CPLString &osWord); 33 : bool ReadValue(CPLString &osWord, bool bInList, bool &bIsString); 34 : bool ReadPair(CPLString &osName, CPLString &osValue, CPLJSONObject &oCur); 35 : bool Parse(); 36 : 37 : CPL_DISALLOW_COPY_ASSIGN(VICARKeywordHandler) 38 : 39 : public: 40 : VICARKeywordHandler(); 41 : ~VICARKeywordHandler(); 42 : 43 : bool Ingest(VSILFILE *fp, const GByte *pabyHeader); 44 : 45 : const char *GetKeyword(const char *pszPath, const char *pszDefault) const; 46 : 47 113 : const CPLJSONObject &GetJsonObject() const 48 : { 49 113 : return oJSon; 50 : } 51 : }; 52 : 53 : #endif // VICARKEYWORDHANDLER_H