Isis 3 Programmer Reference
Isis::PvlToXmlTranslationManager Class Reference

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

#include <PvlToXmlTranslationManager.h>

Inheritance diagram for Isis::PvlToXmlTranslationManager:
Inheritance graph
Collaboration diagram for Isis::PvlToXmlTranslationManager:
Collaboration graph

Public Member Functions

 PvlToXmlTranslationManager (const QString &transFile)
 Constructs and initializes a TranslationManager object from given the Pvl translation file.
 
 PvlToXmlTranslationManager (Pvl &inputLabel, const QString &transFile)
 Constructs and initializes a TranslationManager object.
 
virtual ~PvlToXmlTranslationManager ()
 Destroys the TranslationManager object.
 
virtual QString Translate (QString translationGroupName, int inputIndex=0)
 Returns a translated value.
 
void Auto (QDomDocument &outputLabel)
 Automatically translate all the output names found in the translation table.
 
void Auto (Pvl &inputLabel, QDomDocument &outputLabel)
 Set the inputLabel and automatically translate all the output names found in the translation table.
 
virtual const PvlKeywordInputKeyword (const QString translationGroupName) const
 Uses the translation file group name to find the input label's PvlKeyword that corresponds to the InputKey value of the translation table and returns it, if found.
 
virtual bool InputHasKeyword (const QString translationGroupName)
 Indicates if the input keyword corresponding to the output name exists in the label.
 
void SetLabel (Pvl &inputLabel)
 Internalizes a Pvl formatted label for translation.
 
QString Translate (const QString translationGroupName, const QString inputKeyValue="") const
 Translates a single output value from the given translation group name and input value.
 
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.
 
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.
 

Static Public Member Functions

static void addElement (QDomElement &parent, QString name, QString value, QString units="")
 Add a QDomElement to the given parent with the indicated value and units.
 
static void setElementValue (QDomElement &element, QString value, QString units="")
 Set the QDomElement's value, and units, if units != "".
 
static void resetElementValue (QDomElement &element, QString value, QString units="")
 Reset the QDomElement's value, and units, if units != "".
 

Protected Member Functions

void doTranslation (PvlGroup transGroup, QDomElement &parent)
 Translate the requested output name to output values using the input name and values or default value.
 
virtual const PvlContainerGetContainer (const PvlKeyword &inputGroup) const
 Return a container from the input label with the path given by the "InputPosition" keyword of the translation table.
 
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
 
QDomElement * createParentElements (const QString translationGroupName, QDomElement &xml)
 Read the OutputPosition for the translation group name passed and create any parent elements specified by OutputPosition to prepare for translation.
 
void addSiblings (PvlKeyword outputSiblings, QDomElement &parent)
 Take in outputSiblings PvlKeyword and turn each sibling into its corresponding QDomElement.
 
void addAttributes (PvlKeyword something, QDomElement &parent)
 Take in the outputAttributes PvlKeyword and add each attribute to the appropriate element given as an argument.
 
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

Pvl m_inputLabel
 A Pvl object for the input label file.
 
Pvl p_trnsTbl
 

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 into Xml files.

Author
2017-05-24 Jeannie Backer and Ian Humphrey
History

2017-05-24 Jeannie Backer and Ian Humphrey - Original version.

2017-05-26 Ian Humphrey & Makayla Shepherd - Added createParentElements.

2017-05-26 Makayla Shepherd & Adam Paquette - Added addSiblings and setElementValue.

2017-05-30 Makayla Shepherd - Renamed p_fLabel to m_inputLabel, and updated documentation.

2017-05-31 Adam Paquette - Added addAttributes method.

2017-05-31 Ian Humphrey & Makayla Shepherd - Fixed duplicate root xml element in output xml file.

2017-06-02 Makayla Shepherd - Made setElementValue public.

2017-10-18 Jeannie Backer & Makayla Shepherd - Added convenience methods, addElement and resetElementValue, and made setElementValue static. See #5202.

2017-10-31 Jeannie Backer - Moved creation of sibling elements in doTranslation() so that this only happens if the translation is succesful.

