svcore  1.9
CSVFormat Class Reference

#include <CSVFormat.h>

Public Types

enum  ModelType {
  OneDimensionalModel, TwoDimensionalModel, TwoDimensionalModelWithDuration, TwoDimensionalModelWithDurationAndPitch,
  ThreeDimensionalModel
}
 
enum  TimingType { ExplicitTiming, ImplicitTiming }
 
enum  TimeUnits { TimeSeconds, TimeAudioFrames, TimeWindows }
 
enum  ColumnPurpose {
  ColumnUnknown, ColumnStartTime, ColumnEndTime, ColumnDuration,
  ColumnValue, ColumnPitch, ColumnLabel
}
 
enum  ColumnQuality { ColumnNumeric = 0x1, ColumnIntegral = 0x2, ColumnIncreasing = 0x4, ColumnLarge = 0x8 }
 
typedef unsigned int ColumnQualities
 

Public Member Functions

 CSVFormat ()
 
 CSVFormat (QString path)
 
void guessFormatFor (QString path)
 Guess the format of the given CSV file, setting the fields in this object accordingly. More...
 
ModelType getModelType () const
 
TimingType getTimingType () const
 
TimeUnits getTimeUnits () const
 
int getSampleRate () const
 
int getWindowSize () const
 
int getColumnCount () const
 
bool getAllowQuoting () const
 
QChar getSeparator () const
 
void setModelType (ModelType t)
 
void setTimingType (TimingType t)
 
void setTimeUnits (TimeUnits t)
 
void setSeparator (QChar s)
 
void setSampleRate (int r)
 
void setWindowSize (int s)
 
void setColumnCount (int c)
 
void setAllowQuoting (bool q)
 
QList< ColumnPurposegetColumnPurposes () const
 
void setColumnPurposes (QList< ColumnPurpose > cl)
 
ColumnPurpose getColumnPurpose (int i)
 
ColumnPurpose getColumnPurpose (int i) const
 
void setColumnPurpose (int i, ColumnPurpose p)
 
QList< ColumnQualitiesgetColumnQualities () const
 
QList< QStringList > getExample () const
 
int getMaxExampleCols () const
 

Protected Member Functions

void guessSeparator (QString line)
 
void guessQualities (QString line, int lineno)
 
void guessPurposes ()
 
void guessFormatFor_Old (QString path)
 

Protected Attributes

ModelType m_modelType
 
TimingType m_timingType
 
TimeUnits m_timeUnits
 
QString m_separator
 
int m_sampleRate
 
int m_windowSize
 
int m_columnCount
 
bool m_variableColumnCount
 
QList< ColumnQualitiesm_columnQualities
 
QList< ColumnPurposem_columnPurposes
 
QList< float > m_prevValues
 
bool m_allowQuoting
 
QList< QStringList > m_example
 
int m_maxExampleCols
 

Detailed Description

Definition at line 22 of file CSVFormat.h.

Member Typedef Documentation

◆ ColumnQualities

typedef unsigned int CSVFormat::ColumnQualities

Definition at line 60 of file CSVFormat.h.

Member Enumeration Documentation

◆ ModelType

Enumerator
OneDimensionalModel 
TwoDimensionalModel 
TwoDimensionalModelWithDuration 
TwoDimensionalModelWithDurationAndPitch 
ThreeDimensionalModel 

Definition at line 25 of file CSVFormat.h.

◆ TimingType

Enumerator
ExplicitTiming 
ImplicitTiming 

Definition at line 33 of file CSVFormat.h.

◆ TimeUnits

Enumerator
TimeSeconds 
TimeAudioFrames 
TimeWindows 

Definition at line 38 of file CSVFormat.h.

◆ ColumnPurpose

Enumerator
ColumnUnknown 
ColumnStartTime 
ColumnEndTime 
ColumnDuration 
ColumnValue 
ColumnPitch 
ColumnLabel 

Definition at line 44 of file CSVFormat.h.

◆ ColumnQuality

Enumerator
ColumnNumeric 
ColumnIntegral 
ColumnIncreasing 
ColumnLarge 

Definition at line 54 of file CSVFormat.h.

Constructor & Destructor Documentation

◆ CSVFormat() [1/2]

CSVFormat::CSVFormat ( )
inline

Definition at line 62 of file CSVFormat.h.

◆ CSVFormat() [2/2]

CSVFormat::CSVFormat ( QString  path)

Definition at line 28 of file CSVFormat.cpp.

References guessFormatFor().

Member Function Documentation

◆ guessFormatFor()

void CSVFormat::guessFormatFor ( QString  path)

Guess the format of the given CSV file, setting the fields in this object accordingly.

If the current separator is the empty string, the separator character will also be guessed; otherwise the current separator will be used. The other properties of this object will be set according to guesses from the file.

Definition at line 38 of file CSVFormat.cpp.

References ExplicitTiming, guessPurposes(), guessQualities(), m_columnCount, m_columnPurposes, m_columnQualities, m_example, m_maxExampleCols, m_modelType, m_prevValues, m_timeUnits, m_timingType, m_variableColumnCount, TimeSeconds, and TwoDimensionalModel.

Referenced by CSVFormat().

◆ getModelType()

ModelType CSVFormat::getModelType ( ) const
inline

Definition at line 86 of file CSVFormat.h.

References m_modelType.

Referenced by CSVFileReader::load().

◆ getTimingType()

TimingType CSVFormat::getTimingType ( ) const
inline

Definition at line 87 of file CSVFormat.h.

References m_timingType.

Referenced by CSVFileReader::load().

◆ getTimeUnits()

TimeUnits CSVFormat::getTimeUnits ( ) const
inline

Definition at line 88 of file CSVFormat.h.

References m_timeUnits.

Referenced by CSVFileReader::convertTimeValue(), and CSVFileReader::load().

◆ getSampleRate()

int CSVFormat::getSampleRate ( ) const
inline

Definition at line 89 of file CSVFormat.h.

References m_sampleRate.

Referenced by CSVFileReader::load().

◆ getWindowSize()

int CSVFormat::getWindowSize ( ) const
inline

Definition at line 90 of file CSVFormat.h.

References m_windowSize.

Referenced by CSVFileReader::load().

◆ getColumnCount()

int CSVFormat::getColumnCount ( ) const
inline

Definition at line 91 of file CSVFormat.h.

References m_columnCount.

Referenced by CSVFileReader::load().

◆ getAllowQuoting()

bool CSVFormat::getAllowQuoting ( ) const
inline

Definition at line 92 of file CSVFormat.h.

References m_allowQuoting.

Referenced by CSVFileReader::load().

◆ getSeparator()

QChar CSVFormat::getSeparator ( ) const
inline

Definition at line 93 of file CSVFormat.h.

References m_separator.

Referenced by CSVFileReader::load().

◆ setModelType()

void CSVFormat::setModelType ( ModelType  t)
inline

Definition at line 98 of file CSVFormat.h.

References m_modelType.

◆ setTimingType()

void CSVFormat::setTimingType ( TimingType  t)
inline

Definition at line 99 of file CSVFormat.h.

References m_timingType.

◆ setTimeUnits()

void CSVFormat::setTimeUnits ( TimeUnits  t)
inline

Definition at line 100 of file CSVFormat.h.

References m_timeUnits.

◆ setSeparator()

void CSVFormat::setSeparator ( QChar  s)
inline

Definition at line 101 of file CSVFormat.h.

References m_separator.

◆ setSampleRate()

void CSVFormat::setSampleRate ( int  r)
inline

Definition at line 102 of file CSVFormat.h.

References m_sampleRate.

◆ setWindowSize()

void CSVFormat::setWindowSize ( int  s)
inline

Definition at line 103 of file CSVFormat.h.

References m_windowSize.

◆ setColumnCount()

void CSVFormat::setColumnCount ( int  c)
inline

Definition at line 104 of file CSVFormat.h.

References m_columnCount.

◆ setAllowQuoting()

void CSVFormat::setAllowQuoting ( bool  q)
inline

Definition at line 105 of file CSVFormat.h.

References m_allowQuoting.

◆ getColumnPurposes()

QList<ColumnPurpose> CSVFormat::getColumnPurposes ( ) const
inline

Definition at line 107 of file CSVFormat.h.

References m_columnPurposes.

◆ setColumnPurposes()

void CSVFormat::setColumnPurposes ( QList< ColumnPurpose cl)
inline

Definition at line 108 of file CSVFormat.h.

References m_columnPurposes.

◆ getColumnPurpose() [1/2]

CSVFormat::ColumnPurpose CSVFormat::getColumnPurpose ( int  i)

Definition at line 303 of file CSVFormat.cpp.

References ColumnUnknown, and m_columnPurposes.

Referenced by CSVFileReader::load().

◆ getColumnPurpose() [2/2]

CSVFormat::ColumnPurpose CSVFormat::getColumnPurpose ( int  i) const

Definition at line 312 of file CSVFormat.cpp.

References ColumnUnknown, and m_columnPurposes.

◆ setColumnPurpose()

void CSVFormat::setColumnPurpose ( int  i,
ColumnPurpose  p 
)

Definition at line 321 of file CSVFormat.cpp.

References ColumnUnknown, and m_columnPurposes.

Referenced by guessPurposes().

◆ getColumnQualities()

QList<ColumnQualities> CSVFormat::getColumnQualities ( ) const
inline

Definition at line 115 of file CSVFormat.h.

References m_columnQualities.

◆ getExample()

QList<QStringList> CSVFormat::getExample ( ) const
inline

Definition at line 118 of file CSVFormat.h.

References m_example.

◆ getMaxExampleCols()

int CSVFormat::getMaxExampleCols ( ) const
inline

Definition at line 119 of file CSVFormat.h.

References m_maxExampleCols.

◆ guessSeparator()

void CSVFormat::guessSeparator ( QString  line)
protected

Definition at line 86 of file CSVFormat.cpp.

References m_allowQuoting, m_separator, and StringBits::split().

Referenced by guessQualities().

◆ guessQualities()

void CSVFormat::guessQualities ( QString  line,
int  lineno 
)
protected

◆ guessPurposes()

◆ guessFormatFor_Old()

void CSVFormat::guessFormatFor_Old ( QString  path)
protected

Member Data Documentation

◆ m_modelType

ModelType CSVFormat::m_modelType
protected

Definition at line 122 of file CSVFormat.h.

Referenced by getModelType(), guessFormatFor(), guessPurposes(), and setModelType().

◆ m_timingType

TimingType CSVFormat::m_timingType
protected

Definition at line 123 of file CSVFormat.h.

Referenced by getTimingType(), guessFormatFor(), guessPurposes(), and setTimingType().

◆ m_timeUnits

TimeUnits CSVFormat::m_timeUnits
protected

Definition at line 124 of file CSVFormat.h.

Referenced by getTimeUnits(), guessFormatFor(), guessPurposes(), and setTimeUnits().

◆ m_separator

QString CSVFormat::m_separator
protected

Definition at line 125 of file CSVFormat.h.

Referenced by getSeparator(), guessQualities(), guessSeparator(), and setSeparator().

◆ m_sampleRate

int CSVFormat::m_sampleRate
protected

Definition at line 126 of file CSVFormat.h.

Referenced by getSampleRate(), and setSampleRate().

◆ m_windowSize

int CSVFormat::m_windowSize
protected

Definition at line 127 of file CSVFormat.h.

Referenced by getWindowSize(), and setWindowSize().

◆ m_columnCount

int CSVFormat::m_columnCount
protected

◆ m_variableColumnCount

bool CSVFormat::m_variableColumnCount
protected

Definition at line 130 of file CSVFormat.h.

Referenced by guessFormatFor(), and guessQualities().

◆ m_columnQualities

QList<ColumnQualities> CSVFormat::m_columnQualities
protected

Definition at line 132 of file CSVFormat.h.

Referenced by getColumnQualities(), guessFormatFor(), guessPurposes(), and guessQualities().

◆ m_columnPurposes

QList<ColumnPurpose> CSVFormat::m_columnPurposes
protected

◆ m_prevValues

QList<float> CSVFormat::m_prevValues
protected

Definition at line 135 of file CSVFormat.h.

Referenced by guessFormatFor(), and guessQualities().

◆ m_allowQuoting

bool CSVFormat::m_allowQuoting
protected

Definition at line 137 of file CSVFormat.h.

Referenced by getAllowQuoting(), guessQualities(), guessSeparator(), and setAllowQuoting().

◆ m_example

QList<QStringList> CSVFormat::m_example
protected

Definition at line 139 of file CSVFormat.h.

Referenced by getExample(), guessFormatFor(), and guessQualities().

◆ m_maxExampleCols

int CSVFormat::m_maxExampleCols
protected

Definition at line 140 of file CSVFormat.h.

Referenced by getMaxExampleCols(), guessFormatFor(), and guessQualities().


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