USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::PvlTranslationManager Class Reference
[Parsing]

Allows applications to translate simple text files. More...

#include <PvlTranslationManager.h>

Inherits Isis::PvlTranslationTable.

List of all members.

Public Member Functions

 PvlTranslationManager (const std::string &transFile)
 PvlTranslationManager (Isis::Pvl &inputLabel, const std::string &transFile)
 Constructs and initializes a TranslationManager object.
 PvlTranslationManager (Isis::Pvl &inputLabel, std::istream &transStrm)
 Constructs and initializes a TranslationManager object.
 ~PvlTranslationManager ()
 Destroys the TranslationManager object.
std::string Translate (const std::string nName, int findex=0)
 Returns a translated value.
void Auto (Isis::Pvl &outputLabel)
const PvlKeywordInputKeyword (const std::string nName) const
 Returns the ith input value assiciated with the output name argument.
bool InputHasKeyword (const std::string nName)
 Indicates if the input keyword corresponding to the output name exists in the label.
void SetLabel (Isis::Pvl &lab)
PvlKeyword InputGroup (const std::string nName, const int inst=0) const
 Returns the input group name from the translation table corresponding to the output name argument.
std::string InputKeywordName (const std::string nName) const
 Returns the input keyword name from the translation table corresponding to the output name argument.
std::string InputDefault (const std::string nName) const
 Returns the input default value from the translation table corresponding to the output name argument.
std::string Translate (const std::string nName, const std::string fValue="") const
 Translates the output name and input value.
void AddTable (std::istream &transStm)
 Adds the contents of a translation table to the searchable groups/keys Also performs a verification, to ensure that the translation table is valid.
void AddTable (const std::string &transFile)
 Adds the contents of a translation table to the searchable groups/keys.

Protected Member Functions

PvlTranslationTable ()
const PvlTranslationTable () const
bool IsAuto (const std::string nName)
bool IsOptional (const std::string nName)
PvlKeywordOutputPosition (const std::string nName)
std::string OutputName (const std::string nName)

Detailed Description

Allows applications to translate simple text files.

This class allows the translation of text files which can be parsed by the Pvl class.

Author:
2003-05-29 Stuart Sides

Constructor & Destructor Documentation

Isis::PvlTranslationManager::PvlTranslationManager ( const std::string &  transFile  ) 
Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
const std::string &  transFile 
)

Constructs and initializes a TranslationManager object.

Parameters:
inputLabel The Pvl holding the input label.
transFile The translation file to be used to tranlate keywords in the input label.

References Isis::PvlTranslationTable::AddTable().

Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
std::istream &  transStrm 
)

Constructs and initializes a TranslationManager object.

Parameters:
inputLabel The Pvl holding the input label.
transStrm A stream containing the tranlation table to be used to tranlate keywords in the input label.

References Isis::PvlTranslationTable::AddTable().

Isis::PvlTranslationManager::~PvlTranslationManager (  )  [inline]

Destroys the TranslationManager object.


Member Function Documentation

void Isis::PvlTranslationTable::AddTable ( const std::string &  transFile  )  [inherited]

Adds the contents of a translation table to the searchable groups/keys.

Parameters:
transFile The name of the translation file to be added.
Exceptions:
iException::Io 

References Isis::Pvl::Read().

void Isis::PvlTranslationTable::AddTable ( std::istream &  transStm  )  [inherited]

Adds the contents of a translation table to the searchable groups/keys Also performs a verification, to ensure that the translation table is valid.

Parameters:
transStm The stream to be added.

References _FILEINFO_, Isis::PvlObject::Group(), Isis::PvlContainer::HasKeyword(), Isis::PvlContainer::Keywords(), Isis::iException::Message(), Isis::PvlKeyword::Name(), Isis::PvlContainer::Name(), Isis::PvlKeyword::Size(), and Isis::iException::User.

Referenced by PvlTranslationManager(), and Isis::PvlTranslationTable::PvlTranslationTable().

void Isis::PvlTranslationManager::Auto ( Isis::Pvl outputLabel  ) 
string Isis::PvlTranslationTable::InputDefault ( const std::string  nName  )  const [inherited]

Returns the input default value from the translation table corresponding to the output name argument.

Parameters:
nName The output name to be used to search the translation table.
Returns:
string The input default value
Exceptions:
iException::Programmer 

References _FILEINFO_, Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and Isis::iException::Programmer.

