Isis 3.0 Object Programmers' Reference |
Home |
Allows applications to translate simple text files. More...
#include <PvlTranslationManager.h>
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 PvlKeyword & | InputKeyword (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 | |
Pvl & | TranslationTable () |
const Pvl & | TranslationTable () const |
bool | IsAuto (const QString nName) |
bool | IsOptional (const QString nName) |
PvlKeyword & | OutputPosition (const QString nName) |
QString | OutputName (const QString nName) |
Private Member Functions | |
Isis::PvlKeyword | DoTranslation (const QString nName) |
Translate the requested output name to output values using the input name and values or default value. | |
const Isis::PvlContainer * | GetContainer (const PvlKeyword &inputGroup) const |
Isis::PvlContainer * | CreateContainer (const QString nName, Isis::Pvl &pvl) |
Private Attributes | |
Isis::Pvl | p_fLabel |
A Pvl object for the input label file. | |
Allows applications to translate simple text files.
This class allows the translation of text files which can be parsed by the Pvl class.
2003-09-03 Stuart Sides - Modified to work with new isis label format
2003-09-25 Stuart Sides - Added the Translate member
2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen documentation
2006-08-09 Brendan George - Modified to support Optional keyword translation
2006-10-01 Stuart Sides - Fixed bug with Optional keyword. Non-optional keywords were being reported instantly.
2006-11-16 Brendan George - Changed instances of "Foreign" to "Input" and "Native" to "Output"
2007-06-22 Stuart Sides - Added ability to have more than one input location keyword for a translation. The first one found which contains the input keyword is used.
2008-05-09 Steven Lambright - Added ability to change input label without re-reading the translation file.
2008-07-10 Noah Hilt - Changed while loops to continue searching other groups if a group has been found, but the keyword does not exist in that group.
2008-07-10 Steven Lambright - Changed to use new accessors
2010-01-04 Steven Lambright - Added InputKeyword method and removed InputSize, InputUnits, InputValue. Renamed private Translate method to DoTranslation to remove ambiguity with a parent method, instead of using a dummy parameter.
Definition at line 75 of file PvlTranslationManager.h.
Isis::PvlTranslationManager::PvlTranslationManager | ( | Isis::Pvl & | inputLabel, |
const QString & | transFile | ||
) |
Constructs and initializes a TranslationManager object.
inputLabel | The Pvl holding the input label. |
transFile | The translation file to be used to tranlate keywords in the input label. |
Definition at line 43 of file PvlTranslationManager.cpp.
Isis::PvlTranslationManager::PvlTranslationManager | ( | Isis::Pvl & | inputLabel, |
std::istream & | transStrm | ||
) |
Constructs and initializes a TranslationManager object.
inputLabel | The Pvl holding the input label. |
transStrm | A stream containing the tranlation table to be used to tranlate keywords in the input label. |
Definition at line 59 of file PvlTranslationManager.cpp.
|
inline |
Destroys the TranslationManager object.
Definition at line 86 of file PvlTranslationManager.h.
|
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.
transStm | The stream to be added. |
Definition at line 77 of file PvlTranslationTable.cpp.
References _FILEINFO_, Isis::PvlContainer::hasKeyword(), Isis::PvlContainer::keywords(), Isis::PvlContainer::name(), Isis::PvlKeyword::name(), and Isis::PvlKeyword::size().
|
inherited |
Adds the contents of a translation table to the searchable groups/keys.
transFile | The name of the translation file to be added. |
IException::Io |
Definition at line 66 of file PvlTranslationTable.cpp.
|
private |
Translate the requested output name to output values using the input name and values or default value.
nName | The output name used to identify the input keyword to be translated. |
Definition at line 108 of file PvlTranslationManager.cpp.
References Isis::PvlKeyword::addValue(), Isis::PvlContainer::hasKeyword(), Isis::PvlKeyword::setName(), and Isis::PvlTranslationTable::Translate().
|
inherited |
Returns the input default value from the translation table corresponding to the output name argument.
nName | The output name to be used to search the translation table. |
iException::Programmer |
Definition at line 335 of file PvlTranslationTable.cpp.
References _FILEINFO_, Isis::PvlContainer::fileName(), and Isis::PvlContainer::hasKeyword().
|
inherited |
Returns the input group name from the translation table corresponding to the output name argument.
nName | The output name to be used to search the translation table. |
inst | The occurence number of the "InputGroup" keyword (first one is zero) |
iException::Programmer |
Definition at line 235 of file PvlTranslationTable.cpp.
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.
nName | The output name used to identify the input keyword. |
Definition at line 217 of file PvlTranslationManager.cpp.
References Isis::PvlContainer::hasKeyword().
Referenced by Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ProcessImportPds::IdentifySource(), Isis::ProcessImportPds::ProcessLabel(), Isis::ProcessImportPds::ProcessSpecialPixels(), and Isis::ProcessImportPds::TranslatePdsProjection().
const PvlKeyword & Isis::PvlTranslationManager::InputKeyword | ( | const QString | nName | ) | const |
Returns the ith input value assiciated with the output name argument.
nName | The output name used to identify the input keyword. |
findex | The index into the input keyword array. Defaults to 0 |
Isis::IException::Programmer |
Definition at line 169 of file PvlTranslationManager.cpp.
References _FILEINFO_, Isis::PvlContainer::findKeyword(), Isis::PvlContainer::hasKeyword(), and Isis::PvlKeyword::name().
Referenced by Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ProcessImportPds::ProcessDataFilePointer(), and Isis::ProcessImportPds::ProcessPdsQubeLabel().
|
inherited |
Returns the input keyword name from the translation table corresponding to the output name argument.
nName | The output name to be used to search the translation table. |
iException::Programmer |
Definition at line 311 of file PvlTranslationTable.cpp.
References _FILEINFO_, and Isis::PvlContainer::hasKeyword().
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.
nName | The output name used to identify the input keyword to be translated. |
findex | The index into the input keyword array. Defaults to 0 |
Definition at line 82 of file PvlTranslationManager.cpp.
References Isis::PvlContainer::hasKeyword(), and Isis::PvlTranslationTable::Translate().
Referenced by Isis::NaifStatus::CheckErrors(), Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ObservationNumber::FindObservationTranslation(), Isis::SerialNumber::FindSerialTranslation(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessLabel(), Isis::ProcessImportPds::ProcessPdsImageLabel(), Isis::ProcessImportPds::ProcessPdsM3Label(), Isis::ProcessImportPds::ProcessPixelBitandType(), and Isis::ProcessImportPds::ProcessSpecialPixels().
|
inherited |
Translates the output name and input value.
nName | The output name to be used to search the translation table. |
fValue | The input value to be translated |
iException::Programmer |
Definition at line 168 of file PvlTranslationTable.cpp.
References _FILEINFO_, Isis::PvlContainer::begin(), Isis::PvlContainer::end(), Isis::PvlContainer::fileName(), Isis::PvlContainer::findKeyword(), and Isis::PvlContainer::hasKeyword().
Referenced by DoTranslation(), and Translate().
|
private |
A Pvl object for the input label file.
Definition at line 106 of file PvlTranslationManager.h.