All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions | Static Public Member Functions | Static Public Attributes
QGpCoreTools::StringSection Class Reference

Section of a QString. More...

#include <StringSection.h>

List of all members.

Public Member Functions

void appendTo (QString &str) const
const QChar * begin () const
bool beginWith (const QString &o) const
bool beginWith (const StringSection &o) const
int compare (const QChar *o) const
int compare (const StringSection &o) const
int compare (const QString &o) const
bool contains (const StringSection target) const
bool contains (QChar target) const
const QChar * data () const
const QChar * end () const
bool endWith (const QString &o) const
bool endWith (const StringSection &o) const
const QChar * find (QChar c) const
int find (const StringSection target, bool reverse) const
bool isEmpty () const
bool isValid () const
StringSection left (int n) const
StringSection mid (int position, int n) const
StringSection nextField (const QChar *&ptr, const QString &sep=defaultSeparators, bool skipEmpty=true) const
bool nextLine (const QChar *&ptr, const QString &sep=defaultSeparators) const
bool nextNumber (int &n, const QChar *&ptr, const QString &sep=defaultSeparators, bool skipEmpty=true) const
bool nextNumber (double &n, const QChar *&ptr, const QString &sep=defaultSeparators, bool skipEmpty=true) const
bool nextNumber (Complex &n, const QChar *&ptr, const QString &sep=defaultSeparators, bool skipEmpty=true) const
bool operator!= (const QChar *o) const
bool operator!= (const StringSection &o) const
bool operator!= (const QString &o) const
void operator++ ()
void operator+= (int l)
void operator-- ()
bool operator< (const QChar *o) const
bool operator< (const StringSection &o) const
bool operator< (const QString &o) const
bool operator<= (const QChar *o) const
bool operator<= (const StringSection &o) const
bool operator<= (const QString &o) const
StringSectionoperator= (const StringSection &o)
bool operator== (const QChar *o) const
bool operator== (const StringSection &o) const
bool operator== (const QString &o) const
bool operator> (const QChar *o) const
bool operator> (const StringSection &o) const
bool operator> (const QString &o) const
bool operator>= (const QChar *o) const
bool operator>= (const StringSection &o) const
bool operator>= (const QString &o) const
QChar operator[] (int i) const
StringSection readLine (const QChar *&ptr) const
StringSection right (int n) const
void set (const QString &s)
void set (const QChar *s, int size)
void setEnd (const QChar *e)
void setInvalid ()
void setSize (int size)
void shrink (int nChar)
int size () const
 StringSection ()
 StringSection (const QString &s)
 StringSection (const QChar *s)
 StringSection (const QChar *s, int len)
 StringSection (const QChar *s1, const QChar *s2)
 StringSection (const StringSection &o)
bool to (bool, bool *ok=0) const
QString to (QString) const
int to (int, bool *ok=0) const
uint to (uint, bool *ok=0) const
qlonglong to (qlonglong, bool *ok=0) const
double to (double, bool *ok=0) const
Complex to (const Complex &, bool *ok=0) const
bool toBool (bool *ok=0) const
Complex toComplex () const
Complex toComplex (bool *ok) const
double toDouble (bool *ok=0) const
int toInt (bool *ok=0, int base=10) const
qlonglong toLongLong (bool *ok=0, int base=10) const
QString toString () const
uint toUInt (bool *ok=0, int base=10) const
StringSectiontrimmed ()
 ~StringSection ()

Static Public Member Functions

static int compare (const QChar *str1, const QChar *str2, int n)
static int size (const QChar *str)

Static Public Attributes

static const QString defaultSeparators = "\t "
static const StringSection null

Detailed Description

Section of a QString.

Usefull for parser


Constructor & Destructor Documentation

Referenced by left(), mid(), nextField(), and right().

{
  _str=0;
  _size=0;
}
QGpCoreTools::StringSection::StringSection ( const QString &  s) [inline]
{
  _str=s.data();
  _size=s.size();
}
QGpCoreTools::StringSection::StringSection ( const QChar *  s) [inline]

References size().

