Isis 3 Programmer Reference
PvlSequence.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 
8 #include <sstream>
9 
10 #include <QString>
11 
12 #include "PvlSequence.h"
13 #include "Pvl.h"
14 #include "IString.h"
15 
16 namespace Isis {
26  for(int i = 0; i < key.size(); i++) {
27  this->operator+=(key[i]);
28  }
29  return *this;
30  }
31 
39  PvlSequence &PvlSequence::operator+=(const QString &array) {
40  std::stringstream str;
41  str << "temp = " << array;
42  Pvl pvl;
43  str >> pvl;
44  PvlKeyword &key = pvl["temp"];
45  std::vector<QString> temp;
46  for(int i = 0; i < key.size(); i++) {
47  temp.push_back(key[i]);
48  }
49  p_sequence.push_back(temp);
50  return *this;
51  }
52 
59  PvlSequence &PvlSequence::operator+=(std::vector<QString> &array) {
60  std::vector<QString> temp;
61  for(int i = 0; i < (int)array.size(); i++) {
62  temp.push_back(array[i]);
63  }
64  p_sequence.push_back(temp);
65  return *this;
66  }
67 
74  PvlSequence &PvlSequence::operator+=(std::vector<int> &array) {
75  std::vector<QString> temp;
76  for(int i = 0; i < (int)array.size(); i++) {
77  temp.push_back(toString(array[i]));
78  }
79  p_sequence.push_back(temp);
80  return *this;
81  }
82 
89  PvlSequence &PvlSequence::operator+=(std::vector<double> &array) {
90  std::vector<QString> temp;
91  for(int i = 0; i < (int)array.size(); i++) {
92  temp.push_back(toString(array[i]));
93  }
94  p_sequence.push_back(temp);
95  return *this;
96  }
97 }
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::PvlSequence::operator=
PvlSequence & operator=(PvlKeyword &key)
Load a sequence using a Pvl keyword.
Definition: PvlSequence.cpp:25
Isis::PvlSequence::operator+=
PvlSequence & operator+=(const QString &array)
Add a string array to the sequence.
Definition: PvlSequence.cpp:39
Isis::PvlKeyword::size
int size() const
Returns the number of values stored in this keyword.
Definition: PvlKeyword.h:125
Isis::PvlSequence::p_sequence
std::vector< std::vector< QString > > p_sequence
A vector of Strings that contains the values for the keyword.
Definition: PvlSequence.h:77
Isis::PvlSequence
Parse and return elements of a Pvl sequence.
Definition: PvlSequence.h:46
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16