Isis 3 Programmer Reference
PvlTokenizer.h
1 #ifndef PvlTokenizer_h
2 #define PvlTokenizer_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <iostream>
10 #include "PvlToken.h"
11 
12 #include <QString>
13 
14 namespace Isis {
76  class PvlTokenizer {
77 
78  protected:
79  std::vector<Isis::PvlToken> tokens;
83  QString ReadComment(std::istream &stream);
84  QString ReadToken(std::istream &stream);
85  bool SkipWhiteSpace(std::istream &stream);
86  QString ReadToSingleQuote(std::istream &stream);
87  QString ReadToDoubleQuote(std::istream &stream);
88  QString ReadToParen(std::istream &stream);
89  QString ReadToBrace(std::istream &stream);
90  void ParseCommaList(Isis::PvlToken &t, const QString &cl);
91  void ValidateCharacter(int c);
92 
93  public:
94  PvlTokenizer();
95  ~PvlTokenizer();
96 
97  void Load(std::istream &stream, const QString &terminator = "END");
98  void Clear();
99 
100  std::vector<Isis::PvlToken> & GetTokenList();
101  };
102 };
103 
104 #endif
Isis::PvlTokenizer::Load
void Load(std::istream &stream, const QString &terminator="END")
Loads the Token list from a stream.
Definition: PvlTokenizer.cpp:48
Isis::PvlTokenizer::ValidateCharacter
void ValidateCharacter(int c)
Make sure a character is valid printable (non-control) character.
Definition: PvlTokenizer.cpp:496
Isis::PvlTokenizer::Clear
void Clear()
Empties the token list.
Definition: PvlTokenizer.cpp:32
Isis::PvlTokenizer::SkipWhiteSpace
bool SkipWhiteSpace(std::istream &stream)
Skips over whitespace so long as it is not inside quotes.
Definition: PvlTokenizer.cpp:257
Isis::PvlToken
Container for Keyword-value pair.
Definition: PvlToken.h:38
Isis::PvlTokenizer::~PvlTokenizer
~PvlTokenizer()
Destroys the Tokenizer object and token list.
Definition: PvlTokenizer.cpp:27
Isis::PvlTokenizer::tokens
std::vector< Isis::PvlToken > tokens
The array of Tokens parse out of the stream.
Definition: PvlTokenizer.h:79
Isis::PvlTokenizer
Construct Token list from a stream.
Definition: PvlTokenizer.h:76
Isis::PvlTokenizer::ParseCommaList
void ParseCommaList(Isis::PvlToken &t, const QString &cl)
This routine parses a QString containing a comma separated list.
Definition: PvlTokenizer.cpp:449
Isis::PvlTokenizer::PvlTokenizer
PvlTokenizer()
Constructs a Tokenizer with an empty token list.
Definition: PvlTokenizer.cpp:22
Isis::PvlTokenizer::ReadComment
QString ReadComment(std::istream &stream)
Reads and returns a comment from the stream.
Definition: PvlTokenizer.cpp:205
Isis::PvlTokenizer::ReadToken
QString ReadToken(std::istream &stream)
Reads and returns a token from the stream.
Definition: PvlTokenizer.cpp:233
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16