{
  _str=s;
  _size=size(s);
}
QGpCoreTools::StringSection::StringSection ( const QChar *  s,
int  len 
) [inline]
{
  _str=s;
  _size=len;
}
QGpCoreTools::StringSection::StringSection ( const QChar *  s1,
const QChar *  s2 
) [inline]

References setEnd().

{
  _str=s1;
  setEnd(s2);
}
{
  *this=o;
}
{}

Member Function Documentation

void QGpCoreTools::StringSection::appendTo ( QString &  str) const [inline]
const QChar* QGpCoreTools::StringSection::begin ( ) const [inline]

Referenced by QGpCoreTools::LineParser::toString().

{return _str;}
bool QGpCoreTools::StringSection::beginWith ( const QString &  o) const [inline]
bool QGpCoreTools::StringSection::beginWith ( const StringSection o) const [inline]

References compare(), and size().

{
  if(_size < o._size) return false;
  return compare(o._str, _str, o.size())==0;
}
int QGpCoreTools::StringSection::compare ( const QChar *  o) const [inline]

Referenced by beginWith(), compare(), endWith(), operator!=(), and operator==().

{
  StringSection os(o);
  return compare(os);
}

References compare(), and TRACE.

  {
    TRACE;
    int r;
    if(_size < o._size) {
      r=compare(_str, o._str, _size);
      if(r==0) return -1; else return r;
    } else if(_size > o._size) {
      r=compare(_str, o._str, o._size);
      if(r==0) return 1; else return r;
    } else return compare(_str, o._str, _size);
  }
int QGpCoreTools::StringSection::compare ( const QString &  o) const [inline]

References compare().

{
  StringSection os(o);
  return compare(os);
}
int QGpCoreTools::StringSection::compare ( const QChar *  str1,
const QChar *  str2,
int  n 
) [static]

References TRACE.

  {
    TRACE;
    if( ! str1) { // Put invalid strings after valid ones
      if( ! str2) {
        return 0;
      } else {
        return 1;
      }
    } else if( ! str2) {
      return -1;
    }
    for(int i=0;i < n;i++ ) {
      if(str1[ i ] < str2[ i ] ) return -1;
      else if(str1[ i ] > str2[ i ] ) return 1;
    }
    return 0;
  }
bool QGpCoreTools::StringSection::contains ( const StringSection  target) const [inline]
{return find(target, false)>-1;}
bool QGpCoreTools::StringSection::contains ( QChar  target) const [inline]
{return find(StringSection(&target, 1), false)>-1;}
const QChar* QGpCoreTools::StringSection::data ( ) const [inline]
const QChar* QGpCoreTools::StringSection::end ( ) const [inline]

Referenced by QGpCoreTools::LineParser::toString().

{return _str+_size;}
bool QGpCoreTools::StringSection::endWith ( const QString &  o) const [inline]

References compare().

{
  if(_size < o.size()) return false;
  return compare(o.data(), _str+_size-o.size(), o.size())==0;
}
bool QGpCoreTools::StringSection::endWith ( const StringSection o) const [inline]

References compare().

{
  if(_size < o._size) return false;
  return compare(o._str, _str+_size-o._size, o._size)==0;
}
const QChar * QGpCoreTools::StringSection::find ( QChar  c) const
  {
    const QChar * ptr=_str;
    const QChar * ptrE=_str + _size;
    while(ptr < ptrE) {
      if( *ptr==c) break;
      ptr++;
    }
    return ptr;
  }
int QGpCoreTools::StringSection::find ( const StringSection  target,
bool  reverse 
) const

References data(), isValid(), size(), and TRACE.

  {
    TRACE;
    if( !isValid()) return -1;
    const QChar * ptrS=_str;
    const QChar * ptrE=_str + _size;
    int nTarget=target.size(), i, n;
    const QChar * targetPtr=target.data();
    QChar initChar;
    if(reverse) {
      targetPtr += nTarget - 1;
      initChar=*targetPtr;
      ptrE--;
      while(ptrE >= ptrS) {
        if(initChar==*ptrE) {
          n=ptrS - ptrE;
          if(n < -nTarget) n=-nTarget;
          for(i=-1; targetPtr[i]==ptrE[i] && i > n; i-- ) {}
          if(targetPtr[i]==0) return ptrE -_str - nTarget;
        }
        ptrE--;
      }
    } else {
      initChar=*targetPtr;
      while(ptrS < ptrE) {
        if(initChar==*ptrS) {
          n=ptrE - ptrS;
          if(n > nTarget) n=nTarget;
          for(i=1; targetPtr[i]==ptrS[i] && i < n; i++ ) {}
          if(targetPtr[i]==0) return ptrS -_str;
        }
        ptrS++;
      }
    }
    return -1;
  }
bool QGpCoreTools::StringSection::isEmpty ( ) const [inline]
bool QGpCoreTools::StringSection::isValid ( ) const [inline]
StringSection QGpCoreTools::StringSection::mid ( int  position,
int  n 
) const [inline]

References null, and StringSection().

{
  if(position>=_size) return StringSection::null;
  int ns=_size-position;
  if(n<ns) ns=n;
  return StringSection(_str+position, ns);
}
StringSection QGpCoreTools::StringSection::nextField ( const QChar *&  ptr,
const QString &  sep = defaultSeparators,
bool  skipEmpty = true 
) const

Returns the next field of this string starting at ptr. If sep does not contain '\n' and '\r' and if a '\n' or '\r' is encountered, an invalid string is returned and ptr points to the first '\n' or '\r'. On the contrary, to jump over line breaks, include '\n' and '\r' in sep and switch skipEmpty to true.

        const QString sep="= \t\n\r";
        int i;
        StringSection f;
        const QChar * ptr=0;
        for(i=0;i<n;i++) {
          if(!content.nextLine(ptr)) break;
          f=content.nextField(ptr, sep);
          if(f.isValid()) x1=f.toDouble(); else break;
          f=content.nextField(ptr, sep);
          if(f.isValid()) x2=f.toDouble(); else break;
        }
        if(i<n) fprintf(stderr,"Error");

References isValid(), setEnd(), StringSection(), and TRACE.

Referenced by createBands(), createDots(), createManyCurves(), QGpCoreWave::Resistivity1DModel::fromStream(), QGpCoreWave::RefractionDippingModel::fromStream(), QGpCoreWave::Seismic1DModel::fromStream(), Distance::fromString(), SciFigs::AbstractNameLine::fromString(), GeopsyCore::GuralpRecords::fromString(), GeopsyCore::MiniSeedRecords::fromString(), QGpCoreTools::StatisticalPoint< numberType >::fromString(), SciFigs::AbstractLine::fromString(), QGpCoreTools::NamedPoint::fromString(), QGpCoreTools::PointND::fromString(), QGpCoreTools::Point2D::fromString(), QGpCoreTools::Complex::fromString(), QGpCoreTools::Point::fromString(), DinverCore::ModelSet::importModelsFromAscii(), GeopsyCore::SubSignalPool::importTable(), nextNumber(), QGpCoreTools::operator>>(), Sample::read(), CurveMaxEntry::readLine(), SPACMaxEntry::readLine(), TFAMaxEntry::readLine(), FKMaxEntry::readLine(), SpacReader::setOptions(), QGpCoreTools::Version::Version(), GeopsyCore::SignalGroup::xml_setProperty(), QGpCompatibility::CompatModalFrequency::xml_setProperty(), and QGpGuiTools::ColorPalette::xml_setProperty().

  {
    TRACE;
    if(!isValid()) return StringSection();
    const QChar * ptrE=_str+_size;
    if(!ptr) ptr=_str;
    if(skipEmpty) {
      while(ptr < ptrE) {
        if(sep.contains(*ptr)) {
          ptr++;
        } else if(*ptr=='\r' || *ptr=='\n') {
          ptr++;
          return StringSection();
        } else {
          break;
        }
      }
    }
    if(ptr < ptrE) {
      StringSection field(ptr, 0);
      while(ptr < ptrE) {
        if(sep.contains(*ptr)) {
          field.setEnd(ptr);
          ptr++;
          return field;
        } else if(*ptr=='\r' || *ptr=='\n') {
          break;
        }
        ptr++;
      }
      // Reached the end of the line or of the string
      field.setEnd(ptr);
      return field;
    } else return StringSection();
  }
bool QGpCoreTools::StringSection::nextLine ( const QChar *&  ptr,
const QString &  sep = defaultSeparators 
) const

Skip all continuous '\n' and '\r' pointed by ptr. If ptr is null, it is set to the beginning of this string. Returns false if the end of string is reached. sep is not null blank fields are also skipped.

References isValid(), and TRACE.

  {
    TRACE;
    if(!isValid()) return false;
    const QChar * ptrE=_str+_size;
    if(!ptr) ptr=_str;
    if(sep.isEmpty()) {
      while(ptr<ptrE) {
        if(*ptr!='\n' && *ptr!='\r') {
          return true;
        }
        ptr++;
      }
    } else {
      while(ptr<ptrE) {
        if(*ptr!='\n' && *ptr!='\r' && !sep.contains(*ptr)) {
          return true;
        }
        ptr++;
      }
    }
    return false;
  }
bool QGpCoreTools::StringSection::nextNumber ( int &  n,
const QChar *&  ptr,
const QString &  sep = defaultSeparators,
bool  skipEmpty = true 
) const

References isValid(), nextField(), toInt(), and TRACE.

Referenced by QGpCoreTools::StatisticalPoint< numberType >::fromString(), and QGpCoreTools::MatrixData< T >::fromString().

  {
    TRACE;
    StringSection s=nextField(ptr, sep, skipEmpty);
    if(s.isValid()) {
      n=s.toInt();
    } else return false;
    return true;
  }
bool QGpCoreTools::StringSection::nextNumber ( double &  n,
const QChar *&  ptr,
const QString &  sep = defaultSeparators,
bool  skipEmpty = true 
) const

References isValid(), nextField(), toDouble(), and TRACE.

  {
    TRACE;
    StringSection s=nextField(ptr, sep, skipEmpty);
    if(s.isValid()) {
      n=s.toDouble();
    } else return false;
    return true;
  }
bool QGpCoreTools::StringSection::nextNumber ( Complex n,
const QChar *&  ptr,
const QString &  sep = defaultSeparators,
bool  skipEmpty = true 
) const

References isValid(), nextField(), QGpCoreTools::Complex::setIm(), QGpCoreTools::Complex::setRe(), toDouble(), and TRACE.

  {
    TRACE;
    StringSection s;
    s=nextField(ptr, sep, skipEmpty);
    if(s.isValid()) {
      n.setRe(s.toDouble());
    } else return false;
    s=nextField(ptr, sep, skipEmpty);
    if(s.isValid()) {
      n.setIm(s.toDouble());
    } else return false;
    return true;
  }
bool QGpCoreTools::StringSection::operator!= ( const QChar *  o) const [inline]

References compare(), and size().

{
  if(_size!=size(o)) return true;
  return compare(o, _str, _size)!=0;
}
bool QGpCoreTools::StringSection::operator!= ( const StringSection o) const [inline]

References compare().

{
  if(_size!=o._size) return true;
  return compare(o._str, _str, _size)!=0;
}
bool QGpCoreTools::StringSection::operator!= ( const QString &  o) const [inline]

References compare().

{
  if(_size!=o.size()) return true;
  return compare(o.data(), _str, _size)!=0;
}
void QGpCoreTools::StringSection::operator++ ( ) [inline]
{_str++;if(_size > 0) _size--;}
void QGpCoreTools::StringSection::operator+= ( int  l) [inline]
{_str += l;if((int) _size >= l) _size -= l; else _size=0;}
void QGpCoreTools::StringSection::operator-- ( ) [inline]
{_str--;_size++;}
bool QGpCoreTools::StringSection::operator< ( const QChar *  o) const [inline]
{return compare(o) < 0;}
bool QGpCoreTools::StringSection::operator< ( const StringSection o) const [inline]
{return compare(o) < 0;}
bool QGpCoreTools::StringSection::operator< ( const QString &  o) const [inline]
{return compare(o) < 0;}
bool QGpCoreTools::StringSection::operator<= ( const QChar *  o) const [inline]
{return compare(o) <= 0;}
bool QGpCoreTools::StringSection::operator<= ( const StringSection o) const [inline]
{return compare(o) <= 0;}
bool QGpCoreTools::StringSection::operator<= ( const QString &  o) const [inline]
{return compare(o) <= 0;}
StringSection & QGpCoreTools::StringSection::operator= ( const StringSection o) [inline]
{
  _str=o._str;
  _size=o._size;
  return *this;
}
bool QGpCoreTools::StringSection::operator== ( const QChar *  o) const [inline]

References compare(), and size().

{
  if(_size!=size(o)) return false;
  return compare(o, _str, _size)==0;
}
bool QGpCoreTools::StringSection::operator== ( const StringSection o) const [inline]

References compare().

{
  if(_size!=o._size) return false;
  return compare(o._str, _str, _size)==0;
}
bool QGpCoreTools::StringSection::operator== ( const QString &  o) const [inline]

References compare().

{
  if(_size!=o.size()) return false;
  return compare(o.data(), _str, _size)==0;
}
bool QGpCoreTools::StringSection::operator> ( const QChar *  o) const [inline]
{return compare(o) > 0;}
bool QGpCoreTools::StringSection::operator> ( const StringSection o) const [inline]
{return compare(o) > 0;}
bool QGpCoreTools::StringSection::operator> ( const QString &  o) const [inline]
{return compare(o) > 0;}
bool QGpCoreTools::StringSection::operator>= ( const QChar *  o) const [inline]
{return compare(o) >= 0;}
bool QGpCoreTools::StringSection::operator>= ( const StringSection o) const [inline]
{return compare(o) >= 0;}
bool QGpCoreTools::StringSection::operator>= ( const QString &  o) const [inline]
{return compare(o) >= 0;}
QChar QGpCoreTools::StringSection::operator[] ( int  i) const [inline]
{return _str[ i ];}

Returns the line starting at ptr as a StringSection excluding termination characters. If ptr is null, it is set to the beginning of this string. An invalid StringSection is returned if the end of this string is reached.

References isValid(), null, setEnd(), and TRACE.

Referenced by QGpCoreTools::operator>>(), and SciFigs::CircleViewer::xml_setProperty().

  {
    TRACE;
    if(!isValid()) return StringSection::null;
    const QChar * ptrE=_str+_size;
    if(ptr==ptrE) {
      return StringSection::null;
    }
    if(!ptr) ptr=_str;
    StringSection l(ptr, 0);
    while(ptr<ptrE) {
      if(*ptr=='\n' || *ptr=='\r') {
        l.setEnd(ptr);
        // Jump ptr across empty lines
        while(ptr<ptrE) {
          if(*ptr!='\n' && *ptr!='\r') {
            break;
          }
          ptr++;
        }
        return l;
      }
      ptr++;
    }
    return l;
  }

References StringSection().

{
  if(n>_size) n=_size;
  return StringSection(_str+_size-n, n);
}
void QGpCoreTools::StringSection::set ( const QString &  s) [inline]
void QGpCoreTools::StringSection::set ( const QChar *  s,
int  size 
) [inline]
{_str=s; _size=size;}
void QGpCoreTools::StringSection::setEnd ( const QChar *  e) [inline]
{_str=0; _size=0;}
void QGpCoreTools::StringSection::setSize ( int  size) [inline]
{_size=size;}
void QGpCoreTools::StringSection::shrink ( int  nChar) [inline]
{if(nChar>=_size) _size=0; else _size-=nChar;}
int QGpCoreTools::StringSection::size ( ) const [inline]
int QGpCoreTools::StringSection::size ( const QChar *  str) [static]

Returns the length of the string pointed by str, counting characters until encountering a null character.

References TRACE.

  {
    TRACE;
    int i;
    for(i=0; str[i]!=0; i++) {}
    return i;
  }
bool QGpCoreTools::StringSection::to ( bool  ,
bool *  ok = 0 
) const [inline]
{return toBool(ok);}
QString QGpCoreTools::StringSection::to ( QString  ) const [inline]
{return toString();}
int QGpCoreTools::StringSection::to ( int  ,
bool *  ok = 0 
) const [inline]
{return toInt(ok);}
uint QGpCoreTools::StringSection::to ( uint  ,
bool *  ok = 0 
) const [inline]
{return toUInt(ok);}
qlonglong QGpCoreTools::StringSection::to ( qlonglong  ,
bool *  ok = 0 
) const [inline]
{return toLongLong(ok);}
double QGpCoreTools::StringSection::to ( double  ,
bool *  ok = 0 
) const [inline]
{return toDouble(ok);}
Complex QGpCoreTools::StringSection::to ( const Complex ,
bool *  ok = 0 
) const [inline]
{return toComplex(ok);}
bool QGpCoreTools::StringSection::toBool ( bool *  ok = 0) const

Converts string to boolean. ok is set to false if string is not 'false' or 'true'. ok is untouched if if no error occur.

Referenced by CurveMaxEntry::readLine(), and QGpCoreTools::LineParser::toBool().

  {
    if(_size>=1) {
      switch(_str[0].unicode()) {
      case 't':
        if(*this=="true") {
          return true;
        }
        break;
      case 'f':
        if(*this=="false") {
          return false;
        }
        break;
      default:
        break;
      }
    }
    if(ok) *ok=false;
    return true;
  }

References QGpCoreTools::Complex::fromString().

{
  Complex c;
  c.fromString(*this);
  return c;
}
Complex QGpCoreTools::StringSection::toComplex ( bool *  ok) const [inline]

References QGpCoreTools::Complex::fromString().

{
  Complex c;
  bool tok=c.fromString(*this);
  if(ok) *ok=tok;
  return c;
}
double QGpCoreTools::StringSection::toDouble ( bool *  ok = 0) const
int QGpCoreTools::StringSection::toInt ( bool *  ok = 0,
int  base = 10 
) const

Converts string to integer. ok is set to false if string is not an integer. ok is untouched if if no error occur.

References toString().

Referenced by QGpCoreTools::DateTimeFromString::d_parsed(), QGpCoreTools::DateTimeFromString::dd_parsed(), QGpCoreWave::Resistivity1DModel::fromStream(), QGpCoreWave::RefractionDippingModel::fromStream(), QGpCoreWave::Seismic1DModel::fromStream(), GeopsyCore::GuralpRecords::fromString(), GeopsyCore::MiniSeedRecords::fromString(), QGpCoreTools::DateTimeFromString::h_parsed(), QGpCoreTools::DateTimeFromString::H_parsed(), QGpCoreTools::DateTimeFromString::hh_parsed(), QGpCoreTools::DateTimeFromString::HH_parsed(), QGpCoreTools::DateTimeFromString::M_parsed(), QGpCoreTools::DateTimeFromString::m_parsed(), QGpCoreTools::DateTimeFromString::MM_parsed(), QGpCoreTools::DateTimeFromString::mm_parsed(), nextNumber(), SPACMaxEntry::readLine(), TFAMaxEntry::readLine(), FKMaxEntry::readLine(), QGpCoreTools::DateTimeFromString::s_parsed(), QGpCoreTools::DateTimeFromString::ss_parsed(), QGpCoreTools::DateTimeFromString::ssz_parsed(), QGpCoreTools::DateTimeFromString::sz_parsed(), QGpCoreTools::LineParser::toInt(), QGpCoreTools::Version::Version(), GeopsyCore::SignalGroup::xml_setProperty(), QGpCoreTools::DateTimeFromString::yy_parsed(), QGpCoreTools::DateTimeFromString::yyyy_parsed(), QGpCoreTools::DateTimeFromString::z_parsed(), and QGpCoreTools::DateTimeFromString::zzz_parsed().

  {
    if(ok && *ok) {
      return toString().toInt(ok, base);
    } else {
      return toString().toInt(0, base);
    }
  }
qlonglong QGpCoreTools::StringSection::toLongLong ( bool *  ok = 0,
int  base = 10 
) const

Converts string to long long. ok is set to false if string is not a long long. ok is untouched if if no error occur.

References toString().

Referenced by QGpCoreTools::LineParser::toLongLong().

  {
    if(ok && *ok) {
      return toString().toLongLong(ok, base);
    } else {
      return toString().toLongLong(0, base);
    }
  }
QString QGpCoreTools::StringSection::toString ( ) const [inline]

Referenced by QGpCoreTools::DateTimeFromString::ap_parsed(), QGpCoreTools::DateTimeFromString::AP_parsed(), QGpCoreTools::DateTimeFromString::d_parsed(), QGpCoreTools::DateTimeFromString::dd_parsed(), QGpCoreTools::DateTimeFromString::ddd_parsed(), QGpCoreTools::DateTimeFromString::dddd_parsed(), QGpCoreWave::RefractionDippingModel::fromStream(), QGpCoreWave::Seismic1DModel::fromStream(), Distance::fromString(), SciFigs::AbstractNameLine::fromString(), QGpCoreTools::NamedPoint::fromString(), QGpCoreTools::DateTimeFromString::h_parsed(), QGpCoreTools::DateTimeFromString::H_parsed(), QGpCoreTools::DateTimeFromString::hh_parsed(), QGpCoreTools::DateTimeFromString::HH_parsed(), GeopsyCore::SubSignalPool::importTable(), QGpCoreTools::DateTimeFromString::M_parsed(), QGpCoreTools::DateTimeFromString::m_parsed(), QGpCoreTools::DateTimeFromString::MM_parsed(), QGpCoreTools::DateTimeFromString::mm_parsed(), QGpCoreTools::DateTimeFromString::MMM_parsed(), QGpCoreTools::DateTimeFromString::MMMM_parsed(), QGpCoreTools::DateTimeFromString::other_parsed(), QGpCoreTools::XMLParser::parse(), QGpCoreTools::DateTimeFromString::quote_parsed(), QGpCoreTools::DateTimeToString::quote_parsed(), QGpCoreTools::DateTimeFromString::s_parsed(), SciFigs::Axis::setStringLabels(), QGpCoreTools::DateTimeFromString::ss_parsed(), QGpCoreTools::DateTimeFromString::ssz_parsed(), QGpCoreTools::DateTimeFromString::sz_parsed(), toDouble(), toInt(), toLongLong(), QGpCoreTools::LineParser::toString(), toUInt(), QGpCoreTools::Version::Version(), GeopsyGui::TimeWindow::xml_setAttributes(), GeopsyCore::TimeRangeParameters::xml_setAttributes(), QGpGuiTools::ColorPalette::xml_setProperty(), SciFigs::CircleViewer::xml_setProperty(), QGpCoreTools::DateTimeFromString::yy_parsed(), QGpCoreTools::DateTimeFromString::yyyy_parsed(), QGpCoreTools::DateTimeFromString::z_parsed(), and QGpCoreTools::DateTimeFromString::zzz_parsed().

{return isValid() ? QString(_str, _size) : QString::null;}
uint QGpCoreTools::StringSection::toUInt ( bool *  ok = 0,
int  base = 10 
) const

Converts string to unsinged integer. ok is set to false if string is not an unsinged integer. ok is untouched if if no error occur.

References toString().

Referenced by QGpCoreTools::LineParser::toUInt().

  {
    if(ok && *ok) {
      return toString().toUInt(ok, base);
    } else {
      return toString().toUInt(0, base);
    }
  }

Removes white space at the end and at the beginning.

References isValid(), and TRACE.

Referenced by QGpCoreWave::Resistivity1DModel::fromStream(), QGpCoreWave::RefractionDippingModel::fromStream(), QGpCoreWave::Seismic1DModel::fromStream(), and QGpCoreTools::operator>>().

  {
    TRACE;
    if( !isValid()) return *this;
    const QChar * ptrE=_str + _size;
    while(_str < ptrE) {
      if( !_str->isSpace()) break;
      _str++;
    }
    while(_str < ptrE) {
      ptrE--;
      if( !ptrE->isSpace()) {
        ptrE++;
        break;
      }
    }
    if(_str < ptrE) _size=ptrE - _str; else _size=0;
    return *this;
  }

Member Data Documentation

const QString QGpCoreTools::StringSection::defaultSeparators = "\t " [static]

Default separators inside a line: tab and space

Referenced by QGpCoreTools::LineParser::LineParser().

Default static null string

Referenced by QGpCoreTools::LineParser::count(), mid(), and readLine().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines