Isis 3 Programmer Reference
PvlToXmlTranslationManager.h
Go to the documentation of this file.
1 #ifndef PvlToXmlTranslationManager_h
2 #define PvlToXmlTranslationManager_h
3 
25 
26 #include <string>
27 
28 #include <QDomDocument>
29 
30 #include "FileName.h"
31 #include "Pvl.h"
32 #include "PvlTokenizer.h"
33 
34 class QDomElement;
35 class QString;
36 
37 namespace Isis {
38  class Pvl;
39  class PvlContainer;
40  class PvlKeyword;
67  public:
68  PvlToXmlTranslationManager(const QString &transFile);
69 
70  PvlToXmlTranslationManager(Pvl &inputLabel,
71  const QString &transFile);
72 
74 
75  // Attempt to translate the requested output name to output value
76  // using the input name and value/default value
77  virtual QString Translate(QString translationGroupName, int inputIndex = 0);
78 
79  // Translate all translation table groups which contain "Auto"
80  void Auto(QDomDocument &outputLabel);
81  void Auto(Pvl &inputLabel, QDomDocument &outputLabel);
82 
83  // Return the ith input value associated with a output name
84  virtual const PvlKeyword &InputKeyword(const QString translationGroupName) const;
85 
86  // Return true if the input lable contains the translated group and key names
87  virtual bool InputHasKeyword(const QString translationGroupName);
88 
89  void SetLabel(Pvl &inputLabel);
90 
91  static void addElement(QDomElement &parent, QString name, QString value, QString units = "");
92  static void setElementValue(QDomElement &element, QString value, QString units = "");
93  static void resetElementValue(QDomElement &element, QString value, QString units = "");
94 
95 
96  protected:
97  void doTranslation(PvlGroup transGroup, QDomElement &parent);
98  virtual const PvlContainer *GetContainer(const PvlKeyword &inputGroup) const;
99 
100  virtual std::vector< std::pair<QString, int> > validKeywords() const;
101  bool checkDependencies(QDomElement element, PvlKeyword dependencies, bool isDebug) const;
102  QDomElement *createParentElements(const QString translationGroupName, QDomElement &xml);
103  void addSiblings(PvlKeyword outputSiblings, QDomElement &parent);
104  void addAttributes(PvlKeyword something, QDomElement &parent);
105 
106  private:
108  };
109 };
110 
111 #endif
virtual ~PvlToXmlTranslationManager()
Destroys the TranslationManager object.
virtual QString Translate(QString translationGroupName, int inputIndex=0)
Returns a translated value.
Contains more than one keyword-value pair.
Definition: PvlContainer.h:63
static void addElement(QDomElement &parent, QString name, QString value, QString units="")
Add a QDomElement to the given parent with the indicated value and units.
void addAttributes(PvlKeyword something, QDomElement &parent)
Take in the outputAttributes PvlKeyword and add each attribute to the appropriate element given as an...
PvlToXmlTranslationManager(const QString &transFile)
Constructs and initializes a TranslationManager object from given the Pvl translation file...
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&#39;s value, and units, if units != "".
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 PvlContainer * GetContainer(const PvlKeyword &inputGroup) const
Return a container from the input label with the path given by the "InputPosition" keyword of the tra...
virtual std::vector< std::pair< QString, int > > validKeywords() const
Returns a vector of valid keyword names and their sizes.
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
A single keyword-value pair.
Definition: PvlKeyword.h:98
static void setElementValue(QDomElement &element, QString value, QString units="")
Set the QDomElement&#39;s value, and units, if units != "".
void SetLabel(Pvl &inputLabel)
Internalizes a Pvl formatted label for translation.
Container for cube-like labels.
Definition: Pvl.h:135
virtual bool InputHasKeyword(const QString translationGroupName)
Indicates if the input keyword corresponding to the output name exists in the label.
Allows applications to translate simple text files.
void addSiblings(PvlKeyword outputSiblings, QDomElement &parent)
Take in outputSiblings PvlKeyword and turn each sibling into its corresponding QDomElement.
Pvl m_inputLabel
A Pvl object for the input label file.
void Auto(QDomDocument &outputLabel)
Automatically translate all the output names found in the translation table.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Allows applications to translate simple text files.
virtual const PvlKeyword & InputKeyword(const QString translationGroupName) const
Uses the translation file group name to find the input label&#39;s PvlKeyword that corresponds to the Inp...