15#include <QVarLengthArray>
20#include <nlohmann/json.hpp>
127 void setUnits(QString value, QString units);
139 return m_values.size();
141 bool isNull(
const int index = 0)
const;
145 friend std::ostream &
operator<<(std::ostream &os,
149 operator double()
const {
149 operator double()
const {
…}
153 operator int()
const {
154 return toInt(
operator[](0));
153 operator int()
const {
…}
161 operator QString()
const;
167 QString
unit(
const int index = 0)
const;
176 return (m_comments ? m_comments->size() : 0);
178 QString
comment(
const int index)
const;
187 if(!m_name && !key.m_name)
return true;
188 if(!m_name || !key.m_name)
return false;
199 return !(*
this == key);
202 bool isEquivalent(QString string1,
int index = 0)
const;
238 const QString &string2);
241 static QString
readLine(std::istream &is,
bool insideComment);
244 std::vector< QString > &keywordComments,
245 QString &keywordName,
246 std::vector< std::pair<QString, QString> >
249 static QString
readValue(QString &keyword,
bool "eProblem);
250 static QString
readValue(QString &keyword,
bool "eProblem,
251 const std::vector< std::pair<char, char> > &
260 QString
reform(
const QString &value)
const;
261 QString
toPvl(
const QString &value)
const;
262 QString
toIPvl(
const QString &value)
const;
264 const QString &textToWrite,
283 QVarLengthArray<QString, 1> m_values;
286 std::vector<QString> *m_units;
289 std::vector<QString> *m_comments;
293 void writeSpaces(std::ostream &,
int)
const;
A single keyword-value pair.
Definition PvlKeyword.h:87
PvlKeyword()
Constructs a blank PvlKeyword object.
Definition PvlKeyword.cpp:25
void setIndent(int indent)
Sets the indent level when outputted(for formatting)
Definition PvlKeyword.h:218
const QString & operator[](int index) const
Gets value for this object at specified index.
Definition PvlKeyword.cpp:494
void setName(QString name)
Sets the keyword name.
Definition PvlKeyword.cpp:141
friend std::istream & operator>>(std::istream &is, PvlKeyword &result)
Read in a keyword.
Definition PvlKeyword.cpp:1063
QString toIPvl(const QString &value) const
Converts a value to iPVL format.
Definition PvlKeyword.cpp:636
int width() const
Returns the current set longest keyword name.
Definition PvlKeyword.h:223
QString name() const
Returns the keyword name.
Definition PvlKeyword.h:105
int size() const
Returns the number of values stored in this keyword.
Definition PvlKeyword.h:138
PvlKeyword & operator+=(QString value)
Adds a value.
Definition PvlKeyword.cpp:439
void setJsonArrayValue(nlohmann::json jsonobj)
sets multiple items from a json array.
Definition PvlKeyword.cpp:418
bool isNull(const int index=0) const
Decides whether a value is null or not at a given index.
Definition PvlKeyword.cpp:123
static bool readCleanKeyword(QString keyword, std::vector< QString > &keywordComments, QString &keywordName, std::vector< std::pair< QString, QString > > &keywordValues)
This reads a keyword compressed back to 1 line of data (excluding comments, which are included on sep...
Definition PvlKeyword.cpp:1277
QString unit(const int index=0) const
Returns the units of measurement of the element of the array of values for the object at the specifie...
Definition PvlKeyword.cpp:511
~PvlKeyword()
Destructs a PvlKeyword object.
Definition PvlKeyword.cpp:85
void setFormat(PvlFormat *formatter)
Set the PvlFormatter used to format the keyword name and value(s)
Definition PvlKeyword.cpp:1039
friend std::ostream & operator<<(std::ostream &os, const PvlKeyword &keyword)
Write out the keyword.
Definition PvlKeyword.cpp:1944
int comments() const
Returns the number of lines of comments associated with this keyword.
Definition PvlKeyword.h:175
QString comment(const int index) const
Return a comment at the specified index.
Definition PvlKeyword.cpp:595
PvlFormat * m_formatter
Formatter object.
Definition PvlKeyword.h:269
bool operator==(const PvlKeyword &key) const
Returns true of the keyword names match.
Definition PvlKeyword.h:186
int indent() const
Returns the current indent level.
Definition PvlKeyword.h:228
QString reform(const QString &value) const
Checks if the value needs to be converted to PVL or iPVL and returns it in the correct format.
Definition PvlKeyword.cpp:612
void setUnits(QString units)
Sets the unit of measure for all current values if any exist.
Definition PvlKeyword.cpp:204
void setWidth(int width)
The width of the longest keyword name (for formatting)
Definition PvlKeyword.h:209
static bool stringEqual(const QString &string1, const QString &string2)
Checks to see if two QStrings are equal.
Definition PvlKeyword.cpp:689
bool operator!=(const PvlKeyword &key) const
Returns true of the keyword names do not match.
Definition PvlKeyword.h:198
bool isNamed(QString name) const
Determines whether two PvlKeywords have the same name or not.
Definition PvlKeyword.h:117
static QString readValue(QString &keyword, bool "eProblem)
Definition PvlKeyword.cpp:1725
PvlFormat * format()
Get the current PvlFormat or create one.
Definition PvlKeyword.cpp:1050
void addCommentWrapped(QString comment)
Automatically wraps and adds long comments to the PvlKeyword.
Definition PvlKeyword.cpp:564
nlohmann::json toJson()
Definition PvlKeyword.cpp:384
PvlKeyword(QString name, std::vector< std::string > vecValue, QString unit="")
QString toPvl(const QString &value) const
Converts a value to PVL format.
Definition PvlKeyword.cpp:664
PvlKeyword & operator=(QString value)
Sets new values.
Definition PvlKeyword.cpp:267
std::ostream & writeWithWrap(std::ostream &os, const QString &textToWrite, int startColumn, PvlFormat &format) const
Wraps output so that length doesn't exceed the character limit.
Definition PvlKeyword.cpp:765
void setValue(QString value, QString unit="")
Sets new values.
Definition PvlKeyword.cpp:176
void addComment(QString comment)
Add a comment to the PvlKeyword.
Definition PvlKeyword.cpp:530
bool isEquivalent(QString string1, int index=0) const
Checks to see if a value with a specified index is equivalent to another QString.
Definition PvlKeyword.cpp:716
void setJsonValue(nlohmann::json jsonobj)
Sets new value from Json.
Definition PvlKeyword.cpp:194
void clearComment()
Clears the current comments.
Definition PvlKeyword.cpp:582
void addComments(const std::vector< QString > &comments)
This method adds multiple comments at once by calling AddComments on each element in the vector.
Definition PvlKeyword.cpp:1256
static QString readLine(std::istream &is, bool insideComment)
This method reads one line of data from the input stream.
Definition PvlKeyword.cpp:1882
void clear()
Clears all values and units for this PvlKeyword object.
Definition PvlKeyword.cpp:445
void validateKeyword(PvlKeyword &pvlKwrd, QString psValueType="", PvlKeyword *pvlKwrdRange=NULL)
Validate Keyword for type and required values.
Definition PvlKeyword.cpp:2052
void addJsonArrayValue(nlohmann::json jsonobj)
Adds multiple items from a json array.
Definition PvlKeyword.cpp:366
void addJsonValue(nlohmann::json jsonobj)
Adds a value with units.
Definition PvlKeyword.cpp:322
void addValue(QString value, QString unit="")
Adds a value with units.
Definition PvlKeyword.cpp:288
Parse and return elements of a Pvl sequence.
Definition PvlSequence.h:46
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition IString.cpp:93
BigInt toBigInt(const QString &string)
Global function to convert from a string to a "big" integer.
Definition IString.cpp:115
long long int BigInt
Big int.
Definition Constants.h:49
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition IString.cpp:149