Isis 3 Programmer Reference
PvlToXmlTranslationManager.h
1#ifndef PvlToXmlTranslationManager_h
2#define PvlToXmlTranslationManager_h
8/* SPDX-License-Identifier: CC0-1.0 */
9#include "LabelTranslationManager.h"
10
11#include <string>
12
13#include <QDomDocument>
14
15#include "FileName.h"
16#include "Pvl.h"
17#include "PvlTokenizer.h"
18
19class QDomElement;
20class QString;
21
22namespace Isis {
23 class Pvl;
24 class PvlContainer;
25 class PvlKeyword;
52 public:
53 PvlToXmlTranslationManager(const QString &transFile);
54
56 const QString &transFile);
57
59
60 // Attempt to translate the requested output name to output value
61 // using the input name and value/default value
62 virtual QString Translate(QString translationGroupName, int inputIndex = 0);
63
64 // Translate all translation table groups which contain "Auto"
65 void Auto(QDomDocument &outputLabel);
66 void Auto(Pvl &inputLabel, QDomDocument &outputLabel);
67
68 // Return the ith input value associated with a output name
69 virtual const PvlKeyword &InputKeyword(const QString translationGroupName) const;
70
71 // Return true if the input lable contains the translated group and key names
72 virtual bool InputHasKeyword(const QString translationGroupName);
73
74 void SetLabel(Pvl &inputLabel);
75
76 static void addElement(QDomElement &parent, QString name, QString value, QString units = "");
77 static void setElementValue(QDomElement &element, QString value, QString units = "");
78 static void resetElementValue(QDomElement &element, QString value, QString units = "");
79
80
81 protected:
82 void doTranslation(PvlGroup transGroup, QDomElement &parent);
83 virtual const PvlContainer *GetContainer(const PvlKeyword &inputGroup) const;
84
85 virtual std::vector< std::pair<QString, int> > validKeywords() const;
86 bool checkDependencies(QDomElement element, PvlKeyword dependencies, bool isDebug) const;
87 QDomElement *createParentElements(const QString translationGroupName, QDomElement &xml);
88 void addSiblings(PvlKeyword outputSiblings, QDomElement &parent);
89 void addAttributes(PvlKeyword something, QDomElement &parent);
90
91 private:
93 };
94};
95
96#endif
Allows applications to translate simple text files.
Contains more than one keyword-value pair.
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
A single keyword-value pair.
Definition PvlKeyword.h:87
Allows applications to translate simple text files.
void SetLabel(Pvl &inputLabel)
Internalizes a Pvl formatted label for translation.
PvlToXmlTranslationManager(const QString &transFile)
Constructs and initializes a TranslationManager object from given the Pvl translation file.
void doTranslation(PvlGroup transGroup, QDomElement &parent)
Translate the requested output name to output values using the input name and values or default value...
virtual ~PvlToXmlTranslationManager()
Destroys the TranslationManager object.
QDomElement * createParentElements(const QString translationGroupName, QDomElement &xml)
Read the OutputPosition for the translation group name passed and create any parent elements specifie...
static void resetElementValue(QDomElement &element, QString value, QString units="")
Reset the QDomElement's value, and units, if units != "".
static void setElementValue(QDomElement &element, QString value, QString units="")
Set the QDomElement's value, and units, if units != "".
virtual bool InputHasKeyword(const QString translationGroupName)
Indicates if the input keyword corresponding to the output name exists in the label.
virtual QString Translate(QString translationGroupName, int inputIndex=0)
Returns a translated value.
void addSiblings(PvlKeyword outputSiblings, QDomElement &parent)
Take in outputSiblings PvlKeyword and turn each sibling into its corresponding QDomElement.
virtual std::vector< std::pair< QString, int > > validKeywords() const
Returns a vector of valid keyword names and their sizes.
void addAttributes(PvlKeyword something, QDomElement &parent)
Take in the outputAttributes PvlKeyword and add each attribute to the appropriate element given as an...
virtual const PvlKeyword & InputKeyword(const QString translationGroupName) const
Uses the translation file group name to find the input label's PvlKeyword that corresponds to the Inp...
virtual const PvlContainer * GetContainer(const PvlKeyword &inputGroup) const
Return a container from the input label with the path given by the "InputPosition" keyword of the tra...
void Auto(QDomDocument &outputLabel)
Automatically translate all the output names found in the translation table.
static void addElement(QDomElement &parent, QString name, QString value, QString units="")
Add a QDomElement to the given parent with the indicated value and units.
Pvl m_inputLabel
A Pvl object for the input label file.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16