Mercurial > hg > easyhg
annotate statparser.cpp @ 82:b0a90ac84b8b
* Remove unwanted includes
author | Chris Cannam |
---|---|
date | Mon, 22 Nov 2010 15:30:39 +0000 |
parents | 10eb97683aa9 |
children | 89f793fbedda |
rev | line source |
---|---|
Chris@74 | 1 #include "statparser.h" |
Chris@74 | 2 |
Chris@74 | 3 #include <QMap> |
Chris@74 | 4 |
Chris@74 | 5 StatParser::StatParser(QString text) |
Chris@74 | 6 { |
Chris@74 | 7 text.replace("\r\n", "\n"); |
Chris@74 | 8 |
Chris@74 | 9 QMap<QChar, QStringList *> buckets; |
Chris@74 | 10 buckets['M'] = &modified; |
Chris@74 | 11 buckets['A'] = &added; |
Chris@74 | 12 buckets['R'] = &removed; |
Chris@74 | 13 buckets['!'] = &missing; |
Chris@74 | 14 buckets['?'] = &unknown; |
Chris@74 | 15 |
Chris@74 | 16 QStringList lines = text.split("\n", QString::SkipEmptyParts); |
Chris@74 | 17 foreach (QString line, lines) { |
Chris@74 | 18 if (line.length() < 3 || line[2] != ' ') continue; |
Chris@74 | 19 QChar tag = line[0]; |
Chris@74 | 20 QString file = line.right(line.length() - 2); |
Chris@74 | 21 if (buckets.contains(tag)) { |
Chris@74 | 22 buckets[tag]->push_back(file); |
Chris@74 | 23 } |
Chris@74 | 24 } |
Chris@74 | 25 } |