[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kst/portto4/kst/src/datasources/ascii
From: Peter Kümmel <syntheticpp () gmx ! net>
Date: 2012-10-24 21:13:56
Message-ID: 20121024211356.D042DAC854 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1322266 by kuemmel:
accept one space in time string (use two columns)
M +11 -2 kst_atof.cpp
M +1 -0 kst_atof.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/kst_atof.cpp #1322265:1322266
@@ -188,20 +188,29 @@
//-------------------------------------------------------------------------------------------
void LexicalCast::setTimeFormat(const QString& format)
{
- _timeFormat = format;
+ _timeFormat = format.trimmed(); // remove space at start/end
_isTime = !format.isEmpty();
_timeWithDate = format.contains("d") || format.contains("M") || format.contains("y");
+ if (_timeWithDate) {
+ _timeInTwoColumns = _timeFormat.contains(' ');
}
+}
//-------------------------------------------------------------------------------------------
double LexicalCast::fromTime(const char* p) const
{
int maxScan = 100;
int end = 0;
- for (; *(p + end) != ' ' && *(p + end) != '\t'; end++) {
+ int columnEnd = _timeInTwoColumns ? 2 : 1;
+ int inCol = 0;
+ for (; inCol != columnEnd; end++) {
+ if (*(p + end) == ' ' || *(p + end) == '\t') {
+ inCol++;
+ }
if (end > maxScan)
return Kst::NOPOINT;
}
+ end--;
const QString time = QString::fromLatin1(p, end);
double sec = Kst::NOPOINT;
--- branches/work/kst/portto4/kst/src/datasources/ascii/kst_atof.h #1322265:1322266
@@ -52,6 +52,7 @@
QString _timeFormat;
bool _isTime;
bool _timeWithDate;
+ bool _timeInTwoColumns;
void resetLocal();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic