Isis 3 Programmer Reference
Isis::XmlToPvlTranslationManager Class Reference

Allows applications to translate Xml label files. More...

#include <XmlToPvlTranslationManager.h>

Inheritance diagram for Isis::XmlToPvlTranslationManager:
Inheritance graph
Collaboration diagram for Isis::XmlToPvlTranslationManager:
Collaboration graph

Public Member Functions

 XmlToPvlTranslationManager (const QString &transFile)
 Constructs and initializes an XmlToPvlTranslationManager object from the given Pvl translation file.
 
 XmlToPvlTranslationManager (std::istream &transStrm)
 Constructs and initializes an XmlToPvlTranslationManager object from the given input stream.
 
 XmlToPvlTranslationManager (FileName &inputLabel, const QString &transFile)
 Constructs and initializes an XmlToPvlTranslationManager object from the given Pvl translation file and input label.
 
 XmlToPvlTranslationManager (FileName &inputLabel, std::istream &transStrm)
 Constructs and initializes an XmlToPvlTranslationManager object from the given input stream and input label.
 
virtual ~XmlToPvlTranslationManager ()
 Destroys the XmlToPvlTranslationManager object.
 
virtual QString Translate (QString translationGroupName, int findex=0)
 Returns a translated value.
 
void Auto (FileName &inputLabel, Pvl &outputLabel)
 Automatically translate all the output names flagged with the Auto keyword in the translation table and store the translated key, value pairs in the argument pvl.
 
void SetLabel (FileName &inputLabel)
 Reads an Xml label file and internalizes it for translation.
 
virtual void Auto (Pvl &outputLabel)
 Automatically translate all the output names tagged as Auto in the translation table If a output name does not translate an error will be thrown by one of the support members.
 
QString Translate (const QString translationGroupName, const QString inputKeyValue="") const
 Translates a single output value from the given translation group name and input value.
 
virtual QStringList parseSpecification (QString specification) const
 Parses and validates a dependency specification.
 
virtual PvlKeyword InputGroup (const QString translationGroupName, const int inst=0) const
 Returns the input group name from the translation table corresponding to the output name argument.
 
virtual QString InputKeywordName (const QString translationGroupName) const
 Returns the input keyword name from the translation table corresponding to the output name argument.
 
QString InputDefault (const QString translationGroupName) const
 Returns the input default value from the translation table corresponding to the output name argument.
 
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

virtual std::vector< std::pair< QString, int > > validKeywords () const
 Returns a vector of valid keyword names and their sizes.
 
bool checkDependencies (QDomElement element, PvlKeyword dependencies, bool isDebug) const
 Checks if a element in the xml label satisfies a list of dependencies.
 
void parseFile (const FileName &xmlFileName)
 Opens, parses, and internalizes an Xml label file.
 
virtual PvlKeyword DoTranslation (const QString translationGroupName)
 Translate the requested output name to output values using the input name and values or default value.
 
virtual PvlContainerCreateContainer (const QString translationGroupName, Pvl &pvl)
 Creates all parent PVL containers for an output keyword.
 
PvlTranslationTable ()
 Protected accessor for pvl translation table passed into class.
 
const PvlTranslationTable () const
 Protected accessor for const pvl translation table passed into class.
 
bool hasInputDefault (const QString translationGroupName)
 Determines whether the given group has a default input value.
 
bool IsAuto (const QString translationGroupName)
 Determines whether the given group should be automatically translated.
 
bool IsOptional (const QString translationGroupName)
 Determines whether the translation group is optional.
 
PvlKeyword OutputPosition (const QString translationGroupName)
 Retrieves the OutputPosition PvlKeyword for the translation group with the given name.
 
QString OutputName (const QString translationGroupName)
 Retrieves a string containing the value of the OutputName keyword for the translation group with the given name.
 
const PvlGroupfindTranslationGroup (const QString translationGroupName) const
 Searches for translation group with the given name.
 

Private Attributes

QDomDocument m_xmlLabel
 The contents of the xml label.
 
Pvl p_trnsTbl
 

Detailed Description

Allows applications to translate Xml label files.

This class allows for translating Xml label files into Pvl objects. The translation process is driven by the output keyword names. Given an output keyword name, the Translate method uses the translation table to find the input value and then translates it into the output value.

The translation table is a Pvl object containing a Pvl group for each output keyword. The translation group for an output keyword is named the output keyword's name. The required PvlKeywords in a translation group are:

  • InputPosition: The series of element tag names leading from the second highest level element to the parent element of the input element.
  • InputKey: The tag name of the input element. The text value of this element is the input value for the translation.
  • OutputName: The output keyword's name.
  • OutputPosition: The location of the output keyword in the output label.
  • Translation: a pair defining how to convert the input value into the output value. The pair is consists of an output value and then the specific input value that will be converted into that output value. A star [*] for the output value indicates that the input value will not be changes and a star [*] for the input value matches any input value.

There are also optional keywords to modify the translation:

  • InputDefault: A default value that will be used for the input value if no input value can be found in the label.
  • Auto: The Auto keyword is not associated with a value. It indicates that the output keyword should be translated when the Auto() method is called.
  • Optional: The Optional keyword is not associated with a value. It indicates that the output keyword is not necessary. If an input value or default value is not found for an optional keyword, it will be skipped and translation will continue.
  • Debug: The Debug keyword is not associated with a value. It indicates that debug information is to be output when the translation is performed.
  • InputKeyAttribute: The name of the attribute of the input element that the input value will be read from. This will override reading the input value from the input element's text.
  • InputKeyDependencies: A list of dependencies that uniquely identify the input element. Each entry consists of a string specifying either the text value of a sibling element of the input element or the value of one of the input element's attributes. The specification string is formatted as TYPE@NAME:VALUE. The type is either tag or att indicating to check the value of an element of attribute respectively.

An example Xml translation table can be found at $ISISROOT/appdata/translations/XmlLabel.trn.

Author
2017-01-12 Jeannie Backer
History

2017-01-12 Jeannie Backer - Original version. Adapted from PvlTranslationManager class. Fixes #4584.

2017-01-13 Jeannie Backer and Jesse Mapel - Initial Translate and Auto design. Added dependencies for uniquely identifying input elements. Fixes #4584.

2017-01-18 Jesse Mapel - Updated documentation and error messages. Fixes #4584.

2017-01-25 Jesse Mapel - Created unit test. Fixes #4584.

2017-05-26 Makayla Shepherd - Renamed XmlToPvlTranslationManager.

2018-02-15 Kristin Berry and Summer Stapleton - Updated translate() method to search for multiple values for InputPosition keyword. Fixes #5332

2018-04-16 Jeannie Backer - Improved error message for keyword dependencies.

Definition at line 115 of file XmlToPvlTranslationManager.h.

Constructor & Destructor Documentation

◆ XmlToPvlTranslationManager() [1/4]

Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager ( const QString & transFile)

Constructs and initializes an XmlToPvlTranslationManager object from the given Pvl translation file.

If this constructor is used, the user will need to set the input label before translating. This may be done by using SetLabel(FileName inputLabel) or Auto(FileName inputLabel, Pvl outputLabel).

Parameters
transFileThe translation file to be used to tranlate keywords in the input label.

Definition at line 39 of file XmlToPvlTranslationManager.cpp.

References Isis::PvlTranslationTable::AddTable().

◆ XmlToPvlTranslationManager() [2/4]

Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager ( std::istream & transStrm)

Constructs and initializes an XmlToPvlTranslationManager object from the given input stream.

If this constructor is used, the user will need to set the input label before translating. This may be done by using SetLabel(FileName inputLabel) or Auto(FileName inputLabel, Pvl outputLabel).

Parameters
transStrmA stream containing the tranlation table to be used to tranlate keywords in the input label.

Definition at line 55 of file XmlToPvlTranslationManager.cpp.

References Isis::PvlTranslationTable::AddTable().

◆ XmlToPvlTranslationManager() [3/4]

Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager ( FileName & inputLabel,
const QString & transFile )

Constructs and initializes an XmlToPvlTranslationManager object from the given Pvl translation file and input label.

Parameters
inputLabelThe Xml holding the input label.
transFileThe translation file to be used to tranlate keywords in the input label.

Definition at line 70 of file XmlToPvlTranslationManager.cpp.

