USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::PvlToken Class Reference
[Parsing]

#include <PvlToken.h>

Collaboration diagram for Isis::PvlToken:

Collaboration graph
[legend]
List of all members.

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

For internal use only.

History:
2003-05-16 Stuart Sides - Modified schema from astrogeology... isis.astrogeology...
History:
2005-02-14 Elizabeth Ribelin - Modified file to support Doxygen documentation
Todo:
2005-02-14 Jeff Anderson - add coded and implemetation example to class documentation

Definition at line 51 of file PvlToken.h.

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

Private Attributes

std::string key
 Storage for the keyword name.
std::vector< std::string > value
 Vector storage for a list of values.


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

Definition at line 33 of file PvlToken.cpp.

References SetKey(), and ValueClear().

Isis::PvlToken::PvlToken (  ) 

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

Definition at line 39 of file PvlToken.cpp.

References key, and ValueClear().

Isis::PvlToken::~PvlToken (  ) 

Destroys the Token object.

Definition at line 45 of file PvlToken.cpp.

References key, and 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

Definition at line 101 of file PvlToken.cpp.

References value.

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

string Isis::PvlToken::GetKey (  )  const

Returns the token keyword.

Returns:
string

Definition at line 64 of file PvlToken.cpp.

References key.

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

string Isis::PvlToken::GetKeyUpper (  )  const

Returns the token keyword in all uppercase characters.

Returns:
string

Definition at line 73 of file PvlToken.cpp.

References key.

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 

Definition at line 114 of file PvlToken.cpp.

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

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 

Definition at line 131 of file PvlToken.cpp.

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

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

Set the token keyword.

Parameters:
k iString to load into the token keyword

Definition at line 55 of file PvlToken.cpp.

References key.

Referenced by PvlToken().

void Isis::PvlToken::ValueClear (  ) 

Removes all elements from the value-vector.

Definition at line 82 of file PvlToken.cpp.

References value.

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

int Isis::PvlToken::ValueSize (  )  const

Returns the number of elements in the value-vector.

Returns:
int

Definition at line 91 of file PvlToken.cpp.

References value.


Member Data Documentation

std::string Isis::PvlToken::key [private]

Storage for the keyword name.

Definition at line 53 of file PvlToken.h.

Referenced by GetKey(), GetKeyUpper(), PvlToken(), SetKey(), and ~PvlToken().

std::vector<std::string> Isis::PvlToken::value [private]

Vector storage for a list of values.

See the standard template library for more information on vectors.

Definition at line 54 of file PvlToken.h.

Referenced by AddValue(), GetValue(), GetValueUpper(), ValueClear(), ValueSize(), and ValueVector().


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