31 #include <QVarLengthArray>
133 void setUnits(QString value, QString units);
144 bool isNull(
const int index = 0)
const;
148 friend std::ostream &
operator<<(std::ostream &os,
152 operator double()
const {
156 operator int()
const {
157 return toInt(
operator[](0));
160 operator Isis::BigInt()
const {
164 operator QString()
const;
168 QString
unit(
const int index = 0)
const;
179 QString
comment(
const int index)
const;
200 return !(*
this == key);
203 bool isEquivalent(QString string1,
int index = 0)
const;
239 const QString &string2);
242 static QString
readLine(std::istream &is,
bool insideComment);
245 std::vector< QString > &keywordComments,
246 QString &keywordName,
247 std::vector< std::pair<QString, QString> >
250 static QString readValue(QString &keyword,
bool "eProblem);
251 static QString readValue(QString &keyword,
bool "eProblem,
252 const std::vector< std::pair<char, char> > &
261 QString
reform(
const QString &value)
const;
262 QString
toPvl(
const QString &value)
const;
263 QString
toIPvl(
const QString &value)
const;
265 const QString &textToWrite,
void init()
Clears all PvlKeyword data.
PvlKeyword & operator+=(QString value)
Adds a value.
int comments() const
Returns the number of lines of comments associated with this keyword.
Parse and return elements of a Pvl sequence.
int size() const
Returns the number of values stored in this keyword.
void clear()
Clears all values and units for this PvlKeyword object.
const QString & operator[](int index) const
Gets value for this object at specified index.
std::vector< QString > * m_comments
The comments for the keyword.
bool isNamed(QString name) const
Determines whether two PvlKeywords have the same name or not.
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.
void setIndent(int indent)
Sets the indent level when outputted(for formatting)
PvlKeyword()
Constructs a blank PvlKeyword object.
int toInt(const QString &string)
Global function to convert from a string to an integer.
void setName(QString name)
Sets the keyword name.
char * m_name
The keyword's name... This is a c-string for memory efficiency.
static QString readLine(std::istream &is, bool insideComment)
This method reads one line of data from the input stream.
void validateKeyword(PvlKeyword &pvlKwrd, QString psValueType="", PvlKeyword *pvlKwrdRange=NULL)
Validate Keyword for type and required values.
void setWidth(int width)
The width of the longest keyword name (for formatting)
static bool stringEqual(const QString &string1, const QString &string2)
Checks to see if two QStrings are equal.
BigInt toBigInt(const QString &string)
Global function to convert from a string to a "big" integer.
double toDouble(const QString &string)
Global function to convert from a string to a double.
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...
QString comment(const int index) const
Return a comment at the specified index.
int indent() const
Returns the current indent level.
void addComments(const std::vector< QString > &comments)
This method adds multiple comments at once by calling AddComments on each element in the vector...
void addComment(QString comment)
Add a comment to the PvlKeyword.
QString toIPvl(const QString &value) const
Converts a value to iPVL format.
int m_width
The width of the longest keyword.
void writeSpaces(std::ostream &, int) const
This writes numSpaces spaces to the ostream.
QVarLengthArray< QString, 1 > m_values
The values in the keyword.
bool isEquivalent(QString string1, int index=0) const
Checks to see if a value with a specified index is equivalent to another QString. ...
PvlFormat * format()
Get the current PvlFormat or create one.
void clearComment()
Clears the current comments.
QString name() const
Returns the keyword name.
QString toPvl(const QString &value) const
Converts a value to PVL format.
A single keyword-value pair.
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...
int width() const
Returns the current set longest keyword name.
friend std::istream & operator>>(std::istream &is, PvlKeyword &result)
Read in a keyword.
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...
void setUnits(QString units)
Sets the unit of measure for all current values if any exist.
friend std::ostream & operator<<(std::ostream &os, const PvlKeyword &keyword)
Write out the keyword.
bool isNull(const int index=0) const
Decides whether a value is null or not at a given index.
std::vector< QString > * m_units
The units for the values.
PvlFormat * m_formatter
Formatter object.
bool operator!=(const PvlKeyword &key) const
Returns true of the keyword names do not match.
int m_indent
The number of indentations to make.
~PvlKeyword()
Destructs a PvlKeyword object.
PvlKeyword & operator=(QString value)
Sets new values.
void setValue(QString value, QString unit="")
Sets new values.
bool operator==(const PvlKeyword &key) const
Returns true of the keyword names match.
void addCommentWrapped(QString comment)
Automatically wraps and adds long comments to the PvlKeyword.
void setFormat(PvlFormat *formatter)
Set the PvlFormatter used to format the keyword name and value(s)
void addValue(QString value, QString unit="")
Adds a value with units.