References Isis::PvlTranslationTable::AddTable(), and parseFile().

◆ XmlToPvlTranslationManager() [4/4]

Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager ( FileName & inputLabel,
std::istream & transStrm )

Constructs and initializes an XmlToPvlTranslationManager object from the given input stream and input label.

Parameters
inputLabelThe Xml holding the input label.
transStrmA stream containing the tranlation table to be used to tranlate keywords in the input label.

Definition at line 87 of file XmlToPvlTranslationManager.cpp.

References Isis::PvlTranslationTable::AddTable(), and parseFile().

◆ ~XmlToPvlTranslationManager()

Isis::XmlToPvlTranslationManager::~XmlToPvlTranslationManager ( )
virtual

Destroys the XmlToPvlTranslationManager object.

Definition at line 98 of file XmlToPvlTranslationManager.cpp.

Member Function Documentation

◆ AddTable() [1/2]

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.

Definition at line 84 of file PvlTranslationTable.cpp.

References Isis::Pvl::read().

◆ AddTable() [2/2]

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.
Exceptions
IException::User- "Unable to find InputKey for group in translation file."
IException::User- "Keyword is not valid. Error in file."
IException::User- "Keyword does not have correct number of elements. Error in file."

Definition at line 102 of file PvlTranslationTable.cpp.

References Isis::PvlKeyword::name(), Isis::IException::User, and Isis::PvlTranslationTable::validKeywords().

Referenced by Isis::LabelTranslationManager::LabelTranslationManager(), Isis::LabelTranslationManager::LabelTranslationManager(), Isis::PvlTranslationTable::PvlTranslationTable(), XmlToPvlTranslationManager(), XmlToPvlTranslationManager(), XmlToPvlTranslationManager(), and XmlToPvlTranslationManager().

◆ Auto() [1/2]

void Isis::XmlToPvlTranslationManager::Auto ( FileName & inputLabel,
Pvl & outputLabel )

Automatically translate all the output names flagged with the Auto keyword in the translation table and store the translated key, value pairs in the argument pvl.

Parameters
inputLabelThe input label file to be translated.
outputLabelThe output translated Pvl.

Definition at line 449 of file XmlToPvlTranslationManager.cpp.

References Auto(), and parseFile().

Referenced by Auto().

◆ Auto() [2/2]

void Isis::LabelTranslationManager::Auto ( Pvl & outputLabel)
virtual

Automatically translate all the output names tagged as Auto in the translation table If a output name does not translate an error will be thrown by one of the support members.

The results of the translations will be stored in the outputLabel PVL based on the OutputPosition keywords in the translation table.

Parameters
outputLabelThe PVL to add the translated keywords to.

Reimplemented from Isis::LabelTranslationManager.

Definition at line 58 of file LabelTranslationManager.cpp.

◆ checkDependencies()

bool Isis::XmlToPvlTranslationManager::checkDependencies ( QDomElement element,
PvlKeyword dependencies,
bool isDebug ) const
protected

Checks if a element in the xml label satisfies a list of dependencies.

Checks if a element in the xml label satisfies a list of dependencies. The dependencies are requirements on the values of attributes of the element and/or the values of sibling elements. The dependencies are specified by strings that are formatted as follows [tag/att]@[tagName/attName]|[value] or [tagName/attName]|[value]

Parameters
elementThe element to check dependencies on.
dependenciesA multi-valued keyword were every entry specifies a requirement upon either an attribute of the element or a sibling of the element.
Returns
bool If the element passed the dependencies check
Exceptions
IException::Unknown"Parsing error, dependency type is not [att] or [tag]."

Definition at line 372 of file XmlToPvlTranslationManager.cpp.

References Isis::LabelTranslationManager::parseSpecification(), Isis::toString(), and Isis::IException::Unknown.

Referenced by Translate().

◆ CreateContainer()

PvlContainer * Isis::LabelTranslationManager::CreateContainer ( const QString translationGroupName,
Pvl & pvl )
protectedvirtualinherited

Creates all parent PVL containers for an output keyword.

If any parent containers already exist then they will not be recreated.

