GDAL
cplkeywordparser.h
1/******************************************************************************
2 *
3 * Project: Common Portability Library
4 * Purpose: Implementation of CPLKeywordParser - a class for parsing
5 * the keyword format used for files like QuickBird .RPB files.
6 * This is a slight variation on the NASAKeywordParser used for
7 * the PDS/ISIS2/ISIS3 formats.
8 * Author: Frank Warmerdam <warmerdam@pobox.com
9 *
10 ******************************************************************************
11 * Copyright (c) 2008, Frank Warmerdam <warmerdam@pobox.com>
12 *
13 * SPDX-License-Identifier: MIT
14 ****************************************************************************/
15
16#ifndef CPL_KEYWORD_PARSER
17#define CPL_KEYWORD_PARSER
18
19#include "cpl_string.h"
20
21/************************************************************************/
22/* ==================================================================== */
23/* CPLKeywordParser */
24/* ==================================================================== */
25/************************************************************************/
26
28
29class CPL_DLL CPLKeywordParser
30{
31 char **papszKeywordList = nullptr;
32
33 CPLString osHeaderText{};
34 const char *pszHeaderNext = nullptr;
35
36 void SkipWhite();
37 bool ReadWord(CPLString &osWord);
38 bool ReadPair(CPLString &osName, CPLString &osValue);
39 bool ReadGroup(const char *pszPathPrefix, int nRecLevel);
40
41 CPL_DISALLOW_COPY_ASSIGN(CPLKeywordParser)
42
43 public:
44 CPLKeywordParser();
45 ~CPLKeywordParser();
46
47 int Ingest(VSILFILE *fp);
48
49 const char *GetKeyword(const char *pszPath,
50 const char *pszDefault = nullptr);
51
52 char **GetAllKeywords()
53 {
54 return papszKeywordList;
55 }
56};
57
59
60#endif /* def CPL_KEYWORD_PARSER */
#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:936
Various convenience functions for working with strings and string lists.
struct VSIVirtualHandle VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition cpl_vsi.h:141