Isis Developer Reference
PvlToPvlTranslationManager.h
Go to the documentation of this file.
1 #ifndef PvlToPvlTranslationManager_h
2 #define PvlToPvlTranslationManager_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
10 
11 #include <fstream>
12 #include <string>
13 
14 #include "FileName.h"
15 #include "PvlTokenizer.h"
16 
17 namespace Isis {
18  class Pvl;
19  class PvlContainer;
20  class PvlKeyword;
66  public:
67  PvlToPvlTranslationManager(const QString &transFile);
68 
69  PvlToPvlTranslationManager(std::istream &transStrm);
70 
71  PvlToPvlTranslationManager(Pvl &inputLabel,
72  const QString &transFile);
73 
74  PvlToPvlTranslationManager(Pvl &inputLabel,
75  std::istream &transStrm);
76 
78 
79  // Attempt to translate the requested output name to output value
80  // using the input name and value/default value
81  virtual QString Translate(QString translationGroupName, int findex = 0);
82 
83  // Translate all translation table groups which contain "Auto"
84  void Auto(Pvl &outputLabel);
85  void Auto(Pvl &inputLabel, Pvl &outputLabel);
86 
87  // Return the ith input value associated with a output name
88  virtual const PvlKeyword &InputKeyword(const QString translationGroupName) const;
89 
90  // Return true if the input lable contains the translated group and key names
91  virtual bool InputHasKeyword(const QString translationGroupName);
92 
93  void SetLabel(Pvl &inputLabel);
94 
95  protected:
96  virtual PvlKeyword DoTranslation(const QString translationGroupName);
97  virtual const PvlContainer *GetContainer(const PvlKeyword &inputGroup) const;
98  virtual PvlContainer *CreateContainer(const QString translationGroupName, Pvl &pvl);
99  private:
100  Pvl p_fLabel;
101  };
102 };
103 
104 #endif
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::PvlObject::group
PvlGroup & group(const int index)
Return the group at the specified index.
Definition: PvlObject.cpp:452
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
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::PvlKeyword::addValue
void addValue(QString value, QString unit="")
Adds a value with units.
Definition: PvlKeyword.cpp:252
PvlGroup.h
Isis::PvlObject::groups
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:75
Isis::PvlTranslationTable::OutputName
QString OutputName(const QString translationGroupName)
Retrieves a string containing the value of the OutputName keyword for the translation group with the ...
Definition: PvlTranslationTable.cpp:511
Isis::PvlToPvlTranslationManager::Translate
virtual QString Translate(QString translationGroupName, int findex=0)
Returns a translated value.
Definition: PvlToPvlTranslationManager.cpp:107
Isis::PvlObject::hasGroup
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition: PvlObject.h:210
PvlTokenizer.h
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::PvlToPvlTranslationManager::DoTranslation
virtual PvlKeyword DoTranslation(const QString translationGroupName)
Translate the requested output name to output values using the input name and values or default value...
Definition: PvlToPvlTranslationManager.cpp:142
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::PvlToPvlTranslationManager::CreateContainer
virtual PvlContainer * CreateContainer(const QString translationGroupName, Pvl &pvl)
Create the requsted container and any containers above it and return a reference to the container.
Definition: PvlToPvlTranslationManager.cpp:352
IString.h
Isis::PvlKeyword::setName
void setName(QString name)
Sets the keyword name.
Definition: PvlKeyword.cpp:120
Isis::PvlToPvlTranslationManager
Allows applications to translate simple text files.
Definition: PvlToPvlTranslationManager.h:65
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::PvlToPvlTranslationManager::PvlToPvlTranslationManager
PvlToPvlTranslationManager(const QString &transFile)
Constructs and initializes a TranslationManager object from given the Pvl translation file.
Definition: PvlToPvlTranslationManager.cpp:31
Isis::PvlToPvlTranslationManager::InputKeyword
virtual const PvlKeyword & InputKeyword(const QString translationGroupName) const
Returns the ith input value associated with the output name argument.
Definition: PvlToPvlTranslationManager.cpp:231
Isis::LabelTranslationManager::CreateContainer
virtual PvlContainer * CreateContainer(const QString translationGroupName, Pvl &pvl)
Creates all parent PVL containers for an output keyword.
Definition: LabelTranslationManager.cpp:100
Isis::PvlToPvlTranslationManager::~PvlToPvlTranslationManager
virtual ~PvlToPvlTranslationManager()
Destroys the TranslationManager object.
Definition: PvlToPvlTranslationManager.cpp:80
Isis::LabelTranslationManager
Allows applications to translate simple text files.
Definition: LabelTranslationManager.h:43
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::PvlContainer::fileName
QString fileName() const
Returns the filename used to initialise the Pvl object.
Definition: PvlContainer.h:232
Isis::PvlContainer::name
QString name() const
Returns the container name.
Definition: PvlContainer.h:63
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::PvlObject::hasObject
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not.
Definition: PvlObject.h:323
Isis::PvlTranslationTable::InputKeywordName
virtual QString InputKeywordName(const QString translationGroupName) const
Returns the input keyword name from the translation table corresponding to the output name argument.
Definition: PvlTranslationTable.cpp:360
PvlContainer.h
Isis::PvlTranslationTable::InputGroup
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.
Definition: PvlTranslationTable.cpp:285
Isis::PvlTranslationTable::IsAuto
bool IsAuto(const QString translationGroupName)
Determines whether the given group should be automatically translated.
Definition: PvlTranslationTable.cpp:432
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
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::IsOptional
bool IsOptional(const QString translationGroupName)
Determines whether the translation group is optional.
Definition: PvlTranslationTable.cpp:457
Isis::PvlToPvlTranslationManager::GetContainer
virtual const PvlContainer * GetContainer(const PvlKeyword &inputGroup) const
Return a container from the input label according tund.
Definition: PvlToPvlTranslationManager.cpp:303
Isis::PvlToPvlTranslationManager::InputHasKeyword
virtual bool InputHasKeyword(const QString translationGroupName)
Indicates if the input keyword corresponding to the output name exists in the label.
Definition: PvlToPvlTranslationManager.cpp:282
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
Contains more than one keyword-value pair.
Definition: PvlContainer.h:49
Isis::PvlToPvlTranslationManager::SetLabel
void SetLabel(Pvl &inputLabel)
Definition: PvlToPvlTranslationManager.cpp:84
Isis::PvlKeyword::stringEqual
static bool stringEqual(const QString &string1, const QString &string2)
Checks to see if two QStrings are equal.
Definition: PvlKeyword.cpp:535
PvlToPvlTranslationManager.h
Isis::PvlToPvlTranslationManager::Auto
void Auto(Pvl &outputLabel)
Automatically translate all the output names found in the translation table If a output name does not...
Definition: PvlToPvlTranslationManager.cpp:199
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