Parameters
translationGroupNameThe name of the output keyword. The OutputPosition keyword in the translation group for translationGroupName will be used to determine which containers are made.
pvlThe PVL file to create the containers in.
Returns
PvlContainer The immediate parent container for translationGroupName.

Reimplemented in Isis::PvlToPvlTranslationManager.

Definition at line 100 of file LabelTranslationManager.cpp.

References Isis::PvlObject::addObject(), and Isis::PvlTranslationTable::OutputPosition().

Referenced by Isis::LabelTranslationManager::Auto(), and Isis::PvlToPvlTranslationManager::CreateContainer().

◆ DoTranslation()

PvlKeyword Isis::LabelTranslationManager::DoTranslation ( const QString outputName)
protectedvirtualinherited

Translate the requested output name to output values using the input name and values or default value.

Parameters
outputNameThe output name used to identify the input keyword to be translated.
Returns
PvlKeyword A keyword containing the output name and output value.

@TODO output units

Reimplemented in Isis::PvlToPvlTranslationManager.

Definition at line 144 of file LabelTranslationManager.cpp.

Referenced by Isis::LabelTranslationManager::Auto().

◆ findTranslationGroup()

const PvlGroup & Isis::PvlTranslationTable::findTranslationGroup ( const QString translationGroupName) const
protectedinherited

Searches for translation group with the given name.

See also
PvlObject::findGroup()
Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
const PvlGroup& The first PVL group with the given name.
Exceptions
IException::Programmer- "Unable to find translation group in file."

Definition at line 538 of file PvlTranslationTable.cpp.

References Isis::PvlContainer::fileName(), Isis::PvlObject::findGroup(), Isis::PvlObject::hasGroup(), and Isis::IException::Programmer.

Referenced by Isis::PvlTranslationTable::hasInputDefault(), Isis::PvlTranslationTable::InputDefault(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlTranslationTable::InputKeywordName(), Isis::PvlTranslationTable::IsAuto(), Isis::PvlTranslationTable::IsOptional(), Isis::PvlTranslationTable::OutputName(), Isis::PvlTranslationTable::OutputPosition(), and Isis::PvlTranslationTable::Translate().

◆ hasInputDefault()

bool Isis::PvlTranslationTable::hasInputDefault ( const QString translationGroupName)
protectedinherited

Determines whether the given group has a default input value.

This method returns true if the translation group contains a PvlKeyword with the name "InputDefault". Note: no value needs to be assigned to this keyword.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
bool Indicates whether the given group has an InputDefault keyword.

Definition at line 407 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Translate().

◆ InputDefault()

QString Isis::PvlTranslationTable::InputDefault ( const QString translationGroupName) const
inherited

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

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
QString The input default value.

Definition at line 382 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Translate().

◆ InputGroup()

PvlKeyword Isis::PvlTranslationTable::InputGroup ( const QString translationGroupName,
const int inst = 0 ) const
virtualinherited

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

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
instThe occurence number of the "InputGroup" keyword (first one is zero)
Returns
QString The input group name
Exceptions
IException::Programmer- "Keyword [InputPosition] cannot have a comma [,] in the value."

Definition at line 285 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup(), Isis::IException::Programmer, and Isis::PvlKeyword::size().

Referenced by Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::PvlToXmlTranslationManager::doTranslation(), Isis::PvlToPvlTranslationManager::InputHasKeyword(), Isis::PvlToXmlTranslationManager::InputHasKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), Isis::PvlToXmlTranslationManager::InputKeyword(), Isis::PvlToPvlTranslationManager::Translate(), and Isis::PvlToXmlTranslationManager::Translate().

◆ InputKeywordName()

QString Isis::PvlTranslationTable::InputKeywordName ( const QString translationGroupName) const
virtualinherited

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

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
QString The input keyword name
Exceptions
IException::Programmer

Definition at line 360 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Isis::PvlToXmlTranslationManager::doTranslation(), Isis::PvlToPvlTranslationManager::InputHasKeyword(), Isis::PvlToXmlTranslationManager::InputHasKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), Isis::PvlToXmlTranslationManager::InputKeyword(), Isis::PvlToPvlTranslationManager::Translate(), and Isis::PvlToXmlTranslationManager::Translate().

◆ IsAuto()

