@@ -20,19 +20,28 const auto FILE_NOT_FOUND_MESSAGE = QStringLiteral("Not Found"); | |||
|
20 | 20 | /// Separator between values in a result line |
|
21 | 21 | const auto RESULT_LINE_SEPARATOR = QRegularExpression{QStringLiteral("\\s+")}; |
|
22 | 22 | |
|
23 | /// Regex to find the header of the data in the file. This header indicates the end of comments in | |
|
24 | /// the file | |
|
25 | const auto DATA_HEADER_REGEX = QRegularExpression{QStringLiteral("#\\s*DATA\\s*:")}; | |
|
23 | // AMDA V2 | |
|
24 | // /// Regex to find the header of the data in the file. This header indicates the end of comments | |
|
25 | // in | |
|
26 | // /// the file | |
|
27 | // const auto DATA_HEADER_REGEX = QRegularExpression{QStringLiteral("#\\s*DATA\\s*:")}; | |
|
26 | 28 | |
|
27 | 29 | /// Format for dates in result files |
|
28 | 30 | const auto DATE_FORMAT = QStringLiteral("yyyy-MM-ddThh:mm:ss.zzz"); |
|
29 | 31 | |
|
30 | /// Regex to find unit in a line. Examples of valid lines: | |
|
31 | /// ... PARAMETER_UNITS : nT ... | |
|
32 | /// ... PARAMETER_UNITS:nT ... | |
|
33 |
/// ... PARAMETER_UNITS: |
|
|
34 |
/// ... PARAMETER_UNITS |
|
|
35 | const auto UNIT_REGEX = QRegularExpression{QStringLiteral("\\s*PARAMETER_UNITS\\s*:\\s*(.+)")}; | |
|
32 | // AMDA V2 | |
|
33 | // /// Regex to find unit in a line. Examples of valid lines: | |
|
34 | // /// ... PARAMETER_UNITS : nT ... | |
|
35 | // /// ... PARAMETER_UNITS:nT ... | |
|
36 | // /// ... PARAMETER_UNITS: m² ... | |
|
37 | // /// ... PARAMETER_UNITS : m/s ... | |
|
38 | // const auto UNIT_REGEX = QRegularExpression{QStringLiteral("\\s*PARAMETER_UNITS\\s*:\\s*(.+)")}; | |
|
39 | ||
|
40 | /// ... - Units : nT - ... | |
|
41 | /// ... -Units:nT- ... | |
|
42 | /// ... -Units: m²- ... | |
|
43 | /// ... - Units : m/s - ... | |
|
44 | const auto UNIT_REGEX = QRegularExpression{QStringLiteral("-\\s*Units\\s*:\\s*(.+?)\\s*-")}; | |
|
36 | 45 | |
|
37 | 46 | QDateTime dateTimeFromString(const QString &stringDate) noexcept |
|
38 | 47 | { |
@@ -90,7 +99,8 Unit readXAxisUnit(QTextStream &stream) | |||
|
90 | 99 | QString line{}; |
|
91 | 100 | |
|
92 | 101 | // Searches unit in the comment lines (as long as the reading has not reached the data header) |
|
93 | while (stream.readLineInto(&line) && !line.contains(DATA_HEADER_REGEX)) { | |
|
102 | // AMDA V2: while (stream.readLineInto(&line) && !line.contains(DATA_HEADER_REGEX)) { | |
|
103 | while (stream.readLineInto(&line) && isCommentLine(line)) { | |
|
94 | 104 | auto match = UNIT_REGEX.match(line); |
|
95 | 105 | if (match.hasMatch()) { |
|
96 | 106 | return Unit{match.captured(1), true}; |
@@ -203,6 +213,8 std::shared_ptr<IDataSeries> AmdaResultParser::readTxt(const QString &filePath, | |||
|
203 | 213 | auto xAxisUnit = readXAxisUnit(stream); |
|
204 | 214 | |
|
205 | 215 | // Reads results |
|
216 | // AMDA V2: remove line | |
|
217 | stream.seek(0); // returns to the beginning of the file | |
|
206 | 218 | auto results = readResults(stream, valueType); |
|
207 | 219 | |
|
208 | 220 | // Creates data series |
General Comments 0
You need to be logged in to leave comments.
Login now