15#include <QVarLengthArray>
20#include <nlohmann/json.hpp>
123 void setUnits(QString value, QString units);
134 return m_values.size();
136 bool isNull(
const int index = 0)
const;
140 friend std::ostream &
operator<<(std::ostream &os,
144 operator double()
const {
148 operator int()
const {
149 return toInt(
operator[](0));
156 operator QString()
const;
160 QString
unit(
const int index = 0)
const;
169 return (m_comments ? m_comments->size() : 0);
171 QString
comment(
const int index)
const;
180 if(!m_name && !key.m_name)
return true;
181 if(!m_name || !key.m_name)
return false;
192 return !(*
this == key);
195 bool isEquivalent(QString string1,
int index = 0)
const;
231 const QString &string2);
234 static QString
readLine(std::istream &is,
bool insideComment);
237 std::vector< QString > &keywordComments,
238 QString &keywordName,
239 std::vector< std::pair<QString, QString> >
242 static QString
readValue(QString &keyword,
bool "eProblem);
243 static QString
readValue(QString &keyword,
bool "eProblem,
244 const std::vector< std::pair<char, char> > &
253 QString
reform(
const QString &value)
const;
254 QString
toPvl(
const QString &value)
const;
255 QString
toIPvl(
const QString &value)
const;
257 const QString &textToWrite,
276 QVarLengthArray<QString, 1> m_values;
279 std::vector<QString> *m_units;
282 std::vector<QString> *m_comments;
286 void writeSpaces(std::ostream &,
int)
const;
A single keyword-value pair.
Definition PvlKeyword.h:87
PvlKeyword()
Constructs a blank PvlKeyword object.
Definition PvlKeyword.cpp:22
void setIndent(int indent)
Sets the indent level when outputted(for formatting)
Definition PvlKeyword.h:211
const QString & operator[](int index) const
Gets value for this object at specified index.
Definition PvlKeyword.cpp:397
void setName(QString name)
Sets the keyword name.
Definition PvlKeyword.cpp:120
friend std::istream & operator>>(std::istream &is, PvlKeyword &result)
Read in a keyword.
Definition PvlKeyword.cpp:966
void setJsonValue(nlohmann::json jsonobj, QString unit="")
Sets new value from Json.
Definition PvlKeyword.cpp:173
QString toIPvl(const QString &value) const
Converts a value to iPVL format.
Definition PvlKeyword.cpp:539
int width() const
Returns the current set longest keyword name.
Definition PvlKeyword.h:216
QString name() const
Returns the keyword name.
Definition PvlKeyword.h:103
int size() const
Returns the number of values stored in this keyword.
Definition PvlKeyword.h:133
PvlKeyword & operator+=(QString value)
Adds a value.
Definition PvlKeyword.cpp:342
bool isNull(const int index=0) const
Decides whether a value is null or not at a given index.
Definition PvlKeyword.cpp:102
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:1180
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:414
~PvlKeyword()
Destructs a PvlKeyword object.
Definition PvlKeyword.cpp:64
void setFormat(PvlFormat *formatter)
Set the PvlFormatter used to format the keyword name and value(s)
Definition PvlKeyword.cpp:942
friend std::ostream & operator<<(std::ostream &os, const PvlKeyword &keyword)
Write out the keyword.
Definition PvlKeyword.cpp:1830
int comments() const
Returns the number of lines of comments associated with this keyword.
Definition PvlKeyword.h:168
QString comment(const int index) const
Return a comment at the specified index.
Definition PvlKeyword.cpp:498
PvlFormat * m_formatter
Formatter object.
Definition PvlKeyword.h:262
bool operator==(const PvlKeyword &key) const
Returns true of the keyword names match.
Definition PvlKeyword.h:179
int indent() const
Returns the current indent level.
Definition PvlKeyword.h:221
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:515
void setUnits(QString units)
Sets the unit of measure for all current values if any exist.
Definition PvlKeyword.cpp:184
void setWidth(int width)
The width of the longest keyword name (for formatting)
Definition PvlKeyword.h:202
static bool stringEqual(const QString &string1, const QString &string2)
Checks to see if two QStrings are equal.
Definition PvlKeyword.cpp:592
bool operator!=(const PvlKeyword &key) const
Returns true of the keyword names do not match.
Definition PvlKeyword.h:191
bool isNamed(QString name) const
Determines whether two PvlKeywords have the same name or not.
Definition PvlKeyword.h:115
static QString readValue(QString &keyword, bool "eProblem)
Definition PvlKeyword.cpp:1611
PvlFormat * format()
Get the current PvlFormat or create one.
Definition PvlKeyword.cpp:953
void addCommentWrapped(QString comment)
Automatically wraps and adds long comments to the PvlKeyword.
Definition PvlKeyword.cpp:467
QString toPvl(const QString &value) const
Converts a value to PVL format.
Definition PvlKeyword.cpp:567
void addJsonValue(nlohmann::json jsonobj, QString unit="")
Adds a value with units.
Definition PvlKeyword.cpp:302
PvlKeyword & operator=(QString value)
Sets new values.
Definition PvlKeyword.cpp:247
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:668
void setValue(QString value, QString unit="")
Sets new values.
Definition PvlKeyword.cpp:155
void addComment(QString comment)
Add a comment to the PvlKeyword.
Definition PvlKeyword.cpp:433
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:619
void clearComment()
Clears the current comments.
Definition PvlKeyword.cpp:485
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:1159
static QString readLine(std::istream &is, bool insideComment)
This method reads one line of data from the input stream.
Definition PvlKeyword.cpp:1768
void clear()
Clears all values and units for this PvlKeyword object.
Definition PvlKeyword.cpp:348
void validateKeyword(PvlKeyword &pvlKwrd, QString psValueType="", PvlKeyword *pvlKwrdRange=NULL)
Validate Keyword for type and required values.
Definition PvlKeyword.cpp:1938
void addValue(QString value, QString unit="")
Adds a value with units.
Definition PvlKeyword.cpp:268
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