Isis 3 Programmer Reference
PvlToken.cpp
Go to the documentation of this file.
1 
22 #include "PvlToken.h"
23 #include "IException.h"
24 #include "IString.h"
25 #include "Message.h"
26 
27 using namespace std;
28 namespace Isis {
34  PvlToken::PvlToken(const QString &k) {
35  setKey(k);
36  valueClear();
37  }
38 
40  PvlToken::PvlToken() {
41  valueClear();
42  }
43 
45  PvlToken::~PvlToken() {
46  m_key.clear();
47  valueClear();
48  }
49 
55  void PvlToken::setKey(const QString &k) {
56  m_key = k;
57  };
58 
64  QString PvlToken::key() const {
65  return m_key;
66  };
67 
73  QString PvlToken::keyUpper() const {
74  return m_key.toUpper();
75  }
76 
78  void PvlToken::valueClear() {
79  m_value.clear();
80  }
81 
87  int PvlToken::valueSize() const {
88  return m_value.size();
89  }
90 
97  void PvlToken::addValue(const QString &v) {
98  m_value.push_back(v);
99  }
100 
110  QString PvlToken::value(const int index) const {
111  if((index < 0) || (index >= (int) m_value.size())) {
112  QString message = Isis::Message::ArraySubscriptNotInRange(index);
113  throw IException(IException::Programmer, message, _FILEINFO_);
114  }
115  return m_value[index];
116  }
117 
127  QString PvlToken::valueUpper(int index) const {
128  if((index < 0) || (index >= (int) m_value.size())) {
129  QString message = Isis::Message::ArraySubscriptNotInRange(index);
130  throw IException(IException::Programmer, message, _FILEINFO_);
131  }
132 
133  return m_value[index].toUpper();
134  }
135 } // end namespace isis
Namespace for the standard library.
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
QString ArraySubscriptNotInRange(int index)
This error should be used when an Isis object or application is checking array bounds and the legal r...
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31