15#include <QVarLengthArray>
20#include <nlohmann/json.hpp>
125 void setUnits(QString value, QString units);
136 return m_values.size();
138 bool isNull(
const int index = 0)
const;
142 friend std::ostream &
operator<<(std::ostream &os,
146 operator double()
const {
150 operator int()
const {
151 return toInt(
operator[](0));
158 operator QString()
const;
162 QString
unit(
const int index = 0)
const;
171 return (m_comments ? m_comments->size() : 0);
173 QString
comment(
const int index)
const;
182 if(!m_name && !key.m_name)
return true;
183 if(!m_name || !key.m_name)
return false;
194 return !(*
this == key);
197 bool isEquivalent(QString string1,
int index = 0)
const;
233 const QString &string2);
236 static QString
readLine(std::istream &is,
bool insideComment);
239 std::vector< QString > &keywordComments,
240 QString &keywordName,
241 std::vector< std::pair<QString, QString> >
244 static QString
readValue(QString &keyword,
bool "eProblem);
245 static QString
readValue(QString &keyword,
bool "eProblem,
246 const std::vector< std::pair<char, char> > &
255 QString
reform(
const QString &value)
const;
256 QString
toPvl(
const QString &value)
const;
257 QString
toIPvl(
const QString &value)
const;
259 const QString &textToWrite,
278 QVarLengthArray<QString, 1> m_values;
281 std::vector<QString> *m_units;
284 std::vector<QString> *m_comments;
288 void writeSpaces(std::ostream &,
int)
const;
A single keyword-value pair.
Definition PvlKeyword.h:87
PvlKeyword()
Constructs a blank PvlKeyword object.
Definition PvlKeyword.cpp:24
void setIndent(int indent)
Sets the indent level when outputted(for formatting)
Definition PvlKeyword.h:213
const QString & operator[](int index) const
Gets value for this object at specified index.
Definition PvlKeyword.cpp:417
void setName(QString name)
Sets the keyword name.
Definition PvlKeyword.cpp:140
friend std::istream & operator>>(std::istream &is, PvlKeyword &result)
Read in a keyword.
Definition PvlKeyword.cpp:986
void setJsonValue(nlohmann::json jsonobj, QString unit="")
Sets new value from Json.
Definition PvlKeyword.cpp:193
QString toIPvl(const QString &value) const
Converts a value to iPVL format.
Definition PvlKeyword.cpp:559
int width() const
Returns the current set longest keyword name.
Definition PvlKeyword.h:218
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:135
PvlKeyword & operator+=(QString value)
Adds a value.
Definition PvlKeyword.cpp:362
bool isNull(const int index=0) const
Decides whether a value is null or not at a given index.
Definition PvlKeyword.cpp:122
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:1200
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:434
~PvlKeyword()
Destructs a PvlKeyword object.
Definition PvlKeyword.cpp:84
void setFormat(PvlFormat *formatter)
Set the PvlFormatter used to format the keyword name and value(s)
Definition PvlKeyword.cpp:962
friend std::ostream & operator<<(std::ostream &os, const PvlKeyword &keyword)
Write out the keyword.
Definition PvlKeyword.cpp:1867
int comments() const
Returns the number of lines of comments associated with this keyword.
Definition PvlKeyword.h:170
QString comment(const int index) const
Return a comment at the specified index.
Definition PvlKeyword.cpp:518
PvlFormat * m_formatter
Formatter object.
Definition PvlKeyword.h:264
bool operator==(const PvlKeyword &key) const
Returns true of the keyword names match.
Definition PvlKeyword.h:181
int indent() const
Returns the current indent level.
Definition PvlKeyword.h:223
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:535
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:204
static bool stringEqual(const QString &string1, const QString &string2)
Checks to see if two QStrings are equal.
Definition PvlKeyword.cpp:612
bool operator!=(const PvlKeyword &key) const
Returns true of the keyword names do not match.
Definition PvlKeyword.h:193
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:1648
PvlFormat * format()
Get the current PvlFormat or create one.
Definition PvlKeyword.cpp:973
void addCommentWrapped(QString comment)
Automatically wraps and adds long comments to the PvlKeyword.
Definition PvlKeyword.cpp:487
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:587
void addJsonValue(nlohmann::json jsonobj, QString unit="")
Adds a value with units.
Definition PvlKeyword.cpp:322
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:688
void setValue(QString value, QString unit="")
Sets new values.
Definition PvlKeyword.cpp:175
void addComment(QString comment)
Add a comment to the PvlKeyword.
Definition PvlKeyword.cpp:453
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:639
void clearComment()
Clears the current comments.
Definition PvlKeyword.cpp:505
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:1179
static QString readLine(std::istream &is, bool insideComment)
This method reads one line of data from the input stream.
Definition PvlKeyword.cpp:1805
void clear()
Clears all values and units for this PvlKeyword object.
Definition PvlKeyword.cpp:368
void validateKeyword(PvlKeyword &pvlKwrd, QString psValueType="", PvlKeyword *pvlKwrdRange=NULL)
Validate Keyword for type and required values.
Definition PvlKeyword.cpp:1975
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