File failed to load: https://isis.astrogeology.usgs.gov/6.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
PvlObject.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "PvlObject.h"
8 
9 #include "FileName.h"
10 #include "Pvl.h"
11 #include "IException.h"
12 #include "IString.h"
13 #include "Message.h"
14 #include "PvlFormat.h"
15 
16 #include <QList>
17 
18 #include <iostream>
19 #include <sstream>
20 
21 using namespace std;
22 using json = nlohmann::json;
23 namespace Isis {
24 
26  PvlObject::PvlObject() : Isis::PvlContainer("Object") {
27  }
28 
29 
35  PvlObject::PvlObject(const QString &name) :
36  Isis::PvlContainer("Object", name) {
37  }
38 
39 
42  PvlContainer::PvlContainer(other) {
43  m_objects = other.m_objects;
44  m_groups = other.m_groups;
45  }
46 
47 
48 
60  PvlObject::PvlObject(const QString &name, const json &jsonobj) :
61  PvlContainer("Object", name) {
62 
63  for(auto it = jsonobj.begin(); it != jsonobj.end(); it++) {
64  PvlKeyword keyword;
65  if (it.value().is_array()) {
66  keyword.setName(QString::fromStdString(it.key()));
67  for(auto ar = it.value().begin(); ar!=it.value().end();ar++) {
68  keyword += QString::number(ar->get<double>());
69  }
70  }
71  else if(it.value().is_number()) {
72  keyword.setName(QString::fromStdString(it.key()));
73  keyword.setValue(QString::number(it->get<double>()));
74  }
75  else if(it.value().is_boolean()) {
76  keyword.setName(QString::fromStdString(it.key()));
77  keyword.setValue(QString(it->get<bool>() ? "true" : "false"));
78  }
79  else if(it.value().is_null()) {
80  keyword.setName(QString::fromStdString(it.key()));
81  keyword.setValue(QString("Null"));
82  }
83  else {
84  keyword.setName(QString::fromStdString(it.key()));
85  keyword.setValue(QString::fromStdString(it.value()));
86  }
87  addKeyword(keyword);
88  }
89  }
90 
101  Isis::PvlGroup &PvlObject::findGroup(const QString &name,
102  PvlObject::FindOptions opts) {
103  vector<PvlObject *> searchList;
104  searchList.push_back(this);
105 
106  while(searchList.size() > 0) {
107  PvlGroupIterator it =
108  searchList[0]->findGroup(name,
109  searchList[0]->beginGroup(),
110  searchList[0]->endGroup());
111  if(it != searchList[0]->endGroup()) return *it;
112  if(opts == Traverse) {
113  for(int i = 0; i < searchList[0]->objects(); i++) {
114  searchList.push_back(&searchList[0]->object(i));
115  }
116  }
117  searchList.erase(searchList.begin());
118  }
119 
120  QString msg = "Unable to find PVL group [" + name + "]";
121  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
122  throw IException(IException::Unknown, msg, _FILEINFO_);
123  }
124 
125 
136  const Isis::PvlGroup &PvlObject::findGroup(const QString &name,
137  PvlObject::FindOptions opts) const {
138  vector<const PvlObject *> searchList;
139  searchList.push_back(this);
140 
141  while(searchList.size() > 0) {
142  ConstPvlGroupIterator it =
143  searchList[0]->findGroup(name,
144  searchList[0]->beginGroup(),
145  searchList[0]->endGroup());
146  if(it != searchList[0]->endGroup()) return *it;
147  if(opts == Traverse) {
148  for(int i = 0; i < searchList[0]->objects(); i++) {
149  searchList.push_back(&searchList[0]->object(i));
150  }
151  }
152  searchList.erase(searchList.begin());
153  }
154 
155  QString msg = "Unable to find PVL group [" + name + "]";
156  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
157  throw IException(IException::Unknown, msg, _FILEINFO_);
158  }
159 
160 
177  PvlKeyword &PvlObject::findKeyword(const QString &kname,
178  FindOptions opts) {
179 
180  // Call the parent's version if they don't want to dig deeper
181  if(opts == None) return findKeyword(kname);
182 
183  // Search this PvlObject, and all PvlObjects and PvlContainers within
184  // it for the first occurrence of the requested keyword.
185  vector<PvlObject *> searchList;
186  searchList.push_back(this);
187 
188  while(searchList.size() > 0) {
189  PvlKeywordIterator it =
190  searchList[0]->findKeyword(kname, searchList[0]->begin(),
191  searchList[0]->end());
192  if(it != searchList[0]->end()) {
193  return *it;
194  }
195 
196  // See if the keyword is inside a Group of this Object
197  for(int g = 0; g < searchList[0]->groups(); g++) {
198  PvlKeywordIterator it =
199  searchList[0]->group(g).findKeyword(kname,
200  searchList[0]->group(g).begin(),
201  searchList[0]->group(g).end());
202  if(it != searchList[0]->group(g).end()) {
203  return *it;
204  }
205  }
206 
207  // It's not in this Object or any groups in this Object, so
208  // add all Objects inside this Object to the search list
209  for(int i = 0; i < searchList[0]->objects(); i++) {
210  searchList.push_back(&searchList[0]->object(i));
211  }
212 
213  // This Object has been searched to remove it from the list
214  searchList.erase(searchList.begin());
215  }
216 
217  // No where else to look for the Keyword so throw an error
218  QString msg = "Unable to find PVL keyword [" + kname + "]";
219  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
220  throw IException(IException::Unknown, msg, _FILEINFO_);
221  }
222 
223 
236  bool PvlObject::hasKeyword(const QString &kname,
237  FindOptions opts) const {
238 
239  // Call the parent's version if they don't want to dig deeper
240  if(opts == None) return hasKeyword(kname);
241 
242  // Search this PvlObject, and all PvlObjects and PvlContainers within
243  // it for the first occurrence of the requested keyword.
244  vector<const PvlObject *> searchList;
245  searchList.push_back(this);
246 
247  while(searchList.size() > 0) {
249  searchList[0]->findKeyword(kname, searchList[0]->begin(),
250  searchList[0]->end());
251  if(it != searchList[0]->end()) {
252  return true;
253  }
254 
255  // See if the keyword is inside a Group of this Object
256  for(int g = 0; g < searchList[0]->groups(); g++) {
258  searchList[0]->group(g).findKeyword(kname,
259  searchList[0]->group(g).begin(),
260  searchList[0]->group(g).end());
261 
262  if(it != searchList[0]->group(g).end()) {
263  return true;
264  }
265  }
266 
267  // It's not in this Object or any groups in this Object, so
268  // add all Objects inside this Object to the search list
269  for(int i = 0; i < searchList[0]->objects(); i++) {
270  searchList.push_back(&searchList[0]->object(i));
271  }
272 
273  // This Object has been searched to remove it from the list
274  searchList.erase(searchList.begin());
275  }
276  return false;
277  }
278 
279 
290  PvlObject &PvlObject::findObject(const QString &name,
291  PvlObject::FindOptions opts) {
292  vector<PvlObject *> searchList;
293  searchList.push_back(this);
294 
295  while(searchList.size() > 0) {
296  PvlObjectIterator it =
297  searchList[0]->findObject(name,
298  searchList[0]->beginObject(),
299  searchList[0]->endObject());
300  if(it != searchList[0]->endObject()) return *it;
301  if(opts == Traverse) {
302  for(int i = 0; i < searchList[0]->objects(); i++) {
303  searchList.push_back(&searchList[0]->object(i));
304  }
305  }
306  searchList.erase(searchList.begin());
307  }
308 
309  QString msg = "Unable to find PVL object [" + name + "]";
310  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
311  throw IException(IException::Unknown, msg, _FILEINFO_);
312  }
313 
314 
325  const PvlObject &PvlObject::findObject(const QString &name,
326  FindOptions opts) const {
327  vector<const PvlObject *> searchList;
328  searchList.push_back(this);
329 
330  while(searchList.size() > 0) {
331  ConstPvlObjectIterator it =
332  searchList[0]->findObject(name,
333  searchList[0]->beginObject(),
334  searchList[0]->endObject());
335 
336  if(it != searchList[0]->endObject()) {
337  return *it;
338  }
339 
340  if(opts == Traverse) {
341  for(int i = 0; i < searchList[0]->objects(); i++) {
342  searchList.push_back(&searchList[0]->object(i));
343  }
344  }
345 
346  searchList.erase(searchList.begin());
347  }
348 
349  QString msg = "Unable to find PVL object [" + name + "]";
350 
351  if(m_filename.size() > 0) {
352  msg += " in file [" + m_filename + "]";
353  }
354 
355  throw IException(IException::Unknown, msg, _FILEINFO_);
356  }
357 
358 
366  void PvlObject::deleteObject(const QString &name) {
368  if(key == endObject()) {
369  QString msg = "Unable to find PVL object [" + name + "] in " + type() +
370  " [" + this->name() + "]";
371  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
372  throw IException(IException::Unknown, msg, _FILEINFO_);
373  }
374 
375  m_objects.erase(key);
376  }
377 
378 
386  void PvlObject::deleteObject(const int index) {
387  if(index >= (int)m_objects.size() || index < 0) {
388  QString msg = "The specified index is out of bounds in PVL " + type() +
389  " [" + name() + "]";
390  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
391  throw IException(IException::Unknown, msg, _FILEINFO_);
392  }
393 
395  for(int i = 0; i < index; i++) key++;
396 
397  m_objects.erase(key);
398  }
399 
400 
408  void PvlObject::deleteGroup(const QString &name) {
410  if(key == endGroup()) {
411  QString msg = "Unable to find PVL group [" + name + "] in " + type() +
412  " [" + this->name() + "]";
413  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
414  throw IException(IException::Unknown, msg, _FILEINFO_);
415  }
416 
417  m_groups.erase(key);
418  }
419 
420 
428  void PvlObject::deleteGroup(const int index) {
429  if(index >= (int)m_groups.size() || index < 0) {
430  QString msg = "The specified index is out of bounds in PVL " + type() +
431  " [" + name() + "]";
432  if(m_filename.size() > 0) msg += " in file [" + m_filename + "]";
433  throw IException(IException::Unknown, msg, _FILEINFO_);
434  }
435 
437  for(int i = 0; i < index; i++) key++;
438 
439  m_groups.erase(key);
440  }
441 
442 
452  Isis::PvlGroup &PvlObject::group(const int index) {
453  if(index < 0 || index >= (int)m_groups.size()) {
454  QString msg = Message::ArraySubscriptNotInRange(index);
455  throw IException(IException::Programmer, msg, _FILEINFO_);
456  }
457 
458  return m_groups[index];
459  }
460 
461 
471  const Isis::PvlGroup &PvlObject::group(const int index) const {
472  if(index < 0 || index >= (int)m_groups.size()) {
473  QString msg = Message::ArraySubscriptNotInRange(index);
474  throw IException(IException::Programmer, msg, _FILEINFO_);
475  }
476 
477  return m_groups[index];
478  }
479 
489  PvlObject &PvlObject::object(const int index) {
490  if(index < 0 || index >= (int)m_objects.size()) {
491  QString msg = Message::ArraySubscriptNotInRange(index);
492  throw IException(Isis::IException::Programmer, msg, _FILEINFO_);
493  }
494 
495  return m_objects[index];
496  }
497 
507  const PvlObject &PvlObject::object(const int index) const {
508  if(index < 0 || index >= (int)m_objects.size()) {
509  QString msg = Message::ArraySubscriptNotInRange(index);
510  throw IException(IException::Programmer, msg, _FILEINFO_);
511  }
512 
513  return m_objects[index];
514  }
515 
516 
523  ostream &operator<<(std::ostream &os, PvlObject &object) {
524 
525  // Set up a Formatter
526  bool removeFormatter = false;
527  if(object.format() == NULL) {
528  object.setFormat(new PvlFormat());
529  removeFormatter = true;
530  }
531 
532  Isis::PvlObject outTemplate("DEFAULT");
533  if(object.hasFormatTemplate())
534  outTemplate = *(Isis::PvlObject *)object.formatTemplate();
535 
536  // Look for and process all include files and remove duplicates
537  Isis::PvlObject newTemp(outTemplate.name());
538 
539  // Make sure the new template has all the original's comments
540  for(int i = 0; i < outTemplate.comments(); i++) {
541  newTemp.addComment(outTemplate.comment(i));
542  }
543 
544  // Include files take precedence to all other objects and groups
545  for(int i = 0; i < outTemplate.keywords(); i++) {
546  if(outTemplate[i].isNamed("Isis:PvlTemplate:File")) {
547  QString filename = outTemplate[i];
548  Isis::FileName file(filename);
549  if(!file.fileExists()) {
550  QString message = "Could not open the following PVL template file: ";
551  message += filename;
552  throw IException(IException::Io, message, _FILEINFO_);
553  }
554 
555  Isis::Pvl include(file.expanded());
556 
557  for(int j = 0; j < include.keywords(); j++) {
558  if(!newTemp.hasKeyword(include[j].name()))
559  newTemp.addKeyword(include[j]);
560  }
561 
562  for(int j = 0; j < include.objects(); j++) {
563  if(!newTemp.hasObject(include.object(j).name()))
564  newTemp.addObject(include.object(j));
565  }
566 
567  for(int j = 0; j < include.groups(); j++) {
568  if(!newTemp.hasGroup(include.group(j).name()))
569  newTemp.addGroup(include.group(j));
570  }
571  }
572  // If it is not an include file keyword add it in place
573  else if(!newTemp.hasKeyword(outTemplate[i].name()))
574  newTemp.addKeyword(outTemplate[i]);
575  }
576 
577  // Copy over the objects
578  for(int i = 0; i < outTemplate.objects(); i++) {
579  if(!newTemp.hasObject(outTemplate.object(i).name()))
580  newTemp.addObject(outTemplate.object(i));
581  }
582 
583  // Copy over the groups
584  for(int i = 0; i < outTemplate.groups(); i++) {
585  if(!newTemp.hasGroup(outTemplate.group(i).name()))
586  newTemp.addGroup(outTemplate.group(i));
587  }
588 
589  outTemplate = newTemp;
590 
591  // Write out comments for this Object that were in the template
592  if(outTemplate.comments() > 0) {
593  for(int k = 0; k < outTemplate.comments(); k++) {
594  for(int l = 0; l < object.indent(); l++) os << " ";
595  os << outTemplate.comment(k) << object.format()->formatEOL();
596  }
597  //os << object.format()->FormatEOL();
598  }
599 
600  // Output the object comments and name
601  os << object.nameKeyword() << object.format()->formatEOL();
602  object.setIndent(object.indent() + 2);
603 
604  // Output the keywords in this Object
605  if(object.keywords() > 0) {
606  os << (Isis::PvlContainer &) object << object.format()->formatEOL();
607  }
608 
609  // This number keeps track of the number of objects have been written
610  int numObjects = 0;
611 
612  // Output the Objects within this Object using the format template
613  for(int i = 0; i < outTemplate.objects(); i++) {
614  for(int j = 0; j < object.objects(); j++) {
615  if(outTemplate.object(i).name() != object.object(j).name()) continue;
616  if(j == 0 && object.keywords() > 0)
617  os << object.format()->formatEOL();
618 
619  object.object(j).setIndent(object.indent());
620  object.object(j).setFormatTemplate(outTemplate.object(i));
621  object.object(j).setFormat(object.format());
622  os << object.object(j) << object.format()->formatEOL();
623  object.object(j).setFormat(NULL);
624  object.object(j).setIndent(0);
625 
626  if(++numObjects < object.objects())
627  os << object.format()->formatEOL();
628  }
629  }
630 
631  // Output the Objects within this Object that were not included in the
632  // format template pvl
633  for(int i = 0; i < object.objects(); i++) {
634  if(outTemplate.hasObject(object.object(i).name())) continue;
635  if(i == 0 && object.keywords() > 0)
636  os << object.format()->formatEOL();
637 
638  object.object(i).setIndent(object.indent());
639  object.object(i).setFormat(object.format());
640  os << object.object(i) << object.format()->formatEOL();
641  object.object(i).setFormat(NULL);
642  object.object(i).setIndent(0);
643 
644  if(++numObjects < object.objects())
645  os << object.format()->formatEOL();
646 
647  }
648 
649  // This number keeps track of the number of groups that have been written
650  int numgroups = 0;
651 
652  // Output the groups within this Object using the format template
653  for(int i = 0; i < outTemplate.groups(); i++) {
654  for(int j = 0; j < object.groups(); j++) {
655  if(outTemplate.group(i).name() != object.group(j).name()) continue;
656  if((numgroups == 0) &&
657  (object.objects() > 0 || object.keywords() > 0))
658  os << object.format()->formatEOL();
659 
660  object.group(j).setIndent(object.indent());
661  object.group(j).setFormatTemplate(outTemplate.group(i));
662  object.group(j).setFormat(object.format());
663  os << object.group(j) << object.format()->formatEOL();
664  object.group(j).setFormat(NULL);
665  object.group(j).setIndent(0);
666  if(++numgroups < object.groups()) os << object.format()->formatEOL();
667  }
668  }
669 
670  // Output the groups that were not in the format template
671  for(int i = 0; i < object.groups(); i++) {
672  if(outTemplate.hasGroup(object.group(i).name())) continue;
673  if((numgroups == 0) &&
674  (object.objects() > 0 || object.keywords() > 0))
675  os << object.format()->formatEOL();
676 
677  object.group(i).setIndent(object.indent());
678  object.group(i).setFormat(object.format());
679  os << object.group(i) << object.format()->formatEOL();
680  object.group(i).setFormat(NULL);
681  object.group(i).setIndent(0);
682 
683  if(++numgroups < object.groups())
684  os << object.format()->formatEOL();
685  }
686 
687  // Output the end of the object
688  object.setIndent(object.indent() - 2);
689  for(int i = 0; i < object.indent(); i++) os << " ";
690  os << object.format()->formatEnd("End_Object", object.nameKeyword());
691 
692  if(removeFormatter) {
693  delete object.format();
694  object.setFormat(NULL);
695  }
696 
697  return os;
698  }
699 
700 
705  std::istream &operator>>(std::istream &is, PvlObject &result) {
706  PvlKeyword termination("EndObject");
707 
708  PvlKeyword errorKeywords[] = {
709  PvlKeyword("EndGroup")
710  };
711 
712  PvlKeyword readKeyword;
713 
714  istream::pos_type beforeKeywordPos = is.tellg();
715  is >> readKeyword;
716 
717  if(readKeyword != PvlKeyword("Object")) {
718  if(is.eof() && !is.bad()) {
719  is.clear();
720  }
721 
722  is.seekg(beforeKeywordPos, ios::beg);
723 
724  QString msg = "Expected PVL keyword named [Object], found keyword named [";
725  msg += readKeyword.name();
726  msg += "]";
727  throw IException(IException::Programmer, msg, _FILEINFO_);
728  }
729 
730  if(readKeyword.size() == 1) {
731  result.setName(readKeyword[0]);
732  }
733  else {
734  is.seekg(beforeKeywordPos, ios::beg);
735 
736  QString msg = "Expected a single value for PVL object name, found [(";
737 
738  for(int i = 0; i < readKeyword.size(); i++) {
739  if(i != 0) msg += ", ";
740 
741  msg += readKeyword[i];
742  }
743 
744  msg += ")]";
745  throw IException(IException::Unknown, msg, _FILEINFO_);
746  }
747 
748  for(int comment = 0; comment < readKeyword.comments(); comment++) {
749  result.addComment(readKeyword.comment(comment));
750  }
751 
752  readKeyword = PvlKeyword();
753  beforeKeywordPos = is.tellg();
754 
755  is >> readKeyword;
756  while(readKeyword != termination) {
757  for(unsigned int errorKey = 0;
758  errorKey < sizeof(errorKeywords) / sizeof(PvlKeyword);
759  errorKey++) {
760  if(readKeyword == errorKeywords[errorKey]) {
761  if(is.eof() && !is.bad()) {
762  is.clear();
763  }
764 
765  is.seekg(beforeKeywordPos, ios::beg);
766 
767  QString msg = "Unexpected [";
768  msg += readKeyword.name();
769  msg += "] in PVL Object [";
770  msg += result.name();
771  msg += "]";
772  throw IException(IException::Unknown, msg, _FILEINFO_);
773  }
774  }
775 
776  if(readKeyword == PvlKeyword("Group")) {
777  is.seekg(beforeKeywordPos);
778  PvlGroup newGroup;
779  is >> newGroup;
780  result.addGroup(newGroup);
781  }
782  else if(readKeyword == PvlKeyword("Object")) {
783  is.seekg(beforeKeywordPos);
784  PvlObject newObject;
785  is >> newObject;
786  result.addObject(newObject);
787  }
788  else {
789  result.addKeyword(readKeyword);
790  }
791 
792  readKeyword = PvlKeyword();
793  beforeKeywordPos = is.tellg();
794 
795  if(is.good()) {
796  is >> readKeyword;
797  }
798  else {
799  // eof found
800  break;
801  }
802  }
803 
804  if(readKeyword != termination) {
805  if(is.eof() && !is.bad()) {
806  is.clear();
807  }
808 
809  is.seekg(beforeKeywordPos, ios::beg);
810 
811  QString msg = "PVL Object [" + result.name();
812  msg += "] EndObject not found before end of file";
813  throw IException(IException::Unknown, msg, _FILEINFO_);
814  }
815 
816  return is;
817  }
818 
819 
821  const PvlObject &PvlObject::operator=(const PvlObject &other) {
822  this->PvlContainer::operator=(other);
823 
824  m_objects = other.m_objects;
825  m_groups = other.m_groups;
826 
827  return *this;
828  }
829 
842  {
843  // Validate the current object
844  int iObjSize = objects();
845 
846  for(int i=0; i<iObjSize; i++) {
847  PvlObject & pvlTmplObj = object(i);
848 
849  QString sObjName = pvlTmplObj.name();
850  bool bObjFound = false;
851 
852  // Pvl contains the Object Name
853  if(pPvlObj.hasObject(sObjName)) {
854  PvlObject & pvlObj = pPvlObj.findObject(sObjName);
855  pvlTmplObj.validateObject(pvlObj);
856  if(pvlObj.objects()==0 && pvlObj.groups()==0 && pvlObj.keywords()==0) {
857  pPvlObj.deleteObject(pvlObj.name());
858  }
859  bObjFound = true;
860  }
861  else {
862  QString sOption = sObjName + "__Required";
863  bObjFound = true; // optional is the default
864  if(pvlTmplObj.hasKeyword(sOption)) {
865  PvlKeyword pvlKeyOption = pvlTmplObj.findKeyword(sOption);
866  if(pvlKeyOption[0] == "true") { // Required is true
867  bObjFound = false;
868  }
869  }
870  }
871  if (bObjFound == false) {
872  QString sErrMsg = "Object \"" + sObjName + "\" Not Found in the Template File\n";
873  throw IException(IException::User, sErrMsg, _FILEINFO_);
874  }
875  }
876 
877  // Validate the groups in the current object
878  int iTmplGrpSize = groups();
879  for(int i=0; i<iTmplGrpSize; i++) {
880  PvlGroup & pvlTmplGrp = group(i);
881  bool bGrpFound = false;
882  QString sGrpName = pvlTmplGrp.name();
883 
884  // Pvl contains the Object Name
885  if(pPvlObj.hasGroup(sGrpName)) {
886  PvlGroup & pvlGrp = pPvlObj.findGroup(sGrpName);
887  pvlTmplGrp.validateGroup(pvlGrp);
888  if(pvlGrp.keywords()==0) {
889  pPvlObj.deleteGroup(pvlGrp.name());
890  }
891  bGrpFound = true;
892  }
893  else {
894  bGrpFound = true;
895  QString sOption = sGrpName + "__Required";
896  if(pvlTmplGrp.hasKeyword(sOption)) {
897  PvlKeyword pvlKeyOption = pvlTmplGrp.findKeyword(sOption);
898  if(pvlKeyOption[0] == "true") { // Required is true
899  bGrpFound = false;
900  }
901  }
902  }
903  if (bGrpFound == false) {
904  QString sErrMsg = "Group \"" + sGrpName + "\" Not Found in the Template File\n";
905  throw IException(IException::User, sErrMsg, _FILEINFO_);
906  }
907  }
908 
909  // Validate the Keywords in the current Object
910  validateAllKeywords((PvlContainer &)pPvlObj);
911  }
912 
913 } // end namespace isis
Isis::PvlObject::endGroup
PvlGroupIterator endGroup()
Returns the ending group index.
Definition: PvlObject.h:109
Isis::PvlObject::FindOptions
FindOptions
A collection of options to use when finding.
Definition: PvlObject.h:154
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::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::PvlObject::PvlGroupIterator
QList< Isis::PvlGroup >::iterator PvlGroupIterator
The counter for groups.
Definition: PvlObject.h:83
Isis::operator<<
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:314
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::PvlContainer::operator=
const PvlContainer & operator=(const PvlContainer &other)
This is an assignment operator.
Definition: PvlContainer.cpp:375
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::PvlContainer::m_filename
QString m_filename
This contains the filename used to initialize the pvl object.
Definition: PvlContainer.h:283
Isis::PvlFormat
Formats a Pvl name value pair to Isis standards.
Definition: PvlFormat.h:108
Isis::PvlContainer::setName
void setName(const QString &name)
Set the name of the container.
Definition: PvlContainer.h:56
Isis::PvlObject::beginObject
PvlObjectIterator beginObject()
Returns the index of the beginning object.
Definition: PvlObject.h:235
Isis::PvlContainer::addKeyword
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Definition: PvlContainer.cpp:202
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
Isis::PvlObject::groups
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:75
Isis::FileName::fileExists
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:449
Isis::PvlObject::endObject
PvlObjectIterator endObject()
Returns the index of the ending object.
Definition: PvlObject.h:253
Isis::PvlKeyword::clear
void clear()
Clears all values and units for this PvlKeyword object.
Definition: PvlKeyword.cpp:291
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
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::PvlObject::objects
int objects() const
Returns the number of objects.
Definition: PvlObject.h:219
Isis::PvlObject::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::PvlObject::addObject
void addObject(const PvlObject &object)
Add a PvlObject.
Definition: PvlObject.h:307
Isis::PvlObject::object
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:489
Isis::PvlContainer::validateAllKeywords
void validateAllKeywords(PvlContainer &pPvlCont)
Validate All the Keywords in a Container comparing with the Template.
Definition: PvlContainer.cpp:394
Isis::PvlObject::Traverse
@ Traverse
Search child objects.
Definition: PvlObject.h:158
Isis::PvlObject::PvlObjectIterator
QList< PvlObject >::iterator PvlObjectIterator
The counter for objects.
Definition: PvlObject.h:227
Isis::PvlKeyword::setName
void setName(QString name)
Sets the keyword name.
Definition: PvlKeyword.cpp:120
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
Isis::PvlObject::findKeyword
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
Definition: PvlContainer.cpp:62
Isis::PvlObject::hasKeyword
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
Definition: PvlObject.cpp:236
Isis::PvlObject::operator=
const PvlObject & operator=(const PvlObject &other)
This is an assignment operator.
Definition: PvlObject.cpp:821
Isis::PvlGroup::validateGroup
void validateGroup(PvlGroup &pPvlGrp)
Validate a Group comparing with the Template Group.
Definition: PvlGroup.cpp:207
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::name
QString name() const
Returns the container name.
Definition: PvlContainer.h:63
Isis::PvlObject::PvlObject
PvlObject()
Creates a blank PvlObject.
Definition: PvlObject.cpp:26
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::PvlKeyword::setValue
void setValue(QString value, QString unit="")
Sets new values.
Definition: PvlKeyword.cpp:155
Isis::PvlObject::m_groups
QList< PvlGroup > m_groups
A vector of PvlGroups contained in the current PvlObject.
Definition: PvlObject.h:355
Isis::PvlObject::validateObject
void validateObject(PvlObject &pPvlObj)
Validate Object.
Definition: PvlObject.cpp:841
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::None
@ None
Search only the current level.
Definition: PvlObject.h:156
Isis::PvlObject::addGroup
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
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.
Isis::PvlObject::deleteObject
void deleteObject(const QString &name)
Remove an object from the current PvlObject.
Definition: PvlObject.cpp:366
Isis::PvlObject::beginGroup
PvlGroupIterator beginGroup()
Returns the beginning group index.
Definition: PvlObject.h:91
Isis::PvlContainer::PvlKeywordIterator
QList< PvlKeyword >::iterator PvlKeywordIterator
The keyword iterator.
Definition: PvlContainer.h:157
Isis::PvlContainer::keywords
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:86
Isis::PvlObject::findKeyword
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Definition: PvlObject.cpp:177
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::PvlObject::deleteGroup
void deleteGroup(const QString &name)
Remove a group from the current PvlObject.
Definition: PvlObject.cpp:408
Isis::Message::ArraySubscriptNotInRange
QString ArraySubscriptNotInRange(int index)
This error should be used when an Isis object or application is checking array bounds and the legal r...
Definition: ArraySubscriptNotInRange.cpp:31
Isis::operator>>
std::istream & operator>>(std::istream &is, CSVReader &csv)
Input read operator for input stream sources.
Definition: CSVReader.cpp:447
Isis::PvlContainer::begin
PvlKeywordIterator begin()
Return the beginning iterator.
Definition: PvlContainer.h:178
Isis::PvlObject::m_objects
QList< PvlObject > m_objects
A vector of PvlObjects contained in the current PvlObject.
Definition: PvlObject.h:353
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::PvlContainer::type
QString type() const
Returns the container type.
Definition: PvlContainer.h:79

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the USGS Astrogeology Discussion Board
To report a bug, or suggest a feature go to: ISIS Github
File Modified: 07/13/2023 15:17:07