31 PvlTranslationManager::PvlTranslationManager(
const QString &transFile) {
43 PvlTranslationManager::PvlTranslationManager(
Isis::Pvl &inputLabel,
44 const QString &transFile) {
45 p_fLabel = inputLabel;
59 PvlTranslationManager::PvlTranslationManager(
Isis::Pvl &inputLabel,
60 std::istream &transStrm) {
61 p_fLabel = inputLabel;
82 QString PvlTranslationManager::Translate(QString nName,
int findex) {
87 while((grp = InputGroup(nName, inst++)).name() !=
"") {
88 if((con = GetContainer(grp)) != NULL) {
90 return PvlTranslationTable::Translate(nName,
91 (*con)[InputKeywordName(nName)][findex]);
109 const QString nName) {
116 while((grp = InputGroup(nName, inst++)).name() !=
"") {
117 if((con = GetContainer(grp)) != NULL) {
118 if(con->
hasKeyword(InputKeywordName(nName))) {
119 key.
setName(OutputName(nName));
121 for(
int v = 0; v < (*con)[(InputKeywordName(nName))].size(); v++) {
123 (*con)[InputKeywordName(nName)][v]),
124 (*con)[InputKeywordName(nName)].unit(v));
133 PvlTranslationTable::Translate(nName,
""));
142 void PvlTranslationManager::Auto(
Isis::Pvl &outputLabel) {
144 for(
int i = 0; i < TranslationTable().groups(); i++) {
146 if(IsAuto(g.
name())) {
149 (*con) += PvlTranslationManager::DoTranslation(g.
name());
151 catch(IException &e) {
152 if(!IsOptional(g.
name())) {
170 const QString nName)
const {
172 int instanceNumber = 0;
173 PvlKeyword inputGroupKeyword = InputGroup(nName, instanceNumber);
174 bool anInputGroupFound =
false;
176 while(inputGroupKeyword.
name() !=
"") {
177 const PvlContainer *containingGroup = GetContainer(inputGroupKeyword);
178 if(containingGroup != NULL) {
179 anInputGroupFound =
true;
181 if(containingGroup->
hasKeyword(InputKeywordName(nName))) {
182 return containingGroup->
findKeyword(InputKeywordName(nName));
187 inputGroupKeyword = InputGroup(nName, instanceNumber);
190 if(anInputGroupFound) {
191 QString msg =
"Unable to find input keyword [" + InputKeywordName(nName) +
192 "] for output name [" + nName +
"] in file [" + TranslationTable().fileName() +
"]";
196 QString container =
"";
198 for(
int i = 0; i < InputGroup(nName).size(); i++) {
199 if(i > 0) container +=
",";
201 container += InputGroup(nName)[i];
204 QString msg =
"Unable to find input group [" + container +
205 "] for output name [" + nName +
"] in file [" + TranslationTable().fileName() +
"]";
217 bool PvlTranslationManager::InputHasKeyword(
const QString nName) {
227 while((grp = InputGroup(nName, inst++)).name() !=
"") {
228 if((con = GetContainer(grp)) != NULL) {
229 if(con->
hasKeyword(InputKeywordName(nName)))
return true;
258 if(inputGroup.
size() == 1 &&
259 PvlKeyword::stringEqual(inputGroup[0],
"ROOT")) {
268 objectIndex < inputGroup.
size() - 1;
270 if(currentObject->
hasObject(inputGroup[objectIndex])) {
271 currentObject = ¤tObject->
findObject(inputGroup[objectIndex]);
279 if(currentObject->
hasObject(inputGroup[objectIndex])) {
280 return ¤tObject->
findObject(inputGroup[objectIndex]);
282 else if(currentObject->
hasGroup(inputGroup[objectIndex])) {
283 return ¤tObject->
findGroup(inputGroup[objectIndex]);
303 for(
int c = 0; c < np.
size(); c += 2) {
305 if(np[c].toUpper() ==
"OBJECT") {
313 else if(np[c].toUpper() ==
"GROUP") {
int size() const
Returns the number of values stored in this keyword.
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Contains more than one keyword-value pair.
QString Translate(const QString nName, const QString fValue="") const
Translates the output name and input value.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
void setName(QString name)
Sets the keyword name.
void addObject(const PvlObject &object)
Add a PvlObject.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
QString name() const
Returns the keyword name.
A single keyword-value pair.
Container for cube-like labels.
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not...
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Contains Pvl Groups and Pvl Objects.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
QString name() const
Returns the container name.
void addValue(QString value, QString unit="")
Adds a value with units.