bool Isis::PvlTranslationTable::IsAuto ( const QString translationGroupName)
protectedinherited

Determines whether the given group should be automatically translated.

This method returns true if the translation group contains a PvlKeyword with the name "Auto". Note: no value is assigned to this keyword.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
bool Indicates whether the given group has an Auto keyword.

Definition at line 432 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Isis::LabelTranslationManager::Auto(), Isis::PvlToPvlTranslationManager::Auto(), and Isis::PvlToXmlTranslationManager::Auto().

◆ IsOptional()

bool Isis::PvlTranslationTable::IsOptional ( const QString translationGroupName)
protectedinherited

Determines whether the translation group is optional.

This method returns true if the translation group contains a PvlKeyword with the name "Optional". Note: no value is assigned to this keyword.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
bool Indicates whether the given group has an Optional keyword.

Definition at line 457 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Isis::LabelTranslationManager::Auto(), Isis::PvlToPvlTranslationManager::Auto(), and Isis::PvlToXmlTranslationManager::Auto().

◆ OutputName()

QString Isis::PvlTranslationTable::OutputName ( const QString translationGroupName)
protectedinherited

Retrieves a string containing the value of the OutputName keyword for the translation group with the given name.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
QString The value of the OutputName keyword from the given translation group.

Definition at line 511 of file PvlTranslationTable.cpp.

References Isis::PvlTranslationTable::findTranslationGroup().

Referenced by Isis::PvlToPvlTranslationManager::DoTranslation(), and Isis::PvlToXmlTranslationManager::doTranslation().

◆ OutputPosition()

PvlKeyword Isis::PvlTranslationTable::OutputPosition ( const QString translationGroupName)
protectedinherited

Retrieves the OutputPosition PvlKeyword for the translation group with the given name.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
Returns
PvlKeyword The OutputPosition keyword from the given translation group.
Exceptions
IException::Programmer- "Unable to find translation keyword [OutputPostion] in translation group in file."

Definition at line 483 of file PvlTranslationTable.cpp.

References Isis::PvlContainer::fileName(), Isis::PvlTranslationTable::findTranslationGroup(), and Isis::IException::Programmer.

Referenced by Isis::LabelTranslationManager::CreateContainer(), and Isis::PvlToXmlTranslationManager::createParentElements().

◆ parseFile()

void Isis::XmlToPvlTranslationManager::parseFile ( const FileName & xmlFileName)
protected

Opens, parses, and internalizes an Xml label file.

Parameters
xmlFileNameThe Xml label file.
Exceptions
IException::Unknown"Could not open label file."
IException::Unknown"XML read/parse error in file."

Definition at line 464 of file XmlToPvlTranslationManager.cpp.

References m_xmlLabel, Isis::toString(), and Isis::IException::Unknown.

Referenced by Auto(), SetLabel(), XmlToPvlTranslationManager(), and XmlToPvlTranslationManager().

◆ parseSpecification()

QStringList Isis::LabelTranslationManager::parseSpecification ( QString specification) const
virtualinherited

Parses and validates a dependency specification.

Parameters
specificationThe dependency specification string.
Returns
QStringList The dependency split into 3 components
  1. the type (att or tag)
  2. the name of what to check
  3. the value to check for
Exceptions
IException::Programmer"Malformed dependency specification."
IException::Programmer"Specification does not have two components separated by [@], the type of dependency and the name-value pair. @throws IException::Programmer "Dependency type specification is invalid. Valid types are [att] and [tag]" @throws IException::Programmer "Name-value specification does not have two components separated by [|]."

Definition at line 172 of file LabelTranslationManager.cpp.

References Isis::IException::Programmer.

Referenced by Isis::PvlToXmlTranslationManager::addAttributes(), Isis::PvlToXmlTranslationManager::addSiblings(), checkDependencies(), Isis::PvlToXmlTranslationManager::createParentElements(), and Isis::PvlToXmlTranslationManager::doTranslation().

◆ SetLabel()

void Isis::XmlToPvlTranslationManager::SetLabel ( FileName & inputLabel)

Reads an Xml label file and internalizes it for translation.

Parameters
inputLabelThe input label file

Definition at line 107 of file XmlToPvlTranslationManager.cpp.

References parseFile().

