Isis Developer Reference
XmlToPvlTranslationManager.h
Go to the documentation of this file.
1 #ifndef XmlToPvlTranslationManager_h
2 #define XmlToPvlTranslationManager_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
10 
11 #include <fstream>
12 #include <string>
13 
14 #include <QDomDocument>
15 
16 #include "FileName.h"
17 #include "PvlTokenizer.h"
18 
19 namespace Isis {
20  class Pvl;
21  class PvlContainer;
22  class PvlKeyword;
116  public:
117  XmlToPvlTranslationManager(const QString &transFile);
118 
119  XmlToPvlTranslationManager(std::istream &transStrm);
120 
122  const QString &transFile);
123 
125  std::istream &transStrm);
126 
127  virtual ~XmlToPvlTranslationManager();
128 
129  // Attempt to translate the requested output name to output value
130  // using the input name and value/default value
131  virtual QString Translate(QString translationGroupName, int findex = 0);
132 
133  // Translate all translation table groups which contain "Auto"
135  void Auto(FileName &inputLabel, Pvl &outputLabel);
136 
137  void SetLabel(FileName &inputLabel);
138 
139  protected:
140  virtual std::vector< std::pair<QString, int> > validKeywords() const;
141  bool checkDependencies(QDomElement element, PvlKeyword dependencies, bool isDebug) const;
142  void parseFile(const FileName &xmlFileName);
143 
144  private:
145  QDomDocument m_xmlLabel;
146 
147  };
148 };
149 
150 #endif
Isis::LabelTranslationManager::parseSpecification
virtual QStringList parseSpecification(QString specification) const
Parses and validates a dependency specification.
Definition: LabelTranslationManager.cpp:172
Isis::PvlKeyword::name
QString name() const
Returns the keyword name.
Definition: PvlKeyword.h:98
FileName.h
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::PvlTranslationTable::validKeywords
virtual std::vector< std::pair< QString, int > > validKeywords() const
Returns a vector of valid keyword names and their sizes.
Definition: PvlTranslationTable.cpp:179
Isis::XmlToPvlTranslationManager::Auto
virtual void Auto(Pvl &outputLabel)
Automatically translate all the output names tagged as Auto in the translation table If a output name...
Definition: LabelTranslationManager.cpp:70
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::PvlContainer::ConstPvlKeywordIterator
QList< PvlKeyword >::const_iterator ConstPvlKeywordIterator
The const keyword iterator.
Definition: PvlContainer.h:160
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
PvlGroup.h
Isis::PvlTranslationTable::AddTable
void AddTable(std::istream &transStm)
Adds the contents of a translation table to the searchable groups/keys Also performs a verification,...
Definition: PvlTranslationTable.cpp:102
PvlTokenizer.h
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::PvlTranslationTable::hasInputDefault
bool hasInputDefault(const QString translationGroupName)
Determines whether the given group has a default input value.
Definition: PvlTranslationTable.cpp:407
XmlToPvlTranslationManager.h
Isis::XmlToPvlTranslationManager
Allows applications to translate Xml label files.
Definition: XmlToPvlTranslationManager.h:115
Isis::XmlToPvlTranslationManager::SetLabel
void SetLabel(FileName &inputLabel)
Reads an Xml label file and internalizes it for translation.
Definition: XmlToPvlTranslationManager.cpp:107
QStringList
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
IString.h
Isis::XmlToPvlTranslationManager::Translate
virtual QString Translate(QString translationGroupName, int findex=0)
Returns a translated value.
Definition: XmlToPvlTranslationManager.cpp:163
Isis::XmlToPvlTranslationManager::checkDependencies
bool checkDependencies(QDomElement element, PvlKeyword dependencies, bool isDebug) const
Checks if a element in the xml label satisfies a list of dependencies.
Definition: XmlToPvlTranslationManager.cpp:372
Isis::XmlToPvlTranslationManager::XmlToPvlTranslationManager
XmlToPvlTranslationManager(const QString &transFile)
Constructs and initializes an XmlToPvlTranslationManager object from the given Pvl translation file.
Definition: XmlToPvlTranslationManager.cpp:39
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::XmlToPvlTranslationManager::~XmlToPvlTranslationManager
virtual ~XmlToPvlTranslationManager()
Destroys the XmlToPvlTranslationManager object.
Definition: XmlToPvlTranslationManager.cpp:98
Isis::XmlToPvlTranslationManager::parseFile
void parseFile(const FileName &xmlFileName)
Opens, parses, and internalizes an Xml label file.
Definition: XmlToPvlTranslationManager.cpp:464
Isis::LabelTranslationManager
Allows applications to translate simple text files.
Definition: LabelTranslationManager.h:43
Isis::LabelTranslationManager::Auto
virtual void Auto(Pvl &outputLabel)
Automatically translate all the output names tagged as Auto in the translation table If a output name...
Definition: LabelTranslationManager.cpp:70
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::PvlTranslationTable::Translate
QString Translate(const QString translationGroupName, const QString inputKeyValue="") const
Translates a single output value from the given translation group name and input value.
Definition: PvlTranslationTable.cpp:216
Isis::XmlToPvlTranslationManager::validKeywords
virtual std::vector< std::pair< QString, int > > validKeywords() const
Returns a vector of valid keyword names and their sizes.
Definition: XmlToPvlTranslationManager.cpp:118
PvlContainer.h
IException.h
std
Namespace for the standard library.
PvlKeyword.h
Isis::PvlKeyword::size
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:125
LabelTranslationManager.h
PvlObject.h
Isis::PvlTranslationTable::InputDefault
QString InputDefault(const QString translationGroupName) const
Returns the input default value from the translation table corresponding to the output name argument.
Definition: PvlTranslationTable.cpp:382
Isis::PvlContainer::findKeyword
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Definition: PvlContainer.cpp:62
Isis::PvlContainer::end
PvlKeywordIterator end()
Return the ending iterator.
Definition: PvlContainer.h:194
Isis::PvlContainer::begin
PvlKeywordIterator begin()
Return the beginning iterator.
Definition: PvlContainer.h:178
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Message.h
Isis::PvlTranslationTable::TranslationTable
Pvl & TranslationTable()
Protected accessor for pvl translation table passed into class.
Definition: PvlTranslationTable.cpp:62