Isis Developer Reference
PvlTokenizer.h
Go to the documentation of this file.
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::ReadToParen
QString ReadToParen(std::istream &stream)
Definition: PvlTokenizer.cpp:353
Isis::PvlTokenizer::ReadToSingleQuote
QString ReadToSingleQuote(std::istream &stream)
Definition: PvlTokenizer.cpp:315
Isis::PvlTokenizer::Load
void Load(std::istream &stream, const QString &terminator="END")
Loads the Token list from a stream.
Definition: PvlTokenizer.cpp:48
Isis::Message::KeywordValueBad
QString KeywordValueBad(const QString &key)
This error should be used when a supplied keyword does not appear in the list (e.g....
Definition: KeywordValueBad.cpp:11
PvlTokenizer.h
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
IString.h
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::key
QString key() const
Returns the token keyword.
Definition: PvlToken.cpp:49
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
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
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::GetTokenList
std::vector< Isis::PvlToken > & GetTokenList()
Definition: PvlTokenizer.cpp:487
Isis::IException
Isis exception class.
Definition: IException.h:91
IException.h
std
Namespace for the standard library.
Isis::PvlTokenizer::ReadToDoubleQuote
QString ReadToDoubleQuote(std::istream &stream)
Definition: PvlTokenizer.cpp:277
Isis::Message::MissingDelimiter
QString MissingDelimiter(const char delimiter)
This error should be used when a delimiter is missing.
Definition: MissingDelimiter.cpp:15
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::PvlToken::addValue
void addValue(const QString &v)
Adds a value to the value-vector.
Definition: PvlToken.cpp:82
Isis::PvlTokenizer::PvlTokenizer
PvlTokenizer()
Constructs a Tokenizer with an empty token list.
Definition: PvlTokenizer.cpp:22
Isis::PvlTokenizer::ReadToBrace
QString ReadToBrace(std::istream &stream)
Definition: PvlTokenizer.cpp:397
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::PvlToken::keyUpper
QString keyUpper() const
Returns the token keyword in all uppercase characters.
Definition: PvlToken.cpp:58
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Message.h
PvlToken.h