◆ Translate() [1/2]

QString Isis::PvlTranslationTable::Translate ( const QString translationGroupName,
const QString inputKeyValue = "" ) const
inherited

Translates a single output value from the given translation group name and input value.

Parameters
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
inputKeyValueThe value to be translated, from the input keyword.
Returns
QString The translated value, for the output keyword.
Exceptions
IException::Programmer- "No value or default value to translate for translation group."
IException::Programmer- "Unable to find translation value in file."

Definition at line 216 of file PvlTranslationTable.cpp.

References Isis::PvlContainer::fileName(), Isis::PvlTranslationTable::findTranslationGroup(), and Isis::IException::Programmer.

Referenced by Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::PvlToXmlTranslationManager::doTranslation(), Isis::PvlToPvlTranslationManager::Translate(), Translate(), and Isis::PvlToXmlTranslationManager::Translate().

◆ Translate() [2/2]

QString Isis::XmlToPvlTranslationManager::Translate ( QString translationGroupName,
int index = 0 )
virtual

Returns a translated value.

The translation group 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
translationGroupNameThe name of the PVL translation group used to identify the input/output keywords to be translated. Often, this is the same as the output keyword name.
indexThe index into the input keyword array. Defaults to 0
Returns
QString The translated output value to be placed in the ISIS cube label.
Exceptions
IException::Unknown"Failed to translate output value."
IException::Unknown"Cannot translate value. Xml files can only store a single value in each element."
IException::Unknown"Unable to retrieve translation group from translation table."
IException::Unknown"Unable to retrieve [InputPosition] keyword from translation group."
IException::Unknown"Unable to retrieve [InputKey] keyword from translation group."
IException::Unknown"Failed traversing input position. Element does not have the named child element."
IException::Unknown"Could not find an input value or default value."
IException::Unknown"Input element does not have the named attribute."

Implements Isis::LabelTranslationManager.

Definition at line 163 of file XmlToPvlTranslationManager.cpp.

References checkDependencies(), Isis::PvlTranslationTable::hasInputDefault(), Isis::PvlTranslationTable::InputDefault(), m_xmlLabel, Isis::toString(), Isis::PvlTranslationTable::Translate(), Isis::PvlTranslationTable::TranslationTable(), and Isis::IException::Unknown.

◆ TranslationTable() [1/2]

Pvl & Isis::PvlTranslationTable::TranslationTable ( )
protectedinherited

Protected accessor for pvl translation table passed into class.

This method returns a reference to the translation table member.

Returns
Pvl The translation table as a PVL object.

Definition at line 62 of file PvlTranslationTable.cpp.

Referenced by Isis::LabelTranslationManager::Auto(), Isis::PvlToPvlTranslationManager::Auto(), Isis::PvlToXmlTranslationManager::Auto(), Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::PvlToPvlTranslationManager::InputKeyword(), Isis::PvlToXmlTranslationManager::InputKeyword(), and Translate().

◆ TranslationTable() [2/2]

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

Protected accessor for const pvl translation table passed into class.

This method returns a const reference to the translation table member.

Returns
Pvl The translation table as a PVL object.

Definition at line 74 of file PvlTranslationTable.cpp.

◆ validKeywords()

vector< pair< QString, int > > Isis::XmlToPvlTranslationManager::validKeywords ( ) const
protectedvirtual

Returns a vector of valid keyword names and their sizes.

A size of -1 indicates that the keyword can be any size.

Returns
vector<pair<QString,int>> A vector of valid keyword names and their sizes.

Reimplemented from Isis::PvlTranslationTable.

Definition at line 118 of file XmlToPvlTranslationManager.cpp.

References Isis::PvlTranslationTable::validKeywords(), and validKeywords().

Referenced by validKeywords().

Member Data Documentation

◆ m_xmlLabel

QDomDocument Isis::XmlToPvlTranslationManager::m_xmlLabel
private

The contents of the xml label.

Definition at line 145 of file XmlToPvlTranslationManager.h.

Referenced by parseFile(), and Translate().

◆ p_trnsTbl

Pvl Isis::PvlTranslationTable::p_trnsTbl
privateinherited

Definition at line 145 of file PvlTranslationTable.h.


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