Isis 3 Programmer Reference
Isis::PvlKeyword Class Reference

A single keyword-value pair. More...

#include <PvlKeyword.h>

Collaboration diagram for Isis::PvlKeyword:
Collaboration graph

Public Member Functions

 PvlKeyword ()
 Constructs a blank PvlKeyword object. More...
 
 PvlKeyword (QString name)
 Constructs a PvlKeyword object with a name. More...
 
 PvlKeyword (QString name, QString value, QString unit="")
 Constructs a PvlKeyword object with a name, value and units. More...
 
 PvlKeyword (const PvlKeyword &other)
 Copy constructor. More...
 
 ~PvlKeyword ()
 Destructs a PvlKeyword object. More...
 
void setName (QString name)
 Sets the keyword name. More...
 
QString name () const
 Returns the keyword name. More...
 
bool isNamed (QString name) const
 Determines whether two PvlKeywords have the same name or not. More...
 
void setValue (QString value, QString unit="")
 Sets new values. More...
 
void setUnits (QString units)
 Sets the unit of measure for all current values if any exist. More...
 
void setUnits (QString value, QString units)
 Sets the unit of measure for a given value. More...
 
PvlKeywordoperator= (QString value)
 Sets new values. More...
 
void addValue (QString value, QString unit="")
 Adds a value with units. More...
 
PvlKeywordoperator+= (QString value)
 Adds a value. More...
 
int size () const
 Returns the number of values stored in this keyword. More...
 
bool isNull (const int index=0) const
 Decides whether a value is null or not at a given index. More...
 
void clear ()
 Clears all values and units for this PvlKeyword object. More...
 
 operator double () const
 Returns the first value in this keyword converted to a double. More...
 
 operator int () const
 Returns the first value in this keyword converted to an integer. More...
 
 operator Isis::BigInt () const
 Returns the first value in this keyword converted to a BigInt. More...
 
 operator QString () const
 
const QString & operator[] (int index) const
 Gets value for this object at specified index. More...
 
QString & operator[] (int index)
 Gets value for this object at specified index. More...
 
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 specified index. More...
 
void addComment (QString comment)
 Add a comment to the PvlKeyword. More...
 
void addCommentWrapped (QString comment)
 Automatically wraps and adds long comments to the PvlKeyword. More...
 
void addComments (const std::vector< QString > &comments)
 This method adds multiple comments at once by calling AddComments on each element in the vector. More...
 
int comments () const
 Returns the number of lines of comments associated with this keyword. More...
 
QString comment (const int index) const
 Return a comment at the specified index. More...
 
void clearComment ()
 Clears the current comments. More...
 
bool operator== (const PvlKeyword &key) const
 Returns true of the keyword names match. More...
 
bool operator!= (const PvlKeyword &key) const
 Returns true of the keyword names do not match. More...
 
bool isEquivalent (QString string1, int index=0) const
 Checks to see if a value with a specified index is equivalent to another QString. More...
 
void setWidth (int width)
 The width of the longest keyword name (for formatting) More...
 
void setIndent (int indent)
 Sets the indent level when outputted(for formatting) More...
 
int width () const
 Returns the current set longest keyword name. More...
 
int indent () const
 Returns the current indent level. More...
 
PvlKeywordoperator= (Isis::PvlSequence &seq)
 Add values and units from a PvlSequence. More...
 
void setFormat (PvlFormat *formatter)
 Set the PvlFormatter used to format the keyword name and value(s) More...
 
PvlFormatformat ()
 Get the current PvlFormat or create one. More...
 
const PvlKeywordoperator= (const PvlKeyword &other)
 This is an assignment operator. More...
 
void validateKeyword (PvlKeyword &pvlKwrd, QString psValueType="", PvlKeyword *pvlKwrdRange=NULL)
 Validate Keyword for type and required values. More...
 

Static Public Member Functions

static bool stringEqual (const QString &string1, const QString &string2)
 Checks to see if two QStrings are equal. More...
 
static QString readLine (std::istream &is, bool insideComment)
 This method reads one line of data from the input stream. More...
 
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 separate lines of data before the keyword). More...
 
static QString readValue (QString &keyword, bool &quoteProblem)
 
static QString readValue (QString &keyword, bool &quoteProblem, const std::vector< std::pair< char, char > > &otherDelimiters)
 This method looks for a data element in the QString. More...
 

Protected Member Functions

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. More...
 
QString toPvl (const QString &value) const
 Converts a value to PVL format. More...
 
QString toIPvl (const QString &value) const
 Converts a value to iPVL format. More...
 
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. More...
 

Protected Attributes

PvlFormatm_formatter
 Formatter object. More...
 

Private Member Functions

void init ()
 Clears all PvlKeyword data. More...
 
void writeSpaces (std::ostream &, int) const
 This writes numSpaces spaces to the ostream. More...
 

Private Attributes

char * m_name
 The keyword's name... This is a c-string for memory efficiency. More...
 
QVarLengthArray< QString, 1 > m_values
 The values in the keyword. More...
 
std::vector< QString > * m_units
 The units for the values. More...
 
std::vector< QString > * m_comments
 The comments for the keyword. More...
 
int m_width
 The width of the longest keyword. More...
 
int m_indent
 The number of indentations to make. More...
 

Friends

std::istream & operator>> (std::istream &is, PvlKeyword &result)
 Read in a keyword. More...
 
std::ostream & operator<< (std::ostream &os, const PvlKeyword &keyword)
 Write out the keyword. More...
 

Detailed Description

A single keyword-value pair.

This class is used to create a single PVL keyword-value pair. PvlContainer can combine PvlKeyword objects and organize them so they look clean on output.

Author
2002-10-11 Jeff Anderson
History:

2005-04-08 Leah Dahmer - Wrote class documentation.

2005-04-08 Leah Dahmer - Added the writeWithWrap() method so keyword values will now be wrapped when the length exceeds 80 characters.

2005-05-18 Jeff Anderson - Fixed minor problems with wrapping code.

2006-04-05 Elizabeth Miller - Added AddCommentWrapped() method.

2006-09-05 Stuart Sides - Added ability to format keywords in different ways using the PvlFormat class.

2007-08-20 Brendan George - Added checking to ensure Keyword Name contains no whitespace.

2008-02-08 Christopher Austin - Altered WriteWithWrap to not bomb when 2 or more single statement lines in a row are over 78 characters long.

2008-07-03 Steven Lambright - Added const functionality.

2008-07-10 Steven Lambright - stringEqual is now static, all AddComments methods are public.

2008-09-30 Christopher Austin - replaced all std::endl in the << operator as well as writeWithWrap() with PvlFormat.FormatEOL(), and formatted wraps accordingly.

2009-08-18 Eric Hyer - Added both SetUnits methods and ASSERT macro.

2009-09-09 Steven Lambright - Removed ASSERT macro, fixed formatting of error in SetUnits, and fixed text wrapping when a single array element needed split up into multiple lines.

2009-12-07 Steven Lambright - Added stream input operator for reading.

2010-01-19 Travis Addair - Added SetCharLimit method allowing users to set the point at which a keyword value is output to the next line down.

2010-02-04 Travis Addair - Moved the SetCharLimit method to PvlFormat class.

2010-04-13 Eric Hyer - Added copy constructor. Added assignment operator.

2010-06-25 Steven Lambright - NULLs ('\0') now count as binary.

2010-09-27 Sharmila Prasad - API to Validate a Keyword for type and values.

2010-10-18 Sharmila Prasad - Added more options for the keyword validation.

2011-04-12 Steven Lambright - Lessened the memory footprint by changing m_comments and m_units to pointers, m_values to a QVarLengthArray and m_name to a char *.

2011-07-07 Sharmila Prasad - While validating keyword, display appropriate error msg when converting string to integer which has a double value.

2013-03-11 Steven Lambright and Mathew Eis - Brought method names and member variable names up to the current Isis 3 coding standards. Fixes #1533.

2013-06-05 Tracie Sucharski - When splitting keywords make sure the continuation lines does not start with "//" since Isis Pvl considers that a comment. Fixes #1230.

