Isis 3 Programmer Reference
IString.cpp
1 
6 /* SPDX-License-Identifier: CC0-1.0 */
7 #include "IString.h"
8 
9 #include <algorithm>
10 #include <cmath>
11 #include <cstring>
12 #include <iomanip>
13 #include <iostream>
14 #include <sstream>
15 #include <stdio.h>
16 #include <string>
17 
18 #include <QMap>
19 #include <QObject>
20 
21 #include "IException.h"
22 #include "SpecialPixel.h"
23 
24 using namespace std;
25 
26 namespace Isis {
38  bool toBool(const QString &string) {
39  QStringList trues;
40  trues.append("true");
41  trues.append("t");
42  trues.append("yes");
43  trues.append("y");
44  trues.append("on");
45  trues.append("1");
46 
47  QStringList falses;
48  falses.append("false");
49  falses.append("f");
50  falses.append("no");
51  falses.append("n");
52  falses.append("off");
53  falses.append("0");
54 
55  bool result = true;
56  bool foundMatch = false;
57 
58  QListIterator<QString> truesIterator(trues);
59  while (!foundMatch && truesIterator.hasNext()) {
60  foundMatch = (string.compare(truesIterator.next(), Qt::CaseInsensitive) == 0);
61  }
62 
63  if (!foundMatch) {
64  result = false;
65 
66  QListIterator<QString> falsesIterator(falses);
67  while (!foundMatch && falsesIterator.hasNext()) {
68  foundMatch = (string.compare(falsesIterator.next(), Qt::CaseInsensitive) == 0);
69  }
70  }
71 
72  if (!foundMatch) {
73  qSort(trues);
74  qSort(falses);
75  QString message = QObject::tr("Failed to convert string [%1] to a boolean. "
76  "Please specify one of [%2] for true, or one of [%3] for false.")
77  .arg(string).arg(trues.join(", ")).arg(falses.join(", "));
78  throw IException(IException::Unknown, message, _FILEINFO_);
79  }
80 
81  return result;
82  }
83 
84 
93  int toInt(const QString &string) {
94  bool ok = true;
95 
96  int result = string.toInt(&ok);
97 
98  if (!ok) {
99  QString message = QObject::tr("Failed to convert string [%1] to an integer").arg(string);
100  throw IException(IException::Unknown, message, _FILEINFO_);
101  }
102 
103  return result;
104  }
105 
106 
115  BigInt toBigInt(const QString &string) {
116  BigInt result;
117 
118  try {
119  std::stringstream s;
120  s << string.toStdString(); // Put the string into a stream
121  s.seekg(0, std::ios::beg); // Move the input pointer to the beginning
122  s >> result; // read/get "type T" out of the stream
123  std::ios::iostate state = s.rdstate();
124  if((state & std::ios::failbit) || (state & std::ios::badbit) ||
125  (!(state & std::ios::eofbit))) { // Make sure the stream is empty
126  throw (int)-1;
127  }
128  }
129  catch(...) {
130  QString message = QObject::tr("Failed to convert string [%1] to a big integer").arg(string);
131  throw IException(IException::Unknown, message, _FILEINFO_);
132  }
133 
134  return result;
135  }
136 
137 
149  double toDouble(const QString &string) {
150  double result = 0.0;
151 
152  if (string.startsWith("16#") && string.endsWith("#")) {
153  try {
154  stringstream s;
155  s << string.mid(3, string.size() - 3);
156  s.seekg(0, ios::beg);
157 
158  union {
159  unsigned int intData;
160  float floatData;
161  } raw;
162 
163  s >> hex >> raw.intData;
164 
165  ios::iostate state = s.rdstate();
166  if((state & ios::failbit) || (state & ios::badbit)) {
167  throw IException();
168  }
169 
170  result = raw.floatData;
171  }
172  catch(...) {
173  QString message = QObject::tr("Failed to convert HEX string [%1] to a "
174  "double").arg(string);
175  throw IException(IException::Unknown, message, _FILEINFO_);
176  }
177  }
178  else {
179  static QMap<QString, double> knownStrings;
180  if (knownStrings.isEmpty()) {
181  // Special case: user called toDouble(toString(DBL_MAX))
182  knownStrings["1.79769313486232e+308"] = DBL_MAX;
183  knownStrings["-1.79769313486232e+308"] = -DBL_MAX;
184  }
185 
186  bool ok = true;
187  if (!knownStrings.contains(string)) {
188  result = string.toDouble(&ok);
189  }
190  else {
191  result = knownStrings[string];
192  }
193 
194  if (!ok) {
195  QString message = QObject::tr("Failed to convert string [%1] to a double").arg(string);
196  throw IException(IException::Unknown, message, _FILEINFO_);
197  }
198  }
199 
200  return result;
201  }
202 
203 
211  QString toString(bool boolToConvert) {
212  return boolToConvert? "Yes" : "No";
213  }
214 
215 
224  QString toString(char charToConvert) {
225  QString result;
226  result += QChar(charToConvert);
227  return result;
228  }
229 
230 
237  QString toString(const int &intToConvert) {
238  return QString::number(intToConvert);
239  }
240 
241 
248  QString toString(const unsigned int &intToConvert) {
249  return QString::number(intToConvert);
250  }
251 
252 
259  QString toString(const BigInt &intToConvert) {
260  return QString::number(intToConvert);
261  }
262 
263 
277  QString toString(double doubleToConvert, int precision) {
278  // If number is zero, then it is not valid to do a log10 on it. To avoid this,
279  // check for zero ahead of time and handle it.
280  QString result;
281 
282  if(doubleToConvert == 0.0) {
283  result = "0.0";
284  }
285  else if (std::isnan(doubleToConvert) ) {
286  result = "nan";
287  }
288 
289  if(doubleToConvert > DBL_MAX) {
290  doubleToConvert = DBL_MAX;
291  }
292 
293  if(doubleToConvert < -DBL_MAX) {
294  doubleToConvert = -DBL_MAX;
295  }
296 
297  if (result == "") {
298  // First determine the number of digits preceding the decimal point
299  // Numbers of the form 0.ABCDEFG where A is non-zero are assumed to
300  // have a leading digit of zero. Numbers of the form 0.0ABCDEFG,
301  // 0.00ABCEFEG and so on are not considered to have a leading digit
302  // (pre = 0).
303  double temp = qAbs(doubleToConvert);
304  int pre = (int)(log10(temp)) + 1;
305 
306  // If preceding number of digits is too large then we will need to create a
307  // scientific notation string. We will need 14 spaces for numbers, 2 spaces
308  // for exponents, 2 spaces for signs, and 1 for the letter E, 1 for a decimal
309  // place, and 1 extra in case of a leading 0. A grand total
310  // of 21 spaces is required. Therefore our format can be %22e
311 
312  // If the preceding number of digits is zero then we likely have a
313  // really small number (e.g., 0.000331236236). So let's put those in
314  // scientific notation as well
315 
316  // Finally, remove any zeroes before the E and if the exponent is zero
317  // then strip it off as well.
318 
319  char doubleString[23];
320 
321  if((log10(temp) > 13.0) || (log10(temp) < -3.0)) {
322  char format[8], buffer[8];
323  snprintf(buffer, 8, "%de", precision);
324  strcpy(format, "%21.");
325  strcat(format, buffer);
326  snprintf(doubleString, 23, format, doubleToConvert);
327 
328  char *e = strchr(doubleString, 'e');
329  char *sptr = e - 1;
330 
331  while(*sptr == '0') {
332  sptr--;
333  }
334 
335  if(*sptr == '.') {
336  sptr++;
337  }
338 
339  sptr++;
340  char tmp[22];
341  strcpy(tmp, e);
342  strcpy(sptr, tmp);
343 
344  e = strchr(doubleString, 'e');
345  int allzero = 1;
346 
347  for(sptr = e + 2; *sptr; sptr++) {
348  if(*sptr != '0') {
349  allzero = 0;
350  }
351  }
352 
353  if(allzero) {
354  *e = 0;
355  }
356  }
357  else {
358  // Ok it can be presented as a normal floating point num. So we will need
359  // 14 spaces for nums, 1 for the sign, 1 for the decimal, and 1 more
360  // for a possible leading 0. A grand total of 17 spaces. Therefore our
361  // format can be "%17.postf". Finally remove any trailing zeroes.
362 
363  if(temp < 1.0) {
364  pre--;
365  }
366  int post = precision - pre;
367 
368  char tempStr[3], format[8];
369  strcpy(format, "%17.");
370  snprintf(tempStr, 3, "%d", post);
371  strcat(format, tempStr);
372  strcat(format, "f");
373 
374  snprintf(doubleString, 23, format, doubleToConvert);
375 
376  if(post > 0) {
377  char *sptr = doubleString + strlen(doubleString) - 1;
378  while((*sptr == '0') && (*(sptr - 1) != '.')) {
379  *sptr = 0;
380  sptr--;
381  }
382  }
383  }
384 
385  while(doubleString[0] == ' ') {
386  for(unsigned int i = 0; i < strlen(doubleString); i++) {
387  doubleString[i] = doubleString[i + 1];
388  }
389  }
390 
391  result = QString(doubleString);
392  }
393 
394  return result;
395  }
396 
397 
403  IString::IString() : string() {
404  }
405 
414  IString::IString(const std::string &str) : string(str) {
415  }
416 
424  IString::IString(const IString &str) : string(str) {
425  }
426 
434  IString::IString(const char *str) : string(str) {
435  }
436 
446  IString::IString(const int &num) : string() {
447  ostringstream str;
448  str << num;
449  assign(str.str());
450  }
451 
461  IString::IString(const BigInt &num) : string() {
462  ostringstream str;
463  str << num;
464  assign(str.str());
465  }
466 
481  IString::IString(const double &num, const int piPrecision) : string() {
482  SetDouble(num, piPrecision);
483  }
484 
485 
494  void IString::SetDouble(const double &num, const int piPrecision) {
495  *this = toString(num, piPrecision).toStdString();
496  }
497 
504  IString::IString(const QString &str) : string() {
505  assign(str.toStdString());
506  }
507 
514 
525  IString IString::Trim(const std::string &chars) {
526  TrimHead(chars);
527  TrimTail(chars);
528  return *this;
529  }
530 
544  std::string IString::Trim(const std::string &chars, const std::string &str) {
545  //string result = str;
546  //result.replace (0,str.find_first_not_of (chars), "");
547  return TrimTail(chars, TrimHead(chars, str));
548  }
549 
558  IString IString::TrimHead(const std::string &chars) {
559  *this = replace(0, find_first_not_of(chars), "");
560  return *this;
561  }
562 
573  std::string IString::TrimHead(const std::string &chars, const std::string &str) {
574  string result = str;
575  result.replace(0, str.find_first_not_of(chars), "");
576  return result;
577  }
578 
587  IString IString::TrimTail(const std::string &chars) {
588  *this = erase(find_last_not_of(chars) + 1);
589  return *this;
590  }
591 
604  std::string IString::TrimTail(const std::string &chars, const std::string &str) {
605  string result = str;
606  result.erase(str.find_last_not_of(chars) + 1);
607  return result;
608  }
609 
618  string temp = *this;
619  *this = UpCase(temp);
620  return *this;
621  }
622 
632  std::string IString::UpCase(const std::string &str) {
633  string sOut(str);
634  transform(str.begin(), str.end(), sOut.begin(), (int ( *)(int)) toupper);
635  return(sOut);
636  }
637 
645  *this = DownCase((string) * this);
646  return *this;
647  }
648 
659  std::string IString::DownCase(const std::string &str) {
660  string sOut(str);
661  transform(str.begin(), str.end(), sOut.begin(), (int ( *)(int))tolower);
662  return sOut;
663  }
664 
677  static bool nocase_compare(const char c1, const char c2) {
678  return(toupper(c1) == toupper(c2));
679  }
680 
690  bool IString::Equal(const std::string &str) const {
691  string temp = *this;
692  return Equal(str, temp);
693  }
694 
705  bool IString::Equal(const std::string &str1, const std::string &str2) {
706  if(str1.size() != str2.size()) return(false);
707  return(std::equal(str1.begin(), str1.end(), str2.begin(), nocase_compare));
708  }
709 
710 
718  int IString::ToInteger() const {
719  return ToInteger(*this);
720  }
721 
731  int IString::ToInteger(const std::string &str) {
732  int v_out;
733  try {
734  stringstream s;
735  s << str; // Put the string into a stream
736  s.seekg(0, ios::beg); // Move the input pointer to the beginning
737  s >> v_out; // read/get "type T" out of the stream
738  ios::iostate state = s.rdstate();
739  if((state & ios::failbit) || (state & ios::badbit) ||
740  (!(state & ios::eofbit))) { // Make sure the stream is empty
741  throw(int) - 1;
742  }
743  }
744  catch(...) {
745  string message = "Failed to convert string [" + str + "] to an integer";
746  throw IException(IException::Unknown, message, _FILEINFO_);
747  }
748  return(v_out);
749  }
750 
759  return ToBigInteger(*this);
760  }
761 
771  BigInt IString::ToBigInteger(const std::string &str) {
772  BigInt v_out;
773  try {
774  stringstream s;
775  s << str; // Put the string into a stream
776  s.seekg(0, ios::beg); // Move the input pointer to the beginning
777  s >> v_out; // read/get "type T" out of the stream
778  ios::iostate state = s.rdstate();
779  if((state & ios::failbit) || (state & ios::badbit) ||
780  (!(state & ios::eofbit))) { // Make sure the stream is empty
781  throw(int) - 1;
782  }
783  }
784  catch(...) {
785  string message = "Failed to convert string [" + str + "] to a big "
786  "integer";
787  throw IException(IException::Unknown, message, _FILEINFO_);
788  }
789  return(v_out);
790  }
791 
799  double IString::ToDouble() const {
800  return ToDouble(*this);
801  }
802 
812  double IString::ToDouble(const std::string &str) {
813 
814  double v_out;
815 
816  // Convert a hex value
817  if(str.substr(0, 3) == "16#" && str.substr(str.length() - 1, 1) == "#") {
818  try {
819  stringstream s;
820  s << str.substr(3, str.find_last_of("#") - 3);
821  s.seekg(0, ios::beg);
822 
823  union {
824  unsigned int i;
825  float f;
826  } u;
827 
828  s >> hex >> u.i;
829 
830  ios::iostate state = s.rdstate();
831  if((state & ios::failbit) || (state & ios::badbit)) {
832  throw(int) - 1;
833  }
834  v_out = u.f;
835  }
836  catch(...) {
837  string message = "Failed to convert HEX string [" + str + "] to a "
838  "double";
839  throw IException(IException::Unknown, message, _FILEINFO_);
840  }
841  }
842  // Convert a decimal value
843  else {
844  try {
845  stringstream s;
846  s << str; // Put the string into a stream
847  s.seekg(0, ios::beg); // Move the input pointer to the beginning
848  s >> v_out; // read/get "type T" out of the stream
849  ios::iostate state = s.rdstate();
850  if((state & ios::failbit) || (state & ios::badbit) ||
851  (!(state & ios::eofbit))) { // Make sure the stream is empty
852  throw(int) - 1;
853  }
854  }
855  catch(...) {
856  string message = "Failed to convert string [" + str + "] to a double";
857  throw IException(IException::Unknown, message, _FILEINFO_);
858  }
859  }
860 
861  return(v_out);
862  }
863 
869  QString IString::ToQt() const {
870  return QString::fromStdString(*this);
871  }
872 
880  QString IString::ToQt(const std::string &s) {
881  return(QString::fromStdString(s));
882  }
883 
897  IString IString::Token(const IString &separator) {
898  IString retstr = "" ;
899 
900  for(unsigned int i = 0; i < size(); i++) {
901  for(unsigned int sep = 0; sep < separator.size(); sep++) {
902  if(separator[sep] == at(i)) {
903  retstr = substr(0, i);
904  replace(0, i + 1, "");
905  return retstr;
906  }
907  }
908  }
909 
910  if(retstr == "") {
911  retstr = (*this);
912  replace(0, size(), "");
913  }
914 
915  return retstr;
916  }
917 
940  int IString::Split(const char separator, const std::string &str,
941  std::vector<std::string> &tokens,
942  bool allowEmptyEntries) {
943  string::size_type idx(0), idx2(0);
944  unsigned int ksize = str.size();
945  tokens.clear();
946 
947  if(ksize > 0) {
948  if(str[idx] == separator) idx++;
949  while((idx2 = str.find(separator, idx)) != string::npos) {
950  if(idx2 == idx) {
951  if(allowEmptyEntries) tokens.push_back("");
952  }
953  else {
954  string::size_type len(idx2 - idx);
955  tokens.push_back(str.substr(idx, len));
956  }
957  idx = idx2 + 1;
958  }
959  if(idx < ksize) tokens.push_back(str.substr(idx));
960  }
961  return(tokens.size());
962  }
963 
964 
975  *this = Compress((string) * this, force);
976  return *this;
977  }
978 
990  std::string IString::Compress(const std::string &str, bool force) {
991  string result(str);
992  if(force == false) {
993  int spaces = 0;
994  int leftquote = result.find_first_of("\"\'");
995  while((spaces = result.find(" ", spaces)) >= 0) {
996  int rightquote = result.find_first_of("\"\'", leftquote + 1);
997  if(spaces < leftquote) { //spaces are before quotation
998  result.erase(spaces, 1);
999  leftquote = result.find_first_of("\"\'", spaces);
1000  }
1001  else if((spaces > leftquote) && (spaces < rightquote)) { //spaces are within quotation
1002  spaces = rightquote + 1;
1003  leftquote = result.find_first_of("\"\'", rightquote + 1);
1004  }
1005  else if(leftquote == (int)npos) { //there are no quotations
1006  result.erase(spaces, 1);
1007  }
1008  else { //spaces are after quotation
1009  leftquote = result.find_first_of("\"\'", rightquote + 1);
1010  }
1011  }
1012  return result;
1013  }
1014  else {
1015  int spaces = 0;
1016  while((spaces = result.find(" ", spaces)) >= 0) {
1017  result.erase(spaces, 1);
1018  }
1019  return result;
1020  }
1021  }
1022 
1037  IString IString::Replace(const std::string &from, const std::string &to,
1038  int maxReplaceCount) {
1039  *this = IString(Replace((string) * this, from, to, maxReplaceCount));
1040  return *this;
1041  }
1042 
1091  std::string IString::Replace(const std::string &str, const std::string &from,
1092  const std::string &to, int maxReplaceCount) {
1093  if(str.empty()) return(str);
1094  if(from.empty()) return(str);
1095  string sRet(str);
1096  string::size_type pos;
1097  int nReplaced = 0;
1098  while((nReplaced < maxReplaceCount) &&
1099  (pos = sRet.find(from)) != string::npos) {
1100  sRet.replace(pos, from.size(), to);
1101  nReplaced++;
1102  }
1103  return(sRet);
1104  }
1105 
1106 
1123  IString IString::Replace(const std::string &from, const std::string &to,
1124  bool honorquotes) {
1125  *this = Replace((string) * this, from, to, honorquotes);
1126  return *this;
1127  }
1128 
1147  IString IString::Replace(const std::string &str, const std::string &from,
1148  const std::string &to , bool honorquotes) {
1149 
1150  string result = str;
1151  if(honorquotes == true) {
1152  int instances = 0;
1153  int quote = result.find_first_of("\"\'");
1154  while((instances = result.find(from, instances)) >= 0) {
1155 
1156  int nextquote = result.find_first_of("\"\'", quote + 1);
1157  if(instances < quote) {
1158  result.replace(instances, from.length(), to);
1159  quote = result.find_first_of("\"\'", instances);
1160  }
1161  else if((instances > quote) && (instances < nextquote)) {
1162  instances = nextquote + 1;
1163  quote = result.find_first_of("\"\'", nextquote);
1164  }
1165  else if(quote == (int)npos) {
1166  result.replace(instances, from.length(), to);
1167  }
1168  else {
1169  quote = result.find_first_of("\"\'", nextquote);
1170  }
1171  }
1172  return (IString) result;
1173  }
1174  else {
1175  int instances = 0;
1176  while((instances = result.find(from, instances)) >= 0) {
1177  result.replace(instances, from.length(), to);
1178  }
1179  return (IString) result;
1180  }
1181  }
1182 
1196  IString IString::Convert(const std::string &listofchars, const char &to) {
1197  *this = Convert((string) * this, listofchars, to);
1198  return *this;
1199  }
1200 
1216  string IString::Convert(const std::string &str, const std::string &listofchars,
1217  const char &to) {
1218  std::string::size_type pos = 0;
1219  string result = str;
1220  string tmp;
1221  tmp = to;
1222  while((pos = result.find_first_of(listofchars, pos)) != npos) {
1223  result.replace(pos, 1, tmp);
1224  pos++;
1225  }
1226  return result;
1227  }
1228 
1239  *this = ConvertWhiteSpace((string) * this);
1240  return *this;
1241  }
1242 
1252  std::string IString::ConvertWhiteSpace(const std::string &str) {
1253  return Convert(str, "\n\r\t\f\v\b", ' ');
1254  }
1255 
1266  IString IString::Remove(const std::string &del) {
1267  std::string::size_type pos;
1268  while((pos = find_first_of(del)) != npos) this->erase(pos, 1);
1269  return *this;
1270  }
1271 
1285  std::string IString::Remove(const std::string &str, const std::string &del) {
1286  string::size_type pos;
1287  string result(str);
1288  while((pos = result.find_first_of(del)) != npos) result.erase(pos, 1);
1289  return result;
1290  }
1291 
1301  IString &IString::operator= (const int &value) {
1302  ostringstream str;
1303  str << value;
1304  assign(str.str());
1305  return *this;
1306  }
1307 
1318  ostringstream str;
1319  str << value;
1320  assign(str.str());
1321  return *this;
1322  }
1323 
1333  std::string IString::ToStd(const QString &str) {
1334  return(str.toStdString());
1335  }
1336 
1346  QStringList IString::ToQt(const std::vector<std::string> &sl) {
1347  QStringList Qsl;
1348  for(unsigned int i = 0 ; i < sl.size() ; i++) {
1349  Qsl << ToQt(sl[i]);
1350  }
1351  return Qsl;
1352  }
1353 
1363  std::vector<std::string> IString::ToStd(const QStringList &sl) {
1364  std::vector<std::string> Stdsl;
1365  for(int i = 0 ; i < sl.size() ; i++) {
1366  Stdsl.push_back(ToStd(sl.at(i)));
1367  }
1368 
1369  return(Stdsl);
1370  }
1371 
1372 
1384  std::ostream &operator<<(std::ostream &outputStream, const QString &string) {
1385  return (outputStream << string.toLatin1().data());
1386  }
1387 
1388 
1400  std::ostream &operator<<(std::ostream &outputStream, const QStringRef &string) {
1401  return (outputStream << string.toString().toLatin1().data());
1402  }
1403 }
Isis::IString::Replace
IString Replace(const std::string &from, const std::string &to, int maxReplaceCount=20)
Replaces all instances of the first input string with the second input string.
Definition: IString.cpp:1037
Isis::IString::ToDouble
double ToDouble() const
Returns the floating point value the IString represents.
Definition: IString.cpp:799
Isis::nocase_compare
static bool nocase_compare(const char c1, const char c2)
Compare two characters without regard to case.
Definition: IString.cpp:677
Isis::operator<<
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
Definition: Hillshade.cpp:314
Isis::IString::DownCase
IString DownCase()
Converts all upper case letters in the object IString into lower case characters.
Definition: IString.cpp:644
Isis::IString::TrimTail
IString TrimTail(const std::string &chars)
Trims the input characters from the end of the object IString.
Definition: IString.cpp:587
Isis::IString::ToStd
static std::string ToStd(const QString &str)
Converts a Qt string into a std::string.
Definition: IString.cpp:1333
Isis::IString::IString
IString()
Constructs an empty IString object.
Definition: IString.cpp:403
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::IString::Trim
IString Trim(const std::string &chars)
Removes characters from the beginning and end of the IString.
Definition: IString.cpp:525
Isis::IString::ConvertWhiteSpace
IString ConvertWhiteSpace()
Returns the string with all "new lines", "carriage returns", "tabs", "form feeds",...
Definition: IString.cpp:1238
Isis::IString::ToInteger
int ToInteger() const
Returns the object string as an integer.
Definition: IString.cpp:718
QStringList
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::IString::Convert
IString Convert(const std::string &listofchars, const char &to)
Returns the string with all occurrences of any character in the "from" argument converted to the "to"...
Definition: IString.cpp:1196
Isis::IString::Compress
IString Compress(bool force=false)
Collapses multiple spaces into single spaces.
Definition: IString.cpp:974
Isis::IString::UpCase
IString UpCase()
Converst any lower case characters in the object IString with uppercase characters.
Definition: IString.cpp:617
Isis::IString::ToBigInteger
BigInt ToBigInteger() const
Returns the BigInt representation of the object IString.
Definition: IString.cpp:758
Isis::toBigInt
BigInt toBigInt(const QString &string)
Global function to convert from a string to a "big" integer.
Definition: IString.cpp:115
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::IString::operator=
IString & operator=(const int &value)
Attempts to convert the stirng to a QStirng (Qt) and return that IString.
Definition: IString.cpp:1301
Isis::BigInt
long long int BigInt
Big int.
Definition: Constants.h:49
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::IString::~IString
~IString()
Destructor.
Definition: IString.cpp:513
Isis::IString::SetDouble
void SetDouble(const double &value, const int piPrecision=14)
Performs the conversion necessary to represent a floating-point value as a string.
Definition: IString.cpp:494
Isis::toDouble
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:149
std
Namespace for the standard library.
Isis::toBool
bool toBool(const QString &string)
Global function to convert from a string to a boolean.
Definition: IString.cpp:38
Isis::IString::Split
static int Split(const char separator, const std::string &instr, std::vector< std::string > &tokens, bool allowEmptyEntries=true)
Find separators between characters and split them into strings.
Definition: IString.cpp:940
Isis::IString::Equal
bool Equal(const std::string &str) const
Compare a string to the object IString.
Definition: IString.cpp:690
Isis::IString::Token
IString Token(const IString &separator)
Returns the first token in the IString.
Definition: IString.cpp:897
QMap< QString, double >
Isis::IString
Adds specific functionality to C++ strings.
Definition: IString.h:165
Isis::IString::TrimHead
IString TrimHead(const std::string &chars)
Trims The input characters from the beginning of the object IString.
Definition: IString.cpp:558
Isis::IString::Remove
IString Remove(const std::string &del)
Remove all instances of any character in the string from the IString.
Definition: IString.cpp:1266
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IString::ToQt
QString ToQt() const
Retuns the object string as a QString.
Definition: IString.cpp:869