Definition at line 51 of file PvlToXmlTranslationManager.h.

Constructor & Destructor Documentation

◆ PvlToXmlTranslationManager() [1/2]

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

Constructs and initializes a TranslationManager object from given the 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(Pvl inputLabel) or Auto(Pvl inputLabel, Pvl outputLabel).

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

Definition at line 36 of file PvlToXmlTranslationManager.cpp.

◆ PvlToXmlTranslationManager() [2/2]

Isis::PvlToXmlTranslationManager::PvlToXmlTranslationManager ( 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.

Definition at line 49 of file PvlToXmlTranslationManager.cpp.

References m_inputLabel.

◆ ~PvlToXmlTranslationManager()

Isis::PvlToXmlTranslationManager::~PvlToXmlTranslationManager ( )
virtual

Destroys the TranslationManager object.

Definition at line 57 of file PvlToXmlTranslationManager.cpp.

Member Function Documentation

◆ addAttributes()

void Isis::PvlToXmlTranslationManager::addAttributes ( PvlKeyword outputAttributes,
QDomElement & element )
protected

Take in the outputAttributes PvlKeyword and add each attribute to the appropriate element given as an argument.

Parameters
outputAttributesThe PvlKeyword that holds the list of siblings
elementQDomElement to be modified
Exceptions
IException::Programmer"Malformed output attribute [" + outputAttributes[i] + ]."

Definition at line 471 of file PvlToXmlTranslationManager.cpp.

References Isis::LabelTranslationManager::parseSpecification(), and Isis::IException::Programmer.

Referenced by doTranslation().

◆ addElement()

void Isis::PvlToXmlTranslationManager::addElement ( QDomElement & parent,
QString name,
QString value,
QString units = "" )
static

Add a QDomElement to the given parent with the indicated value and units.

Parameters
parentThe parent QDomElement of the new element.
nameThe name of the new element.
valueThe value of the new element.
unitsA string containing the unit specification for the new element.

Definition at line 498 of file PvlToXmlTranslationManager.cpp.

References setElementValue().

◆ addSiblings()

void Isis::PvlToXmlTranslationManager::addSiblings ( PvlKeyword outputSiblings,
QDomElement & parent )
protected

Take in outputSiblings PvlKeyword and turn each sibling into its corresponding QDomElement.

Then add the QDomElement to the parent as a child.

Parameters
outputSiblingsThe PvlKeyword that holds the list of siblings
parentThe parent QDomElement
Exceptions
IException::Programmer"Malformed OutputSibling [" + outputSiblings[i] + "]"

Definition at line 438 of file PvlToXmlTranslationManager.cpp.

References Isis::LabelTranslationManager::parseSpecification(), Isis::IException::Programmer, and setElementValue().

Referenced by doTranslation().

◆ 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(), Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager(), Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager(), Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager(), and Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager().

◆ Auto() [1/3]

void Isis::PvlToXmlTranslationManager::Auto ( Pvl & inputLabel,
QDomDocument & outputLabel )

Set the inputLabel and automatically translate all the output names found in the translation table.

If a output name does not translate an error will be thrown by one of the support members. If the output name is translated, store the translated key, value pairs in the QDomDocument.

Parameters
inputLabelThe input Pvl label
outputLabelThe output QDomDocument label
See also
Auto(QDomDocument &outputLabel)

Definition at line 207 of file PvlToXmlTranslationManager.cpp.

References Auto(), and m_inputLabel.

◆ Auto() [2/3]

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

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 in Isis::PvlToPvlTranslationManager, and Isis::XmlToPvlTranslationManager.

Definition at line 70 of file LabelTranslationManager.cpp.

References Isis::LabelTranslationManager::CreateContainer(), Isis::LabelTranslationManager::DoTranslation(), Isis::PvlObject::group(), Isis::PvlObject::groups(), Isis::PvlTranslationTable::IsAuto(), Isis::PvlTranslationTable::IsOptional(), and Isis::PvlTranslationTable::TranslationTable().

◆ Auto() [3/3]

