GDAL

cplkeywordparser.h
1/******************************************************************************
2 * $Id$
3 *
4 * Project: Common Portability Library
5 * Purpose: Implementation of CPLKeywordParser - a class for parsing
6 * the keyword format used for files like QuickBird .RPB files.
7 * This is a slight variation on the NASAKeywordParser used for
8 * the PDS/ISIS2/ISIS3 formats.
9 * Author: Frank Warmerdam <warmerdam@pobox.com
10 *
11 ******************************************************************************
12 * Copyright (c) 2008, Frank Warmerdam <warmerdam@pobox.com>
13 *
14 * SPDX-License-Identifier: MIT
15 ****************************************************************************/
16
17#ifndef CPL_KEYWORD_PARSER
18#define CPL_KEYWORD_PARSER
19
20#include "cpl_string.h"
21
22/************************************************************************/
23/* ==================================================================== */
24/* CPLKeywordParser */
25/* ==================================================================== */
26/************************************************************************/
27
30 class CPL_DLL CPLKeywordParser
31{
32 char **papszKeywordList = nullptr;
33
34 CPLString osHeaderText{};
35 const char *pszHeaderNext = nullptr;
36
37 void SkipWhite();
38 bool ReadWord(CPLString &osWord);
39 bool ReadPair(CPLString &osName, CPLString &osValue);
40 bool ReadGroup(const char *pszPathPrefix, int nRecLevel);
41
42 CPL_DISALLOW_COPY_ASSIGN(CPLKeywordParser)
43
44 public:
45 CPLKeywordParser();
46 ~CPLKeywordParser();
47
48 int Ingest(VSILFILE *fp);
49
50 const char *GetKeyword(const char *pszPath,
51 const char *pszDefault = nullptr);
52
53 char **GetAllKeywords()
54 {
55 return papszKeywordList;
56 }
57};
58
61#endif /* def CPL_KEYWORD_PARSER */
CPLString
Convenient string class based on std::string.
Definition: cpl_string.h:307
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1030
cpl_string.h
Various convenience functions for working with strings and string lists.
VSIVirtualHandle
Virtual file handle.
Definition: cpl_vsi_virtual.h:47