2014-05-13 Jeannie Backer - Changed operator[] error message to construct a QString from the m_name char* instead of using the toString() method. The call to this method was using toString(bool) and always printing the QString "Yes" instead of the keyword name. Added padding on control statements to bring the code closer to ISIS Coding Standards. References #1659.

Definition at line 98 of file PvlKeyword.h.

Constructor & Destructor Documentation

◆ PvlKeyword() [1/4]

Isis::PvlKeyword::PvlKeyword ( )

Constructs a blank PvlKeyword object.

Definition at line 38 of file PvlKeyword.cpp.

◆ PvlKeyword() [2/4]

Isis::PvlKeyword::PvlKeyword ( QString  name)

Constructs a PvlKeyword object with a name.

Parameters
nameThe keyword name

Definition at line 48 of file PvlKeyword.cpp.

◆ PvlKeyword() [3/4]

Isis::PvlKeyword::PvlKeyword ( QString  name,
QString  value,
QString  unit = "" 
)

Constructs a PvlKeyword object with a name, value and units.

Defaults to unit="".

Parameters
nameThe keyword name.
valueThe keyword values.
unitThe units the values are given in.

Definition at line 62 of file PvlKeyword.cpp.

◆ PvlKeyword() [4/4]

Isis::PvlKeyword::PvlKeyword ( const PvlKeyword other)

Copy constructor.

Definition at line 71 of file PvlKeyword.cpp.

◆ ~PvlKeyword()

Isis::PvlKeyword::~PvlKeyword ( )

Destructs a PvlKeyword object.

Definition at line 80 of file PvlKeyword.cpp.

Member Function Documentation

◆ addComment()

void Isis::PvlKeyword::addComment ( QString  comment)

Add a comment to the PvlKeyword.

Parameters
commentThe new comment.
See also
addCommentWrapped()
addComments()
clearComment()

Definition at line 392 of file PvlKeyword.cpp.

Referenced by Isis::CameraPointInfo::GetPointInfo(), and Isis::ControlNetVersioner::toPvl().

◆ addComments()

void Isis::PvlKeyword::addComments ( const std::vector< QString > &  comments)

This method adds multiple comments at once by calling AddComments on each element in the vector.

Parameters
commentsComments to associate with this keyword

Definition at line 1118 of file PvlKeyword.cpp.

Referenced by Isis::operator>>().

◆ addCommentWrapped()

void Isis::PvlKeyword::addCommentWrapped ( QString  comment)

Automatically wraps and adds long comments to the PvlKeyword.

Parameters
commentThe new comment to add
See also
addComment()
addComments()
clearComment()

Definition at line 426 of file PvlKeyword.cpp.

References Isis::IString::Token().

◆ addValue()

void Isis::PvlKeyword::addValue ( QString  value,
QString  unit = "" 
)

Adds a value with units.

If no current value exists, this method sets the given value. Otherwise, it retains any current values and adds the value given to the array of values for this PvlKeyword object. Defaults to unit = "" (empty QString).

Parameters
valueNew value to be assigned.
unitUnits of measurement corresponding to the value.
See also
setValue()
operator=
operator+=

Definition at line 268 of file PvlKeyword.cpp.

Referenced by Isis::DbProfile::add(), Isis::ControlNetDiff::addUniqueMeasure(), Isis::ControlNetDiff::addUniquePoint(), IsisAml::CommandLine(), Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::UserInterface::evaluateOption(), Isis::CameraPointInfo::GetPointInfo(), Isis::RosettaVirtisCamera::getPointingTable(), Isis::DawnVirCamera::getPointingTable(), Isis::ControlNetDiff::makeKeyword(), and Isis::operator>>().

◆ clear()

void Isis::PvlKeyword::clear ( )

Clears all values and units for this PvlKeyword object.

Definition at line 307 of file PvlKeyword.cpp.

Referenced by Isis::ImportPdsTable::loadLabel(), and Isis::operator>>().

◆ clearComment()

void Isis::PvlKeyword::clearComment ( )

Clears the current comments.

Definition at line 444 of file PvlKeyword.cpp.

◆ comment()

QString Isis::PvlKeyword::comment ( const int  index) const

Return a comment at the specified index.

Parameters
indexThe index of the comment.
Returns
QString The comment at the index.
Exceptions
iExceptionArraySubscriptNotInRange (index) Index out of bounds.

Definition at line 457 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

Referenced by Isis::operator<<().

◆ comments()

int Isis::PvlKeyword::comments ( ) const
inline

Returns the number of lines of comments associated with this keyword.

Definition at line 176 of file PvlKeyword.h.

References m_comments.

Referenced by Isis::operator<<().

◆ format()

PvlFormat * Isis::PvlKeyword::format ( )

Get the current PvlFormat or create one.

Returns
PvlFormat* Pointer to PvlFormat.

Definition at line 912 of file PvlKeyword.cpp.

◆ indent()

int Isis::PvlKeyword::indent ( ) const
inline

Returns the current indent level.

Definition at line 229 of file PvlKeyword.h.

References m_indent.

Referenced by Isis::operator<<(), and setIndent().

◆ init()

void Isis::PvlKeyword::init ( )
private

Clears all PvlKeyword data.

Definition at line 99 of file PvlKeyword.cpp.

◆ isEquivalent()

bool Isis::PvlKeyword::isEquivalent ( QString  QString1,
int  index = 0 
) const

Checks to see if a value with a specified index is equivalent to another QString.

Parameters
QString1The QString to compare the value to.
indexThe index of the existing value.
Returns
bool True if the two QStrings are equivalent, false if they're not.
Exceptions
iExceptionArraySubscriptNotInRange (index) Index out of bounds.

Definition at line 578 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

◆ isNamed()

bool Isis::PvlKeyword::isNamed ( QString  name) const
inline

Determines whether two PvlKeywords have the same name or not.

Parameters
nameThe name of the keyword to compare with this one.
Returns
True if the names are equal, false if not.

Definition at line 126 of file PvlKeyword.h.

References name(), and stringEqual().

Referenced by Isis::ImageFileListWidget::find(), Isis::KernelDb::findAll(), Isis::KernelDb::loadKernelDbFiles(), and Isis::KernelDb::matches().

◆ isNull()

bool Isis::PvlKeyword::isNull ( const int  index = 0) const

Decides whether a value is null or not at a given index.

Defaults to index = 0.

Parameters
indexThe value index
Returns
bool True if the value is null, false if it's not.

Definition at line 118 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

Referenced by Isis::Kernels::findKernels().

◆ name()

◆ operator double()

Isis::PvlKeyword::operator double ( ) const
inline

Returns the first value in this keyword converted to a double.

Definition at line 152 of file PvlKeyword.h.

References Isis::toDouble().

◆ operator int()

Isis::PvlKeyword::operator int ( ) const
inline

Returns the first value in this keyword converted to an integer.

Definition at line 156 of file PvlKeyword.h.

References Isis::toInt().

◆ operator Isis::BigInt()

Isis::PvlKeyword::operator Isis::BigInt ( ) const
inline

Returns the first value in this keyword converted to a BigInt.

Definition at line 160 of file PvlKeyword.h.

References Isis::toBigInt().

◆ operator!=()

bool Isis::PvlKeyword::operator!= ( const PvlKeyword key) const
inline

Returns true of the keyword names do not match.

Parameters
keyThe keyword to compare names with

Definition at line 199 of file PvlKeyword.h.

◆ operator+=()

PvlKeyword & Isis::PvlKeyword::operator+= ( QString  value)

Adds a value.

Overwrites the '+=' operators to add a new value. Like addValue(), this method keeps any previously existing values and adds the new value with unit = "" (empty QString) to the array of values for this PvlKeyword object.

Parameters
valueThe new value.
Returns
PvlKeyword& Reference to PvlKeyword object.
See also
addValue()
setValue()
operator=

Definition at line 301 of file PvlKeyword.cpp.

◆ operator=() [1/3]

PvlKeyword & Isis::PvlKeyword::operator= ( QString  value)

Sets new values.

Overwrites the '=' operator to add a new value using addValue(). Like setValue(), this method clears any previously existing values and resets to the given value with unit = "" (empty QString).

Parameters
valueThe value to be added.
Returns
PvlKeyword& Reference to PvlKeyword object.
See also
addValue()
setValue()
operator+=

Definition at line 247 of file PvlKeyword.cpp.

◆ operator=() [2/3]

PvlKeyword & Isis::PvlKeyword::operator= ( Isis::PvlSequence seq)

Add values and units from a PvlSequence.

(Clears current values and units)

Parameters
seqThe PvlSequence to add from.
Returns
PvlKeyword& Reference to PvlKeyword object.

Definition at line 592 of file PvlKeyword.cpp.

References Isis::PvlSequence::Size().

◆ operator=() [3/3]

const PvlKeyword & Isis::PvlKeyword::operator= ( const PvlKeyword other)

This is an assignment operator.

Definition at line 1837 of file PvlKeyword.cpp.

References m_comments, m_formatter, m_indent, m_name, m_units, m_values, and m_width.

◆ operator==()

bool Isis::PvlKeyword::operator== ( const PvlKeyword key) const
inline

Returns true of the keyword names match.

Parameters
keyThe keyword to compare names with

Definition at line 187 of file PvlKeyword.h.

References m_name, and stringEqual().

◆ operator[]() [1/2]

const QString & Isis::PvlKeyword::operator[] ( int  index) const

Gets value for this object at specified index.

Overrides the '[]' operator to return the element in the array of values at the specified index.

Parameters
indexThe index of the value.
Returns
IString The value at the index.
Exceptions
iExceptionArraySubscriptNotInRange (index) Index out of bounds.
See also
operator[]

Definition at line 356 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

◆ operator[]() [2/2]

QString & Isis::PvlKeyword::operator[] ( int  index)

Gets value for this object at specified index.

Overrides the '[]' operator to return the element in the array of values at the specified index.

Parameters
indexThe index of the value.
Returns
IString The value at the index.
Exceptions
iExceptionArraySubscriptNotInRange (index) Index out of bounds.
See also
const operator[]

Definition at line 334 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

◆ readCleanKeyword()

bool Isis::PvlKeyword::readCleanKeyword ( QString  keyword,
std::vector< QString > &  keywordComments,
QString &  keywordName,
std::vector< std::pair< QString, QString > > &  keywordValues 
)
static

This reads a keyword compressed back to 1 line of data (excluding comments, which are included on separate lines of data before the keyword).

Line concatenations must have already been handled. This returns the data of the keyword (if valid) and its status.

Parameters
keywordPvl "#COMMENT\n//COMMENT\nKeyword = (Value1,Value2,...)" QString
keywordCommentsOutput: Lines of data that are comments
keywordNameOutput: Name of keyword
keywordValuesOutput: vector< pair<Value, Units> >
Returns
bool false if it is invalid but could become valid given more data, true if it is a valid keyword and successful

Definition at line 1139 of file PvlKeyword.cpp.

References _FILEINFO_.

◆ readLine()

QString Isis::PvlKeyword::readLine ( std::istream &  is,
bool  insideComment 
)
static

This method reads one line of data from the input stream.

All spaces, newlines, returns and tabs are trimmed from the result. Once a newline is encountered, if the line we read is blank, we keep reading. Once a line with data is encountered, that is the result. All newlines, spaces, returns and tabs are consumed past this line of data until the next different character (seeks to next valid data).

Parameters
isThe stream to read from
Returns
QString The first encountered line of data

Definition at line 1719 of file PvlKeyword.cpp.

◆ readValue()

QString Isis::PvlKeyword::readValue ( QString &  keyword,
bool &  quoteProblem,
const std::vector< std::pair< char, char > > &  otherDelimiters 
)
static

This method looks for a data element in the QString.

A data element is a quoted QString, a units value, or one value of an array (not including units). As an example, each value in the following QString is quoted:

'VALUE' '=' ('VALUE','VALUE', 'VALUE' '

')

The returned values of each of these elements is VALUE. Explicitly defined quotes (', ", <>) are stripped from the return value.

Parameters
keywordInput/Output: The keyword to get the next value from (DESTRUCTIVE)
quoteProblemOutput: The QString has an unclosed quote character
Returns
QString The stripped out token.

Definition at line 1584 of file PvlKeyword.cpp.

◆ reform()

QString Isis::PvlKeyword::reform ( const QString &  value) const
protected

Checks if the value needs to be converted to PVL or iPVL and returns it in the correct format.

Parameters
valueThe value to be converted.
Returns
QString The value in its proper format (iPVL or PVL).

Definition at line 474 of file PvlKeyword.cpp.

References Isis::PvlObject::findGroup(), Isis::PvlObject::Traverse, and Isis::IString::UpCase().

◆ setFormat()

void Isis::PvlKeyword::setFormat ( PvlFormat formatter)

Set the PvlFormatter used to format the keyword name and value(s)

Parameters
formatterA pointer to the formatter to be used

Definition at line 901 of file PvlKeyword.cpp.

◆ setIndent()

void Isis::PvlKeyword::setIndent ( int  indent)
inline

Sets the indent level when outputted(for formatting)

Parameters
indentThe new indent

Definition at line 219 of file PvlKeyword.h.

References indent(), and m_indent.

◆ setName()

void Isis::PvlKeyword::setName ( QString  name)

Sets the keyword name.

Parameters
nameThe new keyword name.

Definition at line 136 of file PvlKeyword.cpp.

References _FILEINFO_.

Referenced by Isis::Strategy::composite(), Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::ProcessImportFits::extractFitsLabels(), and Isis::operator>>().

◆ setUnits() [1/2]

void Isis::PvlKeyword::setUnits ( QString  units)

Sets the unit of measure for all current values if any exist.

Parameters
unitsNew units to be assigned.

Definition at line 182 of file PvlKeyword.cpp.

Referenced by Isis::ProcessMosaic::AddBandBinGroup().

◆ setUnits() [2/2]

void Isis::PvlKeyword::setUnits ( QString  value,
QString  units 
)

Sets the unit of measure for a given value.

Parameters
valueThe value to match
unitsNew units to be assigned.
Exceptions
Isis::iException::Programmer- Given value must exist

Definition at line 203 of file PvlKeyword.cpp.

References _FILEINFO_.

◆ setValue()

void Isis::PvlKeyword::setValue ( QString  value,
QString  unit = "" 
)

Sets new values.

If no current value exists, this method sets the given value to the PvlKeyword. Otherwise, it clears any existing values and resets to the value given using addValue(). Defaults to unit = "" (empty QString).

Parameters
valueNew value to be assigned.
unitUnits of measurement corresponding to the value.
See also
addValue()
operator=
operator+=

Definition at line 171 of file PvlKeyword.cpp.

Referenced by Isis::CameraPointInfo::GetPointInfo(), Isis::PvlContainer::setName(), Isis::ProcessExportPds::StandardAllMapping(), and Isis::OverlapStatistics::toPvl().

◆ setWidth()

void Isis::PvlKeyword::setWidth ( int  width)
inline

The width of the longest keyword name (for formatting)

Parameters
widththe new width

Definition at line 210 of file PvlKeyword.h.

References m_width, and width().

◆ size()

int Isis::PvlKeyword::size ( ) const
inline

Returns the number of values stored in this keyword.

Definition at line 141 of file PvlKeyword.h.

References m_values.

Referenced by Isis::PvlToXmlTranslationManager::addAttributes(), Isis::ProcessMosaic::AddBandBinGroup(), Isis::PvlToXmlTranslationManager::addSiblings(), Isis::PvlTranslationTable::AddTable(), Isis::PvlFlatMap::append(), Isis::XmlToPvlTranslationManager::checkDependencies(), Isis::DbProfile::count(), Isis::LabelTranslationManager::CreateContainer(), Isis::PvlToXmlTranslationManager::createParentElements(), Isis::ProcessExportPds4::createUnitMap(), Isis::KernelDb::files(), Isis::Kernels::findKernels(), Isis::CubeViewport::getAllWhatsThisInfo(), Isis::ProcessMosaic::GetBandIndex(), Isis::PvlToXmlTranslationManager::GetContainer(), Isis::PvlToPvlTranslationManager::GetContainer(), Isis::SpectralPlotTool::getSpectralStatistics(), Isis::ImageOverlapSet::HandleError(), Isis::Spice::hasKernels(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlToXmlTranslationManager::InputKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), Isis::PvlFormat::isSingleUnit(), Isis::PvlFlatMap::keywordValues(), Isis::Stretch::Load(), Isis::Spice::load(), Isis::SpiceRotation::LoadCache(), Isis::SpiceRotation::loadPCFromTable(), Isis::LroWideAngleCamera::LroWideAngleCamera(), Isis::MarciCamera::MarciCamera(), Isis::ProcessMosaic::MatchBandBinGroup(), Isis::KernelDb::matches(), Isis::NewHorizonsLeisaCamera::NewHorizonsLeisaCamera(), Isis::NewHorizonsMvicFrameCamera::NewHorizonsMvicFrameCamera(), Isis::PvlSequence::operator+=(), Isis::operator<<(), Isis::PvlSequence::operator=(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessPdsQubeLabel(), Isis::LoCameraFiducialMap::ReadFiducials(), Isis::ReseauDistortionMap::ReseauDistortionMap(), Isis::ThemisIrCamera::ThemisIrCamera(), Isis::ThemisVisCamera::ThemisVisCamera(), Isis::AdvancedTrackTool::TrackMosaicOrigin(), Isis::XmlToPvlTranslationManager::Translate(), Isis::ProcessExportPds4::translateBandBinSpectrumBinSet(), Isis::ProcessExportPds4::translateBandBinSpectrumUniform(), Isis::CubeViewport::updateWhatsThis(), and validateKeyword().

◆ stringEqual()

bool Isis::PvlKeyword::stringEqual ( const QString &  QString1,
const QString &  QString2 
)
static

Checks to see if two QStrings are equal.

Each is converted to uppercase and removed of underscores and whitespaces.

Parameters
QString1The first QString
QString2The second QString
Returns
bool True or false, depending on whether the QString values are equal.

Definition at line 551 of file PvlKeyword.cpp.

References Isis::IString::ConvertWhiteSpace(), Isis::IString::Remove(), and Isis::IString::UpCase().

Referenced by Isis::PvlToXmlTranslationManager::GetContainer(), Isis::PvlToPvlTranslationManager::GetContainer(), Isis::PvlContainer::isNamed(), isNamed(), Isis::PvlFormat::isSingleUnit(), Isis::PvlGroup::operator==(), operator==(), and Isis::PvlObject::operator==().

◆ toIPvl()

QString Isis::PvlKeyword::toIPvl ( const QString &  value) const
protected

Converts a value to iPVL format.

Parameters
valueThe value to be converted.
Returns
QString The value in iPVL format.

Definition at line 498 of file PvlKeyword.cpp.

◆ toPvl()

QString Isis::PvlKeyword::toPvl ( const QString &  value) const
protected

Converts a value to PVL format.

Parameters
valueThe value to be converted.
Returns
QString The value in PVL format.

Definition at line 526 of file PvlKeyword.cpp.

◆ unit()

QString Isis::PvlKeyword::unit ( const int  index = 0) const

Returns the units of measurement of the element of the array of values for the object at the specified index.

Defaults to index = 0.

Parameters
indexThe index of the unit.
Returns
QString The unit at the index.
Exceptions
iExceptionArraySubscriptNotInRange (index) Index out of bounds.

Definition at line 373 of file PvlKeyword.cpp.

References _FILEINFO_, and Isis::Message::ArraySubscriptNotInRange().

Referenced by Isis::ProcessMosaic::AddBandBinGroup(), Isis::Cube::applyVirtualBandsToLabel(), Isis::PvlToXmlTranslationManager::doTranslation(), Isis::ProcessImportPds::ExtractPdsProjection(), Isis::PvlFormat::isSingleUnit(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessExportPds::StandardAllMapping(), and Isis::ProcessExportPds4::translateBandBinSpectrumUniform().

◆ validateKeyword()

void Isis::PvlKeyword::validateKeyword ( PvlKeyword pvlKwrd,
QString  psValueType = "",
PvlKeyword pvlKwrdValue = NULL 
)

Validate Keyword for type and required values.

Validate a Keyword, comparing against corresponding Template Keyword.

Template Keyword has the format: keyName = (valueType, optional/required, Values allowed separated by comma)

Author
Sharmila Prasad (9/22/2010)
Parameters
pvlKwrd- Keyword to be validated
psValueType- Value Type (positive / negative) for numbers
pvlKwrdValue- Template Keyword __Value or __Range to validate keyword's value

Definition at line 1889 of file PvlKeyword.cpp.

References _FILEINFO_, name(), size(), Isis::toDouble(), and Isis::toInt().

Referenced by Isis::PvlContainer::validateAllKeywords(), and Isis::PvlContainer::validateRepeatOption().

◆ width()

int Isis::PvlKeyword::width ( ) const
inline

Returns the current set longest keyword name.

Definition at line 224 of file PvlKeyword.h.

References m_width.

Referenced by Isis::operator<<(), and setWidth().

◆ writeSpaces()

void Isis::PvlKeyword::writeSpaces ( std::ostream &  os,
int  numSpaces 
) const
private

This writes numSpaces spaces to the ostream.

Parameters
osStream to write to
numSpacesnumber of spaces to write

Definition at line 888 of file PvlKeyword.cpp.

◆ writeWithWrap()

ostream & Isis::PvlKeyword::writeWithWrap ( std::ostream &  os,
const QString &  textToWrite,
int  startColumn,
PvlFormat format 
) const
protected

Wraps output so that length doesn't exceed the character limit.

By default, the character limit is set to 80, and can be changed with the method SetCharLimit. Used as a helper method for output of PvlKeyword.

Parameters
osDesignated output stream
textToWriteThe text to be written
startColumnThe starting column after the "=" sign.
endOfLineThe EOL character
Returns
ostream& Reference to ostream.
See also
operator<<

Definition at line 627 of file PvlKeyword.cpp.

References Isis::PvlFormat::charLimit().

Referenced by Isis::operator<<().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const PvlKeyword keyword 
)
friend

Write out the keyword.

Parameters
osThe output stream.
keywordThe PvlKeyword object to output.
Returns
ostream& Reference to ostream.
See also
writeWithWrap()

Definition at line 1781 of file PvlKeyword.cpp.

◆ operator>>

std::istream& operator>> ( std::istream &  is,
PvlKeyword result 
)
friend

Read in a keyword.

http://pds.jpl.nasa.gov/tools/standards-reference.shtml

Parameters
isThe input stream
resultThe keyword to read into (OUTPUT)

Definition at line 925 of file PvlKeyword.cpp.

Member Data Documentation

◆ m_comments

std::vector<QString>* Isis::PvlKeyword::m_comments
private

The comments for the keyword.

Definition at line 290 of file PvlKeyword.h.

Referenced by comments(), and operator=().

◆ m_formatter

PvlFormat* Isis::PvlKeyword::m_formatter
protected

Formatter object.

Definition at line 270 of file PvlKeyword.h.

Referenced by Isis::operator<<(), and operator=().

◆ m_indent

int Isis::PvlKeyword::m_indent
private

The number of indentations to make.

This is based on whether the keyword is in a group, etc.

Definition at line 305 of file PvlKeyword.h.

Referenced by indent(), operator=(), and setIndent().

◆ m_name

char* Isis::PvlKeyword::m_name
private

The keyword's name... This is a c-string for memory efficiency.

Definition at line 274 of file PvlKeyword.h.

Referenced by name(), operator=(), and operator==().

◆ m_units

std::vector<QString>* Isis::PvlKeyword::m_units
private

The units for the values.

Definition at line 287 of file PvlKeyword.h.

Referenced by operator=().

◆ m_values

QVarLengthArray<QString, 1> Isis::PvlKeyword::m_values
private

The values in the keyword.

This is a QVarLengthArray purely for optimization purposes. The amount of memory consumed by other data types introduces very significant overhead relative to this type which is meant to be as cost-effective and cheap as possible. Most of the time we have one value per keyword so that is what we're allocating by default with this variable.

Definition at line 284 of file PvlKeyword.h.

Referenced by operator=(), and size().

◆ m_width

int Isis::PvlKeyword::m_width
private

The width of the longest keyword.

This is used for spacing out the equals signs on output.

Definition at line 300 of file PvlKeyword.h.

Referenced by operator=(), setWidth(), and width().


The documentation for this class was generated from the following files: