USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::PvlToken Class Reference
[Parsing]

Container for Keyword-value pair. More...

#include <PvlToken.h>

List of all members.

Public Member Functions

 PvlToken (const std::string &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 std::string &k)
 Set the token keyword.
std::string GetKey () const
 Returns the token keyword.
std::string GetKeyUpper () const
 Returns the token keyword in all uppercase characters.
void AddValue (const std::string &v)
 Adds a value to the value-vector.
std::string GetValue (const int index=0) const
 Returns one element of the value-vector.
std::string GetValueUpper (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< std::string > & ValueVector () const

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

Constructor & Destructor Documentation

Isis::PvlToken::PvlToken ( const std::string &  k  ) 

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

Parameters:
k Value of the keyword

References SetKey(), and ValueClear().

Isis::PvlToken::PvlToken (  ) 

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

References ValueClear().

Isis::PvlToken::~PvlToken (  ) 

Destroys the Token object.

References ValueClear().


Member Function Documentation

void Isis::PvlToken::AddValue ( const std::string &  v  ) 

Adds a value to the value-vector.

Successive calls add values to the end of the vector.

Parameters:
v iString add to the value-vector list

Referenced by Isis::PvlTokenizer::Load(), and Isis::PvlTokenizer::ParseCommaList().

string Isis::PvlToken::GetKey (  )  const

Returns the token keyword.

Returns:
string

Referenced by Isis::PvlTokenizer::Load().

string Isis::PvlToken::GetKeyUpper (  )  const

Returns the token keyword in all uppercase characters.

Returns:
string

Referenced by Isis::PvlTokenizer::Load().

string Isis::PvlToken::GetValue ( const int  index = 0  )  const

Returns one element of the value-vector.

Parameters:
index Zero-based index of vector element to return. Defaults to 0
Returns:
string
Exceptions:
Isis::iException::Programmer 

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

string Isis::PvlToken::GetValueUpper ( const int  index = 0  )  const

Returns one element of the value-vector in uppercase.

Parameters:
index Zero-based index of vector element to return. Defaults to 0
Returns:
string
Exceptions:
Isis::iException::Programmer 

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

void Isis::PvlToken::SetKey ( const std::string &  k  ) 

Set the token keyword.

Parameters:
k iString to load into the token keyword

Referenced by PvlToken().

void Isis::PvlToken::ValueClear (  ) 

Removes all elements from the value-vector.

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

int Isis::PvlToken::ValueSize (  )  const

Returns the number of elements in the value-vector.

Returns:
int
const std::vector<std::string>& Isis::PvlToken::ValueVector (  )  const [inline]

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