Isis Developer Reference
LabelTranslationManager.h
Go to the documentation of this file.
1 #ifndef LabelTranslationManager_h
2 #define LabelTranslationManager_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 #include <string>
10 #include <fstream>
11 
12 #include "FileName.h"
13 #include "PvlTokenizer.h"
14 #include "PvlTranslationTable.h"
15 
16 namespace Isis {
17  class Pvl;
18  class PvlContainer;
19  class PvlKeyword;
44  public:
46 
47  LabelTranslationManager(const QString &transFile);
48 
49  LabelTranslationManager(std::istream &transStrm);
50 
51  virtual ~LabelTranslationManager();
52 
53  // Attempt to translate the requested output name to output value
54  // using the input name and value/default value
55  virtual QString Translate(QString translationGroupName, int findex = 0) = 0;
56 
57  // Translate all translation table groups which contain "Auto"
58  virtual void Auto(Pvl &outputLabel);
59 
60  virtual QStringList parseSpecification(QString specification) const;
61  protected:
62 
63  virtual PvlKeyword DoTranslation(const QString translationGroupName);
64  virtual PvlContainer *CreateContainer(const QString translationGroupName, Pvl &pvl);
65  };
66 };
67 
68 #endif
Isis::LabelTranslationManager::Translate
virtual QString Translate(QString translationGroupName, int findex=0)=0
Isis::LabelTranslationManager::parseSpecification
virtual QStringList parseSpecification(QString specification) const
Parses and validates a dependency specification.
Definition: LabelTranslationManager.cpp:172
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
PvlGroup.h
Isis::LabelTranslationManager::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: LabelTranslationManager.cpp:144
Isis::PvlObject::groups
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:75
Isis::PvlTranslationTable
Internalizes a translation table.
Definition: PvlTranslationTable.h:106
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
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::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::PvlObject::addObject
void addObject(const PvlObject &object)
Add a PvlObject.
Definition: PvlObject.h:307
QStringList
IString.h
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::LabelTranslationManager::LabelTranslationManager
LabelTranslationManager()
Constructs a default LabelTranslationManager.
Definition: LabelTranslationManager.cpp:25
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::PvlTranslationTable::OutputPosition
PvlKeyword OutputPosition(const QString translationGroupName)
Retrieves the OutputPosition PvlKeyword for the translation group with the given name.
Definition: PvlTranslationTable.cpp:483
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::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::PvlContainer::name
QString name() const
Returns the container name.
Definition: PvlContainer.h:63
Isis::IException
Isis exception class.
Definition: IException.h:91
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::PvlObject::addGroup
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
PvlContainer.h
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.
PvlTranslationTable.h
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::PvlContainer
Contains more than one keyword-value pair.
Definition: PvlContainer.h:49
Isis::LabelTranslationManager::~LabelTranslationManager
virtual ~LabelTranslationManager()
Destroys the LabelTranslationManager object.
Definition: LabelTranslationManager.cpp:56
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