Mercurial > hg > svcore
comparison data/fileio/CSVFormat.h @ 392:183ee2a55fc7
* More work to abstract out interactive components used in the data library,
so that it does not need to depend on QtGui.
author | Chris Cannam |
---|---|
date | Fri, 14 Mar 2008 17:14:21 +0000 |
parents | |
children | 001db550bd48 |
comparison
equal
deleted
inserted
replaced
391:5858cc462d0a | 392:183ee2a55fc7 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 This file copyright 2006 Chris Cannam. | |
8 | |
9 This program is free software; you can redistribute it and/or | |
10 modify it under the terms of the GNU General Public License as | |
11 published by the Free Software Foundation; either version 2 of the | |
12 License, or (at your option) any later version. See the file | |
13 COPYING included with this distribution for more information. | |
14 */ | |
15 | |
16 #ifndef _CSV_FORMAT_H_ | |
17 #define _CSV_FORMAT_H_ | |
18 | |
19 #include <QString> | |
20 #include <QStringList> | |
21 | |
22 class CSVFormat | |
23 { | |
24 public: | |
25 enum ModelType { | |
26 OneDimensionalModel, | |
27 TwoDimensionalModel, | |
28 ThreeDimensionalModel | |
29 }; | |
30 | |
31 enum TimingType { | |
32 ExplicitTiming, | |
33 ImplicitTiming | |
34 }; | |
35 | |
36 enum TimeUnits { | |
37 TimeSeconds, | |
38 TimeAudioFrames, | |
39 TimeWindows | |
40 }; | |
41 | |
42 CSVFormat(QString path); // guess format | |
43 | |
44 CSVFormat() : // arbitrary defaults | |
45 m_modelType(TwoDimensionalModel), | |
46 m_timingType(ExplicitTiming), | |
47 m_timeUnits(TimeSeconds), | |
48 m_separator(","), | |
49 m_sampleRate(44100), | |
50 m_windowSize(1024), | |
51 m_behaviour(QString::KeepEmptyParts) | |
52 { } | |
53 | |
54 ModelType getModelType() const { return m_modelType; } | |
55 TimingType getTimingType() const { return m_timingType; } | |
56 TimeUnits getTimeUnits() const { return m_timeUnits; } | |
57 QString getSeparator() const { return m_separator; } | |
58 size_t getSampleRate() const { return m_sampleRate; } | |
59 size_t getWindowSize() const { return m_windowSize; } | |
60 | |
61 QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } | |
62 | |
63 void setModelType(ModelType t) { m_modelType = t; } | |
64 void setTimingType(TimingType t) { m_timingType = t; } | |
65 void setTimeUnits(TimeUnits t) { m_timeUnits = t; } | |
66 void setSeparator(QString s) { m_separator = s; } | |
67 void setSampleRate(size_t r) { m_sampleRate = r; } | |
68 void setWindowSize(size_t s) { m_windowSize = s; } | |
69 | |
70 void setSplitBehaviour(QString::SplitBehavior b) { m_behaviour = b; } | |
71 | |
72 // only valid if constructor that guesses format was used: | |
73 QList<QStringList> getExample() const { return m_example; } | |
74 int getMaxExampleCols() const { return m_maxExampleCols; } | |
75 | |
76 protected: | |
77 ModelType m_modelType; | |
78 TimingType m_timingType; | |
79 TimeUnits m_timeUnits; | |
80 QString m_separator; | |
81 size_t m_sampleRate; | |
82 size_t m_windowSize; | |
83 | |
84 QString::SplitBehavior m_behaviour; | |
85 | |
86 QList<QStringList> m_example; | |
87 int m_maxExampleCols; | |
88 }; | |
89 | |
90 #endif |