svcore  1.9
CSVFileReader Class Reference

#include <CSVFileReader.h>

Inheritance diagram for CSVFileReader:
Collaboration diagram for CSVFileReader:

List of all members.

Public Member Functions

 CSVFileReader (QString path, CSVFormat format, int mainModelSampleRate)
virtual ~CSVFileReader ()
virtual bool isOK () const
 Return true if the file appears to be of the correct type.
virtual QString getError () const
virtual Modelload () const
 Read the file and return the corresponding data model.

Protected Member Functions

int convertTimeValue (QString, int lineno, int sampleRate, int windowSize) const

Protected Attributes

CSVFormat m_format
QFile * m_file
QString m_error
int m_warnings
int m_mainModelSampleRate

Detailed Description

Definition at line 28 of file CSVFileReader.h.


Constructor & Destructor Documentation

CSVFileReader::CSVFileReader ( QString  path,
CSVFormat  format,
int  mainModelSampleRate 
)

Definition at line 37 of file CSVFileReader.cpp.

References m_error, and m_file.

Definition at line 61 of file CSVFileReader.cpp.

References m_file, and SVDEBUG.


Member Function Documentation

bool CSVFileReader::isOK ( ) const [virtual]

Return true if the file appears to be of the correct type.

The DataFileReader will be constructed by passing a file path to its constructor. If the file can at that time be determined to be not of a type that this reader can read, it should return false in response to any subsequent call to isOK().

If the file is apparently of the correct type, isOK() should return true; if it turns out that the file cannot after all be read (because it's corrupted or the detection misfired), then the read() function may return NULL.

Implements DataFileReader.

Definition at line 73 of file CSVFileReader.cpp.

References m_file.

QString CSVFileReader::getError ( ) const [virtual]

Reimplemented from DataFileReader.

Definition at line 79 of file CSVFileReader.cpp.

References m_error.

Model * CSVFileReader::load ( ) const [virtual]

Read the file and return the corresponding data model.

This function is not expected to be thread-safe or reentrant. This function may be interactive (i.e. it's permitted to pop up dialogs and windows and ask the user to specify any details that can't be automatically extracted from the file).

Return NULL if the file cannot be parsed at all (although it's preferable to return a partial model and warn the user).

Caller owns the returned model and must delete it after use.

Implements DataFileReader.

Definition at line 131 of file CSVFileReader.cpp.

References SparseValueModel< PointType >::addPoint(), SparseModel< PointType >::addPoint(), RegionModel::addPoint(), CSVFormat::ColumnDuration, CSVFormat::ColumnEndTime, CSVFormat::ColumnLabel, CSVFormat::ColumnPitch, CSVFormat::ColumnStartTime, CSVFormat::ColumnUnknown, CSVFormat::ColumnValue, convertTimeValue(), SparseValueModel< PointType >::deletePoint(), RegionRec::duration, CSVFormat::ExplicitTiming, RegionRec::frame, CSVFormat::getAllowQuoting(), CSVFormat::getColumnCount(), CSVFormat::getColumnPurpose(), CSVFormat::getModelType(), IntervalModel< PointType >::getPoints(), CSVFormat::getSampleRate(), CSVFormat::getSeparator(), CSVFormat::getTimeUnits(), CSVFormat::getTimingType(), CSVFormat::getWindowSize(), CSVFormat::ImplicitTiming, RegionRec::label, m_file, m_format, m_mainModelSampleRate, EditableDenseThreeDimensionalModel::NoCompression, CSVFormat::OneDimensionalModel, EditableDenseThreeDimensionalModel::setColumn(), EditableDenseThreeDimensionalModel::setMaximumLevel(), EditableDenseThreeDimensionalModel::setMinimumLevel(), EditableDenseThreeDimensionalModel::setResolution(), SparseValueModel< PointType >::setScaleUnits(), EditableDenseThreeDimensionalModel::setStartFrame(), StringBits::split(), CSVFormat::ThreeDimensionalModel, CSVFormat::TimeSeconds, CSVFormat::TwoDimensionalModel, CSVFormat::TwoDimensionalModelWithDuration, and CSVFormat::TwoDimensionalModelWithDurationAndPitch.

int CSVFileReader::convertTimeValue ( QString  s,
int  lineno,
int  sampleRate,
int  windowSize 
) const [protected]

Member Data Documentation

Definition at line 39 of file CSVFileReader.h.

Referenced by convertTimeValue(), and load().

QFile* CSVFileReader::m_file [protected]

Definition at line 40 of file CSVFileReader.h.

Referenced by CSVFileReader(), isOK(), load(), and ~CSVFileReader().

QString CSVFileReader::m_error [protected]

Definition at line 41 of file CSVFileReader.h.

Referenced by CSVFileReader(), and getError().

int CSVFileReader::m_warnings [mutable, protected]

Definition at line 42 of file CSVFileReader.h.

Referenced by convertTimeValue().

Definition at line 43 of file CSVFileReader.h.

Referenced by load().


The documentation for this class was generated from the following files: