Isis 3 Programmer Reference
Isis::PvlToken Class Reference

Container for Keyword-value pair. More...

#include <PvlToken.h>

Collaboration diagram for Isis::PvlToken:
Collaboration graph

Public Member Functions

 PvlToken (const QString &k)
 Constructs a Token with k for keyword and NULL for the value list.
 
 PvlToken ()
 Constructs a Token with NULL for both the keyword and value list.
 
 ~PvlToken ()
 Destroys the Token object.
 
void setKey (const QString &k)
 Set the token keyword.
 
QString key () const
 Returns the token keyword.
 
QString keyUpper () const
 Returns the token keyword in all uppercase characters.
 
void addValue (const QString &v)
 Adds a value to the value-vector.
 
QString value (const int index=0) const
 Returns one element of the value-vector.
 
QString valueUpper (const int index=0) const
 Returns one element of the value-vector in uppercase.
 
int valueSize () const
 Returns the number of elements in the value-vector.
 
void valueClear ()
 Removes all elements from the value-vector.
 
const std::vector< QString > & valueVector () const
 

Private Attributes

QString m_key
 Storage for the keyword name.
 
std::vector< QString > m_value
 Vector storage for a list of values.
 

Detailed Description

Container for Keyword-value pair.

This class is used for internalizing keyword-value(s) pairs. For example, SPACECRAFT=MARS_GLOBAL_SURVEYOR or FROM=file.cub. This is useful when parsing ASCII files such as PDS labels or command lines.

Author
2002-03-18 Jeff Anderson
History

2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...

2005-02-14 Elizabeth Ribelin - Modified file to support Doxygen

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. documentation

Todo
2005-02-14 Jeff Anderson - add coded and implemetation example to class documentation

Definition at line 38 of file PvlToken.h.

Constructor & Destructor Documentation

◆ PvlToken() [1/2]

Isis::PvlToken::PvlToken ( const QString & k)

Constructs a Token with k for keyword and NULL for the value list.

Parameters
kValue of the keyword

Definition at line 19 of file PvlToken.cpp.

References setKey(), and valueClear().

◆ PvlToken() [2/2]

Isis::PvlToken::PvlToken ( )

Constructs a Token with NULL for both the keyword and value list.

Definition at line 25 of file PvlToken.cpp.

References valueClear().

◆ ~PvlToken()

Isis::PvlToken::~PvlToken ( )

Destroys the Token object.

Definition at line 30 of file PvlToken.cpp.

References m_key, and valueClear().

Member Function Documentation

◆ addValue()

void Isis::PvlToken::addValue ( const QString & v)

Adds a value to the value-vector.

Successive calls add values to the end of the vector.

Parameters
vIString add to the value-vector list

Definition at line 82 of file PvlToken.cpp.

References m_value.

◆ key()

QString Isis::PvlToken::key ( ) const

Returns the token keyword.

Returns
QString

Definition at line 49 of file PvlToken.cpp.

References m_key.

◆ keyUpper()

QString Isis::PvlToken::keyUpper ( ) const

Returns the token keyword in all uppercase characters.

Returns
QString

Definition at line 58 of file PvlToken.cpp.

References m_key.

◆ setKey()

void Isis::PvlToken::setKey ( const QString & k)

Set the token keyword.

Parameters
kIString to load into the token keyword

Definition at line 40 of file PvlToken.cpp.

References m_key.

Referenced by PvlToken().

◆ value()

QString Isis::PvlToken::value ( const int index = 0) const

Returns one element of the value-vector.

Parameters
indexZero-based index of vector element to return. Defaults to 0
Returns
QString
Exceptions
Isis::IException::Programmer

Definition at line 95 of file PvlToken.cpp.

References Isis::Message::ArraySubscriptNotInRange(), m_value, and Isis::IException::Programmer.

◆ valueClear()

void Isis::PvlToken::valueClear ( )

Removes all elements from the value-vector.

Definition at line 63 of file PvlToken.cpp.

References m_value.

Referenced by PvlToken(), PvlToken(), and ~PvlToken().

◆ valueSize()

int Isis::PvlToken::valueSize ( ) const

Returns the number of elements in the value-vector.

Returns
int

Definition at line 72 of file PvlToken.cpp.

References m_value.

◆ valueUpper()

QString Isis::PvlToken::valueUpper ( const int index = 0) const

Returns one element of the value-vector in uppercase.

Parameters
indexZero-based index of vector element to return. Defaults to 0
Returns
QString
Exceptions
Isis::IException::Programmer

Definition at line 112 of file PvlToken.cpp.

References Isis::Message::ArraySubscriptNotInRange(), m_value, and Isis::IException::Programmer.

◆ valueVector()

const std::vector< QString > & Isis::PvlToken::valueVector ( ) const
inline

Definition at line 60 of file PvlToken.h.

Member Data Documentation

◆ m_key

QString Isis::PvlToken::m_key
private

Storage for the keyword name.

Definition at line 40 of file PvlToken.h.

Referenced by key(), keyUpper(), setKey(), and ~PvlToken().

◆ m_value

std::vector<QString> Isis::PvlToken::m_value
private

Vector storage for a list of values.

See the standard template library for more information on vectors.

Definition at line 41 of file PvlToken.h.

Referenced by addValue(), value(), valueClear(), valueSize(), and valueUpper().


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