All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Public Member Functions
QGpCoreTools::LineParser Class Reference

Brief description of class still missing. More...

#include <LineParser.h>

List of all members.

Public Member Functions

int count ()
const QString & delimiters () const
int endsAt (int index, bool &ok)
 LineParser ()
 LineParser (const QString &str)
 LineParser (const StringSection &str)
void setDelimiters (const QString &d)
void setSkipEmpty (bool s)
void setString (const QString &str)
void setString (const StringSection &str)
bool skipEmpty () const
int startsAt (int index, bool &ok)
bool toBool (int index, bool &ok)
double toDouble (int index, bool &ok)
int toInt (int index, bool &ok, int base=10)
qlonglong toLongLong (int index, bool &ok, int base=10)
QString toString (int index, bool &ok)
QString toString (int indexBegin, int indexEnd, bool &ok)
uint toUInt (int index, bool &ok, int base=10)
const StringSectionvalue (int index)
 ~LineParser ()

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

Description of constructor still missing

References QGpCoreTools::StringSection::defaultSeparators, and TRACE.

  {
    TRACE;
    _ptr=0;
    _delimiters=StringSection::defaultSeparators;
    _skipEmpty=true;
  }
QGpCoreTools::LineParser::LineParser ( const QString &  str)

Description of constructor still missing

References QGpCoreTools::StringSection::defaultSeparators, QGpCoreTools::StringSection::set(), str, and TRACE.

  {
    TRACE;
    _str=str;
    _strSection.set(_str);
    _ptr=0;
    _delimiters=StringSection::defaultSeparators;
    _skipEmpty=true;
  }

Description of constructor still missing

References QGpCoreTools::StringSection::defaultSeparators, str, and TRACE.

  {
    TRACE;
    _strSection=str;
    _ptr=0;
    _delimiters=StringSection::defaultSeparators;
    _skipEmpty=true;
  }
{}

Member Function Documentation

Parses all and returns number of items

References QGpCoreTools::StringSection::null, and TRACE.

Referenced by SciFigs::CircleViewer::add(), HeaderMap::map(), CoordReader::parse(), Acquisition::read(), CoordReader::setOptions(), and GeopsyCore::WindowingParameters::setValue().

  {
    TRACE;
    int index=_values.count();
    while(parse(index)!=StringSection::null) {
      index++;
    }
    return _values.count();
  }
const QString& QGpCoreTools::LineParser::delimiters ( ) const [inline]
{return _delimiters;}
int QGpCoreTools::LineParser::endsAt ( int  index,
bool &  ok 
)

Returns the last character index of column index.

References QGpCoreTools::StringSection::data(), QGpCoreTools::StringSection::isValid(), QGpCoreTools::StringSection::size(), TRACE, and value().

Referenced by TimeReader::parse().

  {
    TRACE;
    const StringSection& v=value(index);
    if(v.isValid()) {
      return v.data()-_strSection.data()+v.size()-1;
    } else {
      ok=false;
      return 0;
    }
  }
void QGpCoreTools::LineParser::setDelimiters ( const QString &  d) [inline]
void QGpCoreTools::LineParser::setSkipEmpty ( bool  s) [inline]
void QGpCoreTools::LineParser::setString ( const QString &  str)

References str, and TRACE.

  {
    TRACE;
    _strSection=str;
    _values.clear();
    _ptr=0;
  }
bool QGpCoreTools::LineParser::skipEmpty ( ) const [inline]
{return _skipEmpty;}
int QGpCoreTools::LineParser::startsAt ( int  index,
bool &  ok 
)

Returns the first character index of column index.

References QGpCoreTools::StringSection::data(), QGpCoreTools::StringSection::isValid(), TRACE, and value().

Referenced by TimeReader::parse().

  {
    TRACE;
    const StringSection& v=value(index);
    if(v.isValid()) {
      return v.data()-_strSection.data();
    } else {
      ok=false;
      return 0;
    }
  }
bool QGpCoreTools::LineParser::toBool ( int  index,
bool &  ok 
) [inline]

References QGpCoreTools::StringSection::isValid(), QGpCoreTools::StringSection::toBool(), and value().

{
  const StringSection& v=value(index);
  if(v.isValid()) {
    return v.toBool();
  } else {
    ok=false;
    return true;
  }
}
double QGpCoreTools::LineParser::toDouble ( int  index,
bool &  ok 
) [inline]
int QGpCoreTools::LineParser::toInt ( int  index,
bool &  ok,
int  base = 10 
) [inline]

References QGpCoreTools::StringSection::toInt(), and value().

Referenced by SciFigs::CircleViewer::add().

{
  if(ok) {
    return value(index).toInt(&ok, base);
  } else {
    return 0;
  }
}
qlonglong QGpCoreTools::LineParser::toLongLong ( int  index,
bool &  ok,
int  base = 10 
) [inline]

References QGpCoreTools::StringSection::toLongLong(), and value().

{
  if(ok) {
    return value(index).toLongLong(&ok, base);
  } else {
    return 0;
  }
}
QString QGpCoreTools::LineParser::toString ( int  index,
bool &  ok 
) [inline]
QString QGpCoreTools::LineParser::toString ( int  indexBegin,
int  indexEnd,
bool &  ok 
)

Returns all available columns between indexBegin and indexEnd. ok is set to false only if no column is available.

References QGpCoreTools::StringSection::begin(), QGpCoreTools::StringSection::end(), QGpCoreTools::StringSection::isValid(), toString(), and value().

  {
    const StringSection& vBegin=value(indexBegin);
    if(!vBegin.isValid()) {
      ok=false;
      return QString::null;
    }
    const StringSection& vEnd=value(indexEnd);
    if(vEnd.isValid()) {
      return StringSection(vBegin.begin(), vEnd.end()).toString();
    } else {
      return StringSection(vBegin.begin(), _values.last().end()).toString();
    }
  }
uint QGpCoreTools::LineParser::toUInt ( int  index,
bool &  ok,
int  base = 10 
) [inline]

References QGpCoreTools::StringSection::toUInt(), and value().

{
  if(ok) {
    return value(index).toUInt(&ok, base);
  } else {
    return 0;
  }
}
const StringSection & QGpCoreTools::LineParser::value ( int  index) [inline]

Referenced by endsAt(), startsAt(), toBool(), toDouble(), toInt(), toLongLong(), toString(), and toUInt().

{
  if(index<_values.count()) return _values.at(index);
  return parse(index);
}

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