/src/gdal/port/cplkeywordparser.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
27 | | /*! @cond Doxygen_Suppress */ |
28 | | |
29 | | class 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 | 0 | { |
54 | 0 | return papszKeywordList; |
55 | 0 | } |
56 | | }; |
57 | | |
58 | | /*! @endcond */ |
59 | | |
60 | | #endif /* def CPL_KEYWORD_PARSER */ |