void Isis::PvlToXmlTranslationManager::Auto ( QDomDocument & outputLabel)

Automatically translate all the output names found in the translation table.

If a output name does not translate an error will be thrown by one of the support members. If the output name is translated, store the translated key, value pairs in the QDomDocument.

Parameters
outputLabelA reference to the output QDomDocument label

Definition at line 221 of file PvlToXmlTranslationManager.cpp.

References createParentElements(), doTranslation(), Isis::PvlObject::group(), Isis::PvlObject::groups(), Isis::PvlTranslationTable::IsAuto(), Isis::PvlTranslationTable::IsOptional(), and Isis::PvlTranslationTable::TranslationTable().

Referenced by Auto().

◆ 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().

◆ createParentElements()

QDomElement * Isis::PvlToXmlTranslationManager::createParentElements ( const QString translationGroupName,
QDomElement & xmlRootElement )
protected

Read the OutputPosition for the translation group name passed and create any parent elements specified by OutputPosition to prepare for translation.

Parameters
constQString translationGroupName Name of the translation group we will grab OutputPosition from.
QDomElement&xmlRootElement The XML document root element to add to.
Returns
QDomElement * Returns a pointer to the parent element right above the element we are going to create when the caller starts the translation.

Definition at line 378 of file PvlToXmlTranslationManager.cpp.

References Isis::PvlTranslationTable::OutputPosition(), and Isis::LabelTranslationManager::parseSpecification().

Referenced by Auto().

◆ 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().

◆ doTranslation()

void Isis::PvlToXmlTranslationManager::doTranslation ( PvlGroup transGroup,
QDomElement & parentElement )
protected

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

Parameters
transGroupNameThe output name used to identify the input keyword to be translated.
parentElementThe element that is the parent of the new QDomElement, if a new element is created. If a new element is not created, then parentElement will have an attribute added to it.

Definition at line 133 of file PvlToXmlTranslationManager.cpp.

References addAttributes(), addSiblings(), GetContainer(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlTranslationTable::InputKeywordName(), Isis::PvlTranslationTable::OutputName(), Isis::LabelTranslationManager::parseSpecification(), setElementValue(), and Isis::PvlTranslationTable::Translate().

Referenced by 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().

◆ GetContainer()

const PvlContainer * Isis::PvlToXmlTranslationManager::GetContainer ( const PvlKeyword & inputGroup) const
protectedvirtual

Return a container from the input label with the path given by the "InputPosition" keyword of the translation table.

Parameters
inputGroupThe InputPosition keyword
Returns
PvlContainer* Pointer to the PvlContainer found

Definition at line 330 of file PvlToXmlTranslationManager.cpp.

References Isis::PvlObject::findObject(), m_inputLabel, and Isis::PvlKeyword::stringEqual().

Referenced by doTranslation(), InputHasKeyword(), InputKeyword(), and 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 Isis::XmlToPvlTranslationManager::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 Isis::XmlToPvlTranslationManager::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(), doTranslation(), Isis::PvlToPvlTranslationManager::InputHasKeyword(), InputHasKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), InputKeyword(), Isis::PvlToPvlTranslationManager::Translate(), and Translate().

◆ InputHasKeyword()

bool Isis::PvlToXmlTranslationManager::InputHasKeyword ( const QString transGroupName)
virtual

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

Parameters
transGroupNameThe output name used to identify the input keyword.
Returns
bool If the input keyword exists in the input label.

Definition at line 304 of file PvlToXmlTranslationManager.cpp.

References GetContainer(), Isis::PvlTranslationTable::InputGroup(), and Isis::PvlTranslationTable::InputKeywordName().

◆ InputKeyword()

const PvlKeyword & Isis::PvlToXmlTranslationManager::InputKeyword ( const QString transGroupName) const
virtual

Uses the translation file group name to find the input label's PvlKeyword that corresponds to the InputKey value of the translation table and returns it, if found.

Parameters
transGroupNameThe name of the translation group for this InputKey.
Returns
PvlKeyword The input PvlKeyword for the translation group.
Exceptions
IException::Programmer

Definition at line 254 of file PvlToXmlTranslationManager.cpp.

References Isis::PvlContainer::fileName(), GetContainer(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlTranslationTable::InputKeywordName(), Isis::IException::Programmer, and Isis::PvlTranslationTable::TranslationTable().

◆ 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 doTranslation(), Isis::PvlToPvlTranslationManager::InputHasKeyword(), InputHasKeyword(), Isis::PvlToPvlTranslationManager::InputKeyword(), InputKeyword(), Isis::PvlToPvlTranslationManager::Translate(), and 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 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 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 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 createParentElements().

◆ 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 addAttributes(), addSiblings(), Isis::XmlToPvlTranslationManager::checkDependencies(), createParentElements(), and doTranslation().

◆ resetElementValue()

void Isis::PvlToXmlTranslationManager::resetElementValue ( QDomElement & element,
QString value,
QString units = "" )
static

Reset the QDomElement's value, and units, if units != "".

Parameters
elementThe QDomElement whose value needs to be reset.
valueThe value to set.
unitsA string containing the unit specification.

Definition at line 536 of file PvlToXmlTranslationManager.cpp.

Referenced by Isis::ProcessExportPds4::identificationArea(), Isis::ProcessExportPds4::reorder(), Isis::ProcessExportPds4::StandardAllMapping(), and Isis::ProcessExportPds4::standardInstrument().

◆ setElementValue()

void Isis::PvlToXmlTranslationManager::setElementValue ( QDomElement & element,
QString value,
QString units = "" )
static

Set the QDomElement's value, and units, if units != "".

Parameters
elementThe QDomElement whose value needs to be set.
valueThe value to set.
unitsA string containing the unit specification.

Definition at line 516 of file PvlToXmlTranslationManager.cpp.

Referenced by addElement(), Isis::ProcessExportPds4::addHistory(), addSiblings(), doTranslation(), Isis::ProcessExportPds4::fileAreaObservational(), Isis::ProcessExportPds4::translateBandBinSpectrumBinSet(), Isis::ProcessExportPds4::translateBandBinSpectrumUniform(), and Isis::ProcessExportPds4::WritePds4().

◆ SetLabel()

void Isis::PvlToXmlTranslationManager::SetLabel ( Pvl & inputLabel)

Internalizes a Pvl formatted label for translation.

Parameters
inputLabelThe Pvl formatted label to be translated.

Definition at line 66 of file PvlToXmlTranslationManager.cpp.

References m_inputLabel.

◆ 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(), doTranslation(), Isis::PvlToPvlTranslationManager::Translate(), Isis::XmlToPvlTranslationManager::Translate(), and Translate().

◆ Translate() [2/2]

QString Isis::PvlToXmlTranslationManager::Translate ( QString transGroupName,
int inputIndex = 0 )
virtual

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
transGroupNameThe output name used to identify the input keyword to be translated.
findexThe index into the input keyword array. Defaults to 0
Returns
QString The translated value.

Implements Isis::LabelTranslationManager.

Definition at line 104 of file PvlToXmlTranslationManager.cpp.

References GetContainer(), Isis::PvlTranslationTable::InputGroup(), Isis::PvlTranslationTable::InputKeywordName(), and Isis::PvlTranslationTable::Translate().

◆ 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(), Auto(), Isis::PvlToPvlTranslationManager::DoTranslation(), Isis::PvlToPvlTranslationManager::InputKeyword(), InputKeyword(), and Isis::XmlToPvlTranslationManager::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::PvlToXmlTranslationManager::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.
See also
PvlTranslationTable::validKeywords()

Reimplemented from Isis::PvlTranslationTable.

Definition at line 79 of file PvlToXmlTranslationManager.cpp.

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

Referenced by validKeywords().

Member Data Documentation

◆ m_inputLabel

Pvl Isis::PvlToXmlTranslationManager::m_inputLabel
private

A Pvl object for the input label file.

Definition at line 92 of file PvlToXmlTranslationManager.h.

Referenced by Auto(), GetContainer(), PvlToXmlTranslationManager(), and SetLabel().

◆ 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: