7#include "PvlTranslationTable.h"
11#include "LabelTranslationManager.h"
14#include "PvlContainer.h"
16#include "PvlKeyword.h"
109 for(
int c = 0; c < np.size(); c += 2) {
111 if(np[c].toUpper() ==
"OBJECT") {
113 if(!obj->hasObject(np[c+1])) {
116 obj = &(obj->findObject(np[c+1]));
119 else if(np[c].toUpper() ==
"GROUP") {
121 if(!obj->hasGroup(np[c+1])) {
122 obj->addGroup(np[c+1]);
145 PvlKeyword outputKeyword( outputName, Translate(outputName) );
146 return outputKeyword;
177 QStringList typeSplit = specification.split(
"@", Qt::SkipEmptyParts);
178 QStringList barSplit = specification.split(
"|", Qt::SkipEmptyParts);
180 if (typeSplit.size() == 2) {
181 if (typeSplit[0].toLower() !=
"att" &&
182 typeSplit[0].toLower() !=
"tag" &&
183 typeSplit[0].toLower() !=
"new") {
184 QString msg =
"Dependency type specification [" + typeSplit[0] +
185 "] is invalid. Valid types are [att], [tag] and [new]";
188 parsedSpecification.append(typeSplit[0].toLower());
190 QStringList nameValueSplit = typeSplit[1].split(
"|", Qt::SkipEmptyParts);
191 if (nameValueSplit.size() == 2) {
192 parsedSpecification.append(nameValueSplit);
194 else if (nameValueSplit.size() == 1) {
195 parsedSpecification.append(nameValueSplit);
198 QString msg =
"Malformed dependency specification [" + specification +
"].";
202 else if (barSplit.size() == 2) {
203 parsedSpecification = barSplit;
205 else if (barSplit.size() == 1 && typeSplit.size() == 1) {
206 parsedSpecification = barSplit;
209 QString msg =
" [" + specification +
"] has unexpected number of '@' or '|' delimiters";
215 QString msg =
"Malformed dependency specification [" + specification +
"].";
219 return parsedSpecification;
@ Programmer
This error is for when a programmer made an API call that was illegal.
virtual PvlKeyword DoTranslation(const QString translationGroupName)
Translate the requested output name to output values using the input name and values or default value...
virtual void Auto(Pvl &outputLabel)
Automatically translate all the output names tagged as Auto in the translation table If a output name...
LabelTranslationManager()
Constructs a default LabelTranslationManager.
virtual QStringList parseSpecification(QString specification) const
Parses and validates a dependency specification.
virtual PvlContainer * CreateContainer(const QString translationGroupName, Pvl &pvl)
Creates all parent PVL containers for an output keyword.
virtual ~LabelTranslationManager()
Destroys the LabelTranslationManager object.
Contains more than one keyword-value pair.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
Contains Pvl Groups and Pvl Objects.
PvlGroup & group(const int index)
Return the group at the specified index.
int groups() const
Returns the number of groups contained.
void addObject(const PvlObject &object)
Add a PvlObject.
Internalizes a translation table.
bool IsOptional(const QString translationGroupName)
Determines whether the translation group is optional.
PvlKeyword OutputPosition(const QString translationGroupName)
Retrieves the OutputPosition PvlKeyword for the translation group with the given name.
void AddTable(std::istream &transStm)
Adds the contents of a translation table to the searchable groups/keys Also performs a verification,...
bool IsAuto(const QString translationGroupName)
Determines whether the given group should be automatically translated.
Pvl & TranslationTable()
Protected accessor for pvl translation table passed into class.
This is free and unencumbered software released into the public domain.
Namespace for the standard library.