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
16namespace 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}
Container for cube-like labels.
Definition Pvl.h:119
A single keyword-value pair.
Definition PvlKeyword.h:87
int size() const
Returns the number of values stored in this keyword.
Definition PvlKeyword.h:133
Parse and return elements of a Pvl sequence.
Definition PvlSequence.h:46
std::vector< std::vector< QString > > p_sequence
A vector of Strings that contains the values for the keyword.
Definition PvlSequence.h:80
PvlSequence & operator=(PvlKeyword &key)
Load a sequence using a Pvl keyword.
PvlSequence & operator+=(const QString &array)
Add a string array to the sequence.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition IString.cpp:211