- QString firstLineContent(stream.readLine());
- eventFile.seek(0);
- if(firstLineContent.length() > 0)
- {
- // Count the non-alphanumeric characters used
- QHash<QChar, uint> counts;
- foreach(const QChar c, firstLineContent)
- ++counts[c];
-
- QList<QPair<QChar, uint> > orderedCounts;
- orderedCounts.reserve(counts.size());
- foreach(const QChar c, counts.keys())
- if(!QChar(c).isLetterOrNumber())
- orderedCounts.append(QPair<QChar, uint>(c, counts.value(c)));
-
- qSort(orderedCounts.begin(), orderedCounts.end(), SortByValueDesc());
-
- // Work around Q_FOREACH macro limitation when dealing with
- // multi-typed templates (comma issue)
- typedef QPair<QChar, uint> bodge;
- foreach(bodge count, orderedCounts)
- qDebug() << count.first << " = " << count.second;
-
- QChar delim;
- // No-one would be mad enough to use quotation marks or apostrophes
- // as their delimiter,but just in case, check the second most
- // frequent character is present thr right number of times for
- // the qutation marks to be present on every column heading (two
- // per heading, less one as they're seperators)
- if((orderedCounts.value(0).first == '"' || orderedCounts.value(0).first == '\'')
- && ((orderedCounts.value(0).second / 2) - 1 == orderedCounts.value(1).second ))
- {
- // We're good.
- delim = orderedCounts.value(1).first;
- }
- else
- delim = orderedCounts.value(0).first;
+ // If we found all of the required headings, continue
+ if(eventsReader.HasRequiredHeadings(QStringList() << "EType" << "ETime"<< "Remote" << "Direction" << "Status" << "Duration" << "Number" << "Data").count() == 0)
+ return new EventParsers::CSVSymbianEventLogParser(currentSettings, eventFile.fileName()/*, delim, numColumnsPerRecord, headingPositions*/);
+ else
+ return NULL;
+}