USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::PvlTranslationManager Class Reference

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

#include <PvlTranslationManager.h>

Inherits Isis::PvlTranslationTable.

Public Member Functions

 PvlTranslationManager (const QString &transFile)
 
 PvlTranslationManager (Isis::Pvl &inputLabel, const QString &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.
 
QString Translate (QString nName, int findex=0)
 Returns a translated value.
 
void Auto (Isis::Pvl &outputLabel)
 
const PvlKeywordInputKeyword (const QString nName) const
 Returns the ith input value assiciated with the output name argument.
 
bool InputHasKeyword (const QString nName)
 Indicates if the input keyword corresponding to the output name exists in the label.
 
void SetLabel (Isis::Pvl &lab)
 
PvlKeyword InputGroup (const QString nName, const int inst=0) const
 Returns the input group name from the translation table corresponding to the output name argument.
 
QString InputKeywordName (const QString nName) const
 Returns the input keyword name from the translation table corresponding to the output name argument.
 
QString InputDefault (const QString nName) const
 Returns the input default value from the translation table corresponding to the output name argument.
 
QString Translate (const QString nName, const QString 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 QString &transFile)
 Adds the contents of a translation table to the searchable groups/keys.
 

Protected Member Functions

PvlTranslationTable ()
 
const PvlTranslationTable () const
 
bool IsAuto (const QString nName)
 
bool IsOptional (const QString nName)
 
PvlKeywordOutputPosition (const QString nName)
 
QString OutputName (const QString 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 QString &  transFile)
Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
const QString &  transFile 
)

Constructs and initializes a TranslationManager object.

Parameters
inputLabelThe Pvl holding the input label.
transFileThe translation file to be used to tranlate keywords in the input label.
Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
std::istream &  transStrm 
)

Constructs and initializes a TranslationManager object.

Parameters
inputLabelThe Pvl holding the input label.
transStrmA stream containing the tranlation table to be used to tranlate keywords in the input label.
Isis::PvlTranslationManager::~PvlTranslationManager ( )
inline

Destroys the TranslationManager object.

Member Function Documentation

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
transStmThe stream to be added.

References _FILEINFO_, Isis::PvlContainer::hasKeyword(), Isis::PvlContainer::keywords(), Isis::PvlContainer::name(), Isis::PvlKeyword::name(), and Isis::PvlKeyword::size().

void Isis::PvlTranslationTable::AddTable ( const QString &  transFile)
inherited

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

Parameters
transFileThe name of the translation file to be added.
Exceptions
IException::Io
QString Isis::PvlTranslationTable::InputDefault ( const QString  nName) const
inherited

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

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

References _FILEINFO_, Isis::PvlContainer::fileName(), and Isis::PvlContainer::hasKeyword().

PvlKeyword Isis::PvlTranslationTable::InputGroup ( const QString  nName,
const int  inst = 0 
) const
inherited

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

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

References _FILEINFO_, Isis::PvlContainer::begin(), Isis::PvlContainer::end(), Isis::PvlContainer::findKeyword(), and Isis::PvlKeyword::size().

bool Isis::PvlTranslationManager::InputHasKeyword ( const QString  nName)

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

Parameters
nNameThe output name used to identify the input keyword.

References Isis::PvlContainer::hasKeyword().

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

const PvlKeyword & Isis::PvlTranslationManager::InputKeyword ( const QString  nName) const

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

Parameters
nNameThe output name used to identify the input keyword.
findexThe index into the input keyword array. Defaults to 0
Exceptions
Isis::IException::Programmer

References _FILEINFO_, Isis::PvlContainer::findKeyword(), Isis::PvlContainer::hasKeyword(), and Isis::PvlKeyword::name().

QString Isis::PvlTranslationTable::InputKeywordName ( const QString  nName) const
inherited

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

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

References _FILEINFO_, and Isis::PvlContainer::hasKeyword().

bool Isis::PvlTranslationTable::IsAuto ( const QString  nName)
protectedinherited
bool Isis::PvlTranslationTable::IsOptional ( const QString  nName)
protectedinherited
QString Isis::PvlTranslationTable::OutputName ( const QString  nName)
protectedinherited
Isis::PvlKeyword & Isis::PvlTranslationTable::OutputPosition ( const QString  nName)
protectedinherited
void Isis::PvlTranslationManager::SetLabel ( Isis::Pvl lab)
inline
QString Isis::PvlTranslationManager::Translate ( QString  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
nNameThe output name used to identify the input keyword to be translated.
findexThe index into the input keyword array. Defaults to 0
Returns
string

References Isis::PvlContainer::hasKeyword(), and Isis::PvlTranslationTable::Translate().

Referenced by Isis::NaifStatus::CheckErrors(), and Isis::ProcessImportPds::ProcessLabel().

QString Isis::PvlTranslationTable::Translate ( const QString  nName,
const QString  fValue = "" 
) const
inherited

Translates the output name and input value.

Parameters
nNameThe output name to be used to search the translation table.
fValueThe input value to be translated
Returns
QString The translated QString
Exceptions
iException::Programmer

References _FILEINFO_, Isis::PvlContainer::begin(), Isis::PvlContainer::end(), Isis::PvlContainer::fileName(), Isis::PvlContainer::findKeyword(), and Isis::PvlContainer::hasKeyword().

Referenced by Translate().

Pvl& Isis::PvlTranslationTable::TranslationTable ( )
inlineprotectedinherited
const Pvl& Isis::PvlTranslationTable::TranslationTable ( ) const
inlineprotectedinherited

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