PvlKeyword Isis::PvlTranslationTable::InputGroup ( const std::string  nName,
const int  inst = 0 
) const [inherited]

Returns the input group name from the translation table corresponding to the output name argument.

Parameters:
nName The output name to be used to search the translation table.
inst The occurence number of the "InputGroup" keyword (first one is zero)
Returns:
string The input group name
Exceptions:
iException::Programmer 

References _FILEINFO_, Isis::PvlContainer::Begin(), Isis::PvlContainer::End(), Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlContainer::FindKeyword(), Isis::PvlObject::HasGroup(), Isis::iException::Message(), Isis::iException::Programmer, and Isis::PvlKeyword::Size().

Referenced by InputHasKeyword(), InputKeyword(), and Translate().

bool Isis::PvlTranslationManager::InputHasKeyword ( const std::string  nName  ) 

Indicates if the input keyword corresponding to the output name exists in the label.

Parameters:
nName The output name used to identify the input keyword.

References Isis::PvlContainer::HasKeyword(), Isis::PvlTranslationTable::InputGroup(), and Isis::PvlTranslationTable::InputKeywordName().

Referenced by Isis::ProcessImportPds::SetPdsFile(), and Isis::ProcessImportPds::TranslatePdsProjection().

const PvlKeyword & Isis::PvlTranslationManager::InputKeyword ( const std::string  nName  )  const

Returns the ith input value assiciated with the output name argument.

Parameters:
nName The output name used to identify the input keyword.
findex The index into the input keyword array. Defaults to 0
Exceptions:
Isis::iException::Programmer 

References _FILEINFO_, Isis::PvlContainer::Filename(), Isis::PvlContainer::FindKeyword(), Isis::PvlContainer::HasKeyword(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlTranslationTable::InputKeywordName(), Isis::iException::Message(), Isis::PvlKeyword::Name(), Isis::iException::Programmer, Isis::PvlKeyword::Size(), and Isis::PvlTranslationTable::TranslationTable().

string Isis::PvlTranslationTable::InputKeywordName ( const std::string  nName  )  const [inherited]

Returns the input keyword name from the translation table corresponding to the output name argument.

Parameters:
nName The output name to be used to search the translation table.
Returns:
string The input keyword name
Exceptions:
iException::Programmer 

References _FILEINFO_, Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and Isis::iException::Programmer.

Referenced by InputHasKeyword(), InputKeyword(), and Translate().

bool Isis::PvlTranslationTable::IsAuto ( const std::string  nName  )  [protected, inherited]
bool Isis::PvlTranslationTable::IsOptional ( const std::string  nName  )  [protected, inherited]
string Isis::PvlTranslationTable::OutputName ( const std::string  nName  )  [protected, inherited]
Isis::PvlKeyword & Isis::PvlTranslationTable::OutputPosition ( const std::string  nName  )  [protected, inherited]
void Isis::PvlTranslationManager::SetLabel ( Isis::Pvl lab  )  [inline]
string Isis::PvlTranslationTable::Translate ( const std::string  nName,
const std::string  fValue = "" 
) const [inherited]

Translates the output name and input value.

Parameters:
nName The output name to be used to search the translation table.
fValue The input value to be translated
Returns:
string The translated string
Exceptions:
iException::Programmer 

References _FILEINFO_, Isis::PvlContainer::Begin(), Isis::PvlContainer::End(), Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlContainer::FindKeyword(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and Isis::iException::Programmer.

string Isis::PvlTranslationManager::Translate ( const std::string  nName,
int  findex = 0 
)

Returns a translated value.

The output name is used to find the input group, keyword, default and tranlations in the translation table. If the keyword does not exist in the input label, the input default if available will be used as the input value. This input value is then used to search all of the translations. If a match is found the translated value is returned.

Parameters:
nName The output name used to identify the input keyword to be translated.
findex The index into the input keyword array. Defaults to 0
Returns:
string

References Isis::PvlContainer::HasKeyword(), Isis::PvlTranslationTable::InputGroup(), and Isis::PvlTranslationTable::InputKeywordName().

Referenced by Isis::ProcessImportPds::SetPdsFile().

const Pvl& Isis::PvlTranslationTable::TranslationTable (  )  const [inline, protected, inherited]
Pvl& Isis::PvlTranslationTable::TranslationTable (  )  [inline, protected, inherited]

Referenced by Auto(), and InputKeyword().


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