Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qdatetimeparser.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||
3 | int QDateTimeParser::getDigit(const QDateTime &t, int index) const | - | ||||||||||||||||||||||||||||||||||||
4 | { | - | ||||||||||||||||||||||||||||||||||||
5 | if (index < 0
| 0-3487 | ||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||
7 | QMessageLogger(__FILE__, 70, __PRETTY_FUNCTION__).warning("QDateTimeParser::getDigit() Internal error (%s %d)", | - | ||||||||||||||||||||||||||||||||||||
8 | QString(t.toString()).toLocal8Bit().constData(), index); | - | ||||||||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||||||||
10 | - | |||||||||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||||||||
12 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
13 | } | - | ||||||||||||||||||||||||||||||||||||
14 | const SectionNode &node = sectionNodes.at(index); | - | ||||||||||||||||||||||||||||||||||||
15 | switch (node.type) { | - | ||||||||||||||||||||||||||||||||||||
16 | case executed 419 times by 1 test: Hour24Section:case Hour24Section: Executed by:
executed 419 times by 1 test: casecase Hour24Section: Executed by:
executed 305 times by 2 tests: Hour12Section:case Hour12Section: Executed by:
executed 305 times by 2 tests: returncase Hour12Section: Executed by:
executed 724 times by 2 tests: t.time().hour();return t.time().hour(); Executed by:
executed 724 times by 2 tests: return t.time().hour(); Executed by:
| 305-724 | ||||||||||||||||||||||||||||||||||||
17 | case executed 316 times by 1 test: MinuteSection:case MinuteSection: Executed by:
executed 316 times by 1 test: returncase MinuteSection: Executed by:
executed 316 times by 1 test: t.time().minute();return t.time().minute(); Executed by:
executed 316 times by 1 test: return t.time().minute(); Executed by:
| 316 | ||||||||||||||||||||||||||||||||||||
18 | case executed 299 times by 1 test: SecondSection:case SecondSection: Executed by:
executed 299 times by 1 test: returncase SecondSection: Executed by:
executed 299 times by 1 test: t.time().second();return t.time().second(); Executed by:
executed 299 times by 1 test: return t.time().second(); Executed by:
| 299 | ||||||||||||||||||||||||||||||||||||
19 | case never executed: MSecSection:case MSecSection: never executed: returncase MSecSection: never executed: t.time().msec();return t.time().msec(); never executed: return t.time().msec(); | 0 | ||||||||||||||||||||||||||||||||||||
20 | case executed 566 times by 2 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 566 times by 2 tests: case YearSection2Digits: Executed by:
| 566 | ||||||||||||||||||||||||||||||||||||
21 | case executed 183 times by 1 test: YearSection:case YearSection: Executed by:
executed 183 times by 1 test: returncase YearSection: Executed by:
executed 749 times by 2 tests: t.date().year();return t.date().year(); Executed by:
executed 749 times by 2 tests: return t.date().year(); Executed by:
| 183-749 | ||||||||||||||||||||||||||||||||||||
22 | case executed 159 times by 4 tests: MonthSection:case MonthSection: Executed by:
executed 159 times by 4 tests: returncase MonthSection: Executed by:
executed 159 times by 4 tests: t.date().month();return t.date().month(); Executed by:
executed 159 times by 4 tests: return t.date().month(); Executed by:
| 159 | ||||||||||||||||||||||||||||||||||||
23 | case executed 131 times by 1 test: DaySection:case DaySection: Executed by:
executed 131 times by 1 test: returncase DaySection: Executed by:
executed 131 times by 1 test: t.date().day();return t.date().day(); Executed by:
executed 131 times by 1 test: return t.date().day(); Executed by:
| 131 | ||||||||||||||||||||||||||||||||||||
24 | case executed 90 times by 1 test: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 90 times by 1 test: case DayOfWeekSectionShort: Executed by:
| 90 | ||||||||||||||||||||||||||||||||||||
25 | case executed 1013 times by 1 test: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 1013 times by 1 test: returncase DayOfWeekSectionLong: Executed by:
executed 1103 times by 1 test: t.date().day();return t.date().day(); Executed by:
executed 1103 times by 1 test: return t.date().day(); Executed by:
| 1013-1103 | ||||||||||||||||||||||||||||||||||||
26 | case executed 6 times by 1 test: AmPmSection:case AmPmSection: Executed by:
executed 6 times by 1 test: returncase AmPmSection: Executed by:
executed 6 times by 1 test: t.time().hour() > 11return t.time().hour() > 11 ? 1 : 0; Executed by:
executed 6 times by 1 test: return t.time().hour() > 11 ? 1 : 0; Executed by:
| 2-6 | ||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||
28 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
29 | } | - | ||||||||||||||||||||||||||||||||||||
30 | - | |||||||||||||||||||||||||||||||||||||
31 | - | |||||||||||||||||||||||||||||||||||||
32 | QMessageLogger(__FILE__, 95, __PRETTY_FUNCTION__).warning("QDateTimeParser::getDigit() Internal error 2 (%s %d)", | - | ||||||||||||||||||||||||||||||||||||
33 | QString(t.toString()).toLocal8Bit().constData(), index); | - | ||||||||||||||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||||||||||||||
37 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
38 | } | - | ||||||||||||||||||||||||||||||||||||
39 | bool QDateTimeParser::setDigit(QDateTime &v, int index, int newVal) const | - | ||||||||||||||||||||||||||||||||||||
40 | { | - | ||||||||||||||||||||||||||||||||||||
41 | if (index < 0
| 0-4310 | ||||||||||||||||||||||||||||||||||||
42 | - | |||||||||||||||||||||||||||||||||||||
43 | QMessageLogger(__FILE__, 119, __PRETTY_FUNCTION__).warning("QDateTimeParser::setDigit() Internal error (%s %d %d)", | - | ||||||||||||||||||||||||||||||||||||
44 | QString(v.toString()).toLocal8Bit().constData(), index, newVal); | - | ||||||||||||||||||||||||||||||||||||
45 | - | |||||||||||||||||||||||||||||||||||||
46 | - | |||||||||||||||||||||||||||||||||||||
47 | - | |||||||||||||||||||||||||||||||||||||
48 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
49 | } | - | ||||||||||||||||||||||||||||||||||||
50 | const SectionNode &node = sectionNodes.at(index); | - | ||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||
52 | int year = v.date().year(); | - | ||||||||||||||||||||||||||||||||||||
53 | int month = v.date().month(); | - | ||||||||||||||||||||||||||||||||||||
54 | int day = v.date().day(); | - | ||||||||||||||||||||||||||||||||||||
55 | int hour = v.time().hour(); | - | ||||||||||||||||||||||||||||||||||||
56 | int minute = v.time().minute(); | - | ||||||||||||||||||||||||||||||||||||
57 | int second = v.time().second(); | - | ||||||||||||||||||||||||||||||||||||
58 | int msec = v.time().msec(); | - | ||||||||||||||||||||||||||||||||||||
59 | - | |||||||||||||||||||||||||||||||||||||
60 | switch (node.type) { | - | ||||||||||||||||||||||||||||||||||||
61 | case executed 478 times by 2 tests: Hour24Section:case Hour24Section: Executed by:
executed 478 times by 2 tests: casecase Hour24Section: Executed by:
executed 378 times by 2 tests: Hour12Section:case Hour12Section: Executed by:
executed 378 times by 2 tests: hour = newVal; break;case Hour12Section: Executed by:
executed 856 times by 3 tests: break; Executed by:
| 378-856 | ||||||||||||||||||||||||||||||||||||
62 | case executed 470 times by 1 test: MinuteSection:case MinuteSection: Executed by:
executed 470 times by 1 test: minute = newVal; break;case MinuteSection: Executed by:
executed 470 times by 1 test: break; Executed by:
| 470 | ||||||||||||||||||||||||||||||||||||
63 | case executed 434 times by 1 test: SecondSection:case SecondSection: Executed by:
executed 434 times by 1 test: second = newVal; break;case SecondSection: Executed by:
executed 434 times by 1 test: break; Executed by:
| 434 | ||||||||||||||||||||||||||||||||||||
64 | case executed 36 times by 1 test: MSecSection:case MSecSection: Executed by:
executed 36 times by 1 test: msec = newVal; break;case MSecSection: Executed by:
executed 36 times by 1 test: break; Executed by:
| 36 | ||||||||||||||||||||||||||||||||||||
65 | case executed 565 times by 2 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 565 times by 2 tests: case YearSection2Digits: Executed by:
| 565 | ||||||||||||||||||||||||||||||||||||
66 | case executed 154 times by 1 test: YearSection:case YearSection: Executed by:
executed 154 times by 1 test: year = newVal; break;case YearSection: Executed by:
executed 719 times by 2 tests: break; Executed by:
| 154-719 | ||||||||||||||||||||||||||||||||||||
67 | case executed 241 times by 4 tests: MonthSection:case MonthSection: Executed by:
executed 241 times by 4 tests: month = newVal; break;case MonthSection: Executed by:
executed 241 times by 4 tests: break; Executed by:
| 241 | ||||||||||||||||||||||||||||||||||||
68 | case executed 445 times by 2 tests: DaySection:case DaySection: Executed by:
executed 445 times by 2 tests: case DaySection: Executed by:
| 445 | ||||||||||||||||||||||||||||||||||||
69 | case executed 90 times by 1 test: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 90 times by 1 test: case DayOfWeekSectionShort: Executed by:
| 90 | ||||||||||||||||||||||||||||||||||||
70 | case executed 1013 times by 1 test: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 1013 times by 1 test: case DayOfWeekSectionLong: Executed by:
| 1013 | ||||||||||||||||||||||||||||||||||||
71 | if (newVal > 31
| 0-1548 | ||||||||||||||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||||||||||||||
74 | - | |||||||||||||||||||||||||||||||||||||
75 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
76 | } | - | ||||||||||||||||||||||||||||||||||||
77 | day = newVal; | - | ||||||||||||||||||||||||||||||||||||
78 | break; executed 1548 times by 2 tests: break; Executed by:
| 1548 | ||||||||||||||||||||||||||||||||||||
79 | case executed 6 times by 1 test: AmPmSection:case AmPmSection: Executed by:
executed 6 times by 1 test: hour = (newVal == 0case AmPmSection: Executed by:
executed 6 times by 1 test: break; Executed by:
| 2-6 | ||||||||||||||||||||||||||||||||||||
80 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
81 | QMessageLogger(__FILE__, 157, __PRETTY_FUNCTION__).warning("QDateTimeParser::setDigit() Internal error (%s)", | - | ||||||||||||||||||||||||||||||||||||
82 | QString(node.name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
83 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||||||||||||||
86 | if (!(node.type & DaySectionMask)
| 1548-2762 | ||||||||||||||||||||||||||||||||||||
87 | if (day < cachedDay
| 21-2741 | ||||||||||||||||||||||||||||||||||||
88 | day = cachedDay; executed 21 times by 1 test: day = cachedDay; Executed by:
| 21 | ||||||||||||||||||||||||||||||||||||
89 | const int max = QDate(year, month, 1).daysInMonth(); | - | ||||||||||||||||||||||||||||||||||||
90 | if (day > max
| 76-2686 | ||||||||||||||||||||||||||||||||||||
91 | day = max; | - | ||||||||||||||||||||||||||||||||||||
92 | } executed 76 times by 3 tests: end of block Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||
93 | } executed 2762 times by 6 tests: end of block Executed by:
| 2762 | ||||||||||||||||||||||||||||||||||||
94 | if (QDate::isValid(year, month, day)
| 0-4271 | ||||||||||||||||||||||||||||||||||||
95 | v = QDateTime(QDate(year, month, day), QTime(hour, minute, second, msec), spec); | - | ||||||||||||||||||||||||||||||||||||
96 | return executed 4271 times by 7 tests: true;return true; Executed by:
executed 4271 times by 7 tests: return true; Executed by:
| 4271 | ||||||||||||||||||||||||||||||||||||
97 | } | - | ||||||||||||||||||||||||||||||||||||
98 | return executed 39 times by 2 tests: false;return false; Executed by:
executed 39 times by 2 tests: return false; Executed by:
| 39 | ||||||||||||||||||||||||||||||||||||
99 | } | - | ||||||||||||||||||||||||||||||||||||
100 | int QDateTimeParser::absoluteMax(int s, const QDateTime &cur) const | - | ||||||||||||||||||||||||||||||||||||
101 | { | - | ||||||||||||||||||||||||||||||||||||
102 | const SectionNode &sn = sectionNode(s); | - | ||||||||||||||||||||||||||||||||||||
103 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
104 | case executed 1695 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1695 times by 6 tests: case Hour24Section: Executed by:
| 1695 | ||||||||||||||||||||||||||||||||||||
105 | case executed 1157 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 1157 times by 5 tests: returncase Hour12Section: Executed by:
executed 2852 times by 8 tests: 23;return 23; Executed by:
executed 2852 times by 8 tests: return 23; Executed by:
| 1157-2852 | ||||||||||||||||||||||||||||||||||||
106 | - | |||||||||||||||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||||||||||||||
108 | case executed 2298 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 2298 times by 8 tests: case MinuteSection: Executed by:
| 2298 | ||||||||||||||||||||||||||||||||||||
109 | case executed 2086 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 2086 times by 4 tests: returncase SecondSection: Executed by:
executed 4384 times by 8 tests: 59;return 59; Executed by:
executed 4384 times by 8 tests: return 59; Executed by:
| 2086-4384 | ||||||||||||||||||||||||||||||||||||
110 | case executed 237 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 237 times by 2 tests: returncase MSecSection: Executed by:
executed 237 times by 2 tests: 999;return 999; Executed by:
executed 237 times by 2 tests: return 999; Executed by:
| 237 | ||||||||||||||||||||||||||||||||||||
111 | case executed 1439 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 1439 times by 7 tests: case YearSection2Digits: Executed by:
| 1439 | ||||||||||||||||||||||||||||||||||||
112 | case executed 2015 times by 6 tests: YearSection:case YearSection: Executed by:
executed 2015 times by 6 tests: returncase YearSection: Executed by:
executed 3454 times by 10 tests: 9999;return 9999; Executed by:
executed 3454 times by 10 tests: return 9999; Executed by:
| 2015-3454 | ||||||||||||||||||||||||||||||||||||
113 | - | |||||||||||||||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||||||||||||||
116 | case executed 1934 times by 7 tests: MonthSection:case MonthSection: Executed by:
executed 1934 times by 7 tests: returncase MonthSection: Executed by:
executed 1934 times by 7 tests: 12;return 12; Executed by:
executed 1934 times by 7 tests: return 12; Executed by:
| 1934 | ||||||||||||||||||||||||||||||||||||
117 | case executed 2960 times by 10 tests: DaySection:case DaySection: Executed by:
executed 2960 times by 10 tests: case DaySection: Executed by:
| 2960 | ||||||||||||||||||||||||||||||||||||
118 | case executed 90 times by 1 test: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 90 times by 1 test: case DayOfWeekSectionShort: Executed by:
| 90 | ||||||||||||||||||||||||||||||||||||
119 | case executed 1013 times by 1 test: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 1013 times by 1 test: returncase DayOfWeekSectionLong: Executed by:
executed 4063 times by 10 tests: cur.isValid()return cur.isValid() ? cur.date().daysInMonth() : 31; Executed by:
executed 4063 times by 10 tests: return cur.isValid() ? cur.date().daysInMonth() : 31; Executed by:
| 1013-4063 | ||||||||||||||||||||||||||||||||||||
120 | case executed 6 times by 1 test: AmPmSection:case AmPmSection: Executed by:
executed 6 times by 1 test: returncase AmPmSection: Executed by:
executed 6 times by 1 test: 1;return 1; Executed by:
executed 6 times by 1 test: return 1; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
121 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
122 | } | - | ||||||||||||||||||||||||||||||||||||
123 | QMessageLogger(__FILE__, 208, __PRETTY_FUNCTION__).warning("QDateTimeParser::absoluteMax() Internal error (%s)", | - | ||||||||||||||||||||||||||||||||||||
124 | QString(sn.name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
125 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
126 | } | - | ||||||||||||||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||||||||||||||
128 | - | |||||||||||||||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||||||||||||||
134 | int QDateTimeParser::absoluteMin(int s) const | - | ||||||||||||||||||||||||||||||||||||
135 | { | - | ||||||||||||||||||||||||||||||||||||
136 | const SectionNode &sn = sectionNode(s); | - | ||||||||||||||||||||||||||||||||||||
137 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
138 | case executed 1695 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1695 times by 6 tests: case Hour24Section: Executed by:
| 1695 | ||||||||||||||||||||||||||||||||||||
139 | case executed 1157 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 1157 times by 5 tests: case Hour12Section: Executed by:
| 1157 | ||||||||||||||||||||||||||||||||||||
140 | case executed 2287 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 2287 times by 8 tests: case MinuteSection: Executed by:
| 2287 | ||||||||||||||||||||||||||||||||||||
141 | case executed 2074 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 2074 times by 4 tests: case SecondSection: Executed by:
| 2074 | ||||||||||||||||||||||||||||||||||||
142 | case executed 237 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 237 times by 2 tests: case MSecSection: Executed by:
| 237 | ||||||||||||||||||||||||||||||||||||
143 | case executed 1436 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 1436 times by 7 tests: case YearSection2Digits: Executed by:
| 1436 | ||||||||||||||||||||||||||||||||||||
144 | case executed 2015 times by 6 tests: YearSection:case YearSection: Executed by:
executed 2015 times by 6 tests: returncase YearSection: Executed by:
executed 10901 times by 11 tests: 0;return 0; Executed by:
executed 10901 times by 11 tests: return 0; Executed by:
| 2015-10901 | ||||||||||||||||||||||||||||||||||||
145 | case executed 1922 times by 7 tests: MonthSection:case MonthSection: Executed by:
executed 1922 times by 7 tests: case MonthSection: Executed by:
| 1922 | ||||||||||||||||||||||||||||||||||||
146 | case executed 2936 times by 10 tests: DaySection:case DaySection: Executed by:
executed 2936 times by 10 tests: case DaySection: Executed by:
| 2936 | ||||||||||||||||||||||||||||||||||||
147 | case executed 90 times by 1 test: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 90 times by 1 test: case DayOfWeekSectionShort: Executed by:
| 90 | ||||||||||||||||||||||||||||||||||||
148 | case executed 1013 times by 1 test: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 1013 times by 1 test: returncase DayOfWeekSectionLong: Executed by:
executed 5961 times by 10 tests: 1;return 1; Executed by:
executed 5961 times by 10 tests: return 1; Executed by:
| 1013-5961 | ||||||||||||||||||||||||||||||||||||
149 | case executed 6 times by 1 test: AmPmSection:case AmPmSection: Executed by:
executed 6 times by 1 test: returncase AmPmSection: Executed by:
executed 6 times by 1 test: 0;return 0; Executed by:
executed 6 times by 1 test: return 0; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
150 | default never executed: :default: never executed: break;default: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
151 | } | - | ||||||||||||||||||||||||||||||||||||
152 | QMessageLogger(__FILE__, 237, __PRETTY_FUNCTION__).warning("QDateTimeParser::absoluteMin() Internal error (%s, %0x)", | - | ||||||||||||||||||||||||||||||||||||
153 | QString(sn.name()).toLocal8Bit().constData(), sn.type); | - | ||||||||||||||||||||||||||||||||||||
154 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
155 | } | - | ||||||||||||||||||||||||||||||||||||
156 | - | |||||||||||||||||||||||||||||||||||||
157 | - | |||||||||||||||||||||||||||||||||||||
158 | - | |||||||||||||||||||||||||||||||||||||
159 | - | |||||||||||||||||||||||||||||||||||||
160 | - | |||||||||||||||||||||||||||||||||||||
161 | - | |||||||||||||||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||||||||||||||
163 | const QDateTimeParser::SectionNode &QDateTimeParser::sectionNode(int sectionIndex) const | - | ||||||||||||||||||||||||||||||||||||
164 | { | - | ||||||||||||||||||||||||||||||||||||
165 | if (sectionIndex < 0
| 739-148325 | ||||||||||||||||||||||||||||||||||||
166 | switch (sectionIndex) { | - | ||||||||||||||||||||||||||||||||||||
167 | case executed 229 times by 4 tests: FirstSectionIndex:case FirstSectionIndex: Executed by:
executed 229 times by 4 tests: case FirstSectionIndex: Executed by:
| 229 | ||||||||||||||||||||||||||||||||||||
168 | return executed 229 times by 4 tests: first;return first; Executed by:
executed 229 times by 4 tests: return first; Executed by:
| 229 | ||||||||||||||||||||||||||||||||||||
169 | case executed 7 times by 1 test: LastSectionIndex:case LastSectionIndex: Executed by:
executed 7 times by 1 test: case LastSectionIndex: Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||
170 | return executed 7 times by 1 test: last;return last; Executed by:
executed 7 times by 1 test: return last; Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||
171 | case executed 503 times by 7 tests: NoSectionIndex:case NoSectionIndex: Executed by:
executed 503 times by 7 tests: case NoSectionIndex: Executed by:
| 503 | ||||||||||||||||||||||||||||||||||||
172 | return executed 503 times by 7 tests: none;return none; Executed by:
executed 503 times by 7 tests: return none; Executed by:
| 503 | ||||||||||||||||||||||||||||||||||||
173 | } | - | ||||||||||||||||||||||||||||||||||||
174 | } never executed: else if (sectionIndex < sectionNodes.size()end of block
| 0-148325 | ||||||||||||||||||||||||||||||||||||
175 | return executed 148325 times by 11 tests: sectionNodes.at(sectionIndex);return sectionNodes.at(sectionIndex); Executed by:
executed 148325 times by 11 tests: return sectionNodes.at(sectionIndex); Executed by:
| 148325 | ||||||||||||||||||||||||||||||||||||
176 | } | - | ||||||||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||||||||
178 | QMessageLogger(__FILE__, 263, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionNode() Internal error (%d)", | - | ||||||||||||||||||||||||||||||||||||
179 | sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
180 | return never executed: none;return none; never executed: return none; | 0 | ||||||||||||||||||||||||||||||||||||
181 | } | - | ||||||||||||||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||||||||||||||
183 | QDateTimeParser::Section QDateTimeParser::sectionType(int sectionIndex) const | - | ||||||||||||||||||||||||||||||||||||
184 | { | - | ||||||||||||||||||||||||||||||||||||
185 | return executed 6721 times by 10 tests: sectionNode(sectionIndex).type;return sectionNode(sectionIndex).type; Executed by:
executed 6721 times by 10 tests: return sectionNode(sectionIndex).type; Executed by:
| 6721 | ||||||||||||||||||||||||||||||||||||
186 | } | - | ||||||||||||||||||||||||||||||||||||
187 | int QDateTimeParser::sectionPos(int sectionIndex) const | - | ||||||||||||||||||||||||||||||||||||
188 | { | - | ||||||||||||||||||||||||||||||||||||
189 | return executed 49308 times by 4 tests: sectionPos(sectionNode(sectionIndex));return sectionPos(sectionNode(sectionIndex)); Executed by:
executed 49308 times by 4 tests: return sectionPos(sectionNode(sectionIndex)); Executed by:
| 49308 | ||||||||||||||||||||||||||||||||||||
190 | } | - | ||||||||||||||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||||||||||||||
192 | int QDateTimeParser::sectionPos(const SectionNode &sn) const | - | ||||||||||||||||||||||||||||||||||||
193 | { | - | ||||||||||||||||||||||||||||||||||||
194 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
195 | case executed 117 times by 4 tests: FirstSection:case FirstSection: Executed by:
executed 117 times by 4 tests: returncase FirstSection: Executed by:
executed 117 times by 4 tests: 0;return 0; Executed by:
executed 117 times by 4 tests: return 0; Executed by:
| 117 | ||||||||||||||||||||||||||||||||||||
196 | case never executed: LastSection:case LastSection: never executed: returncase LastSection: never executed: displayText().size() - 1;return displayText().size() - 1; never executed: return displayText().size() - 1; | 0 | ||||||||||||||||||||||||||||||||||||
197 | default executed 51851 times by 4 tests: :default: Executed by:
executed 51851 times by 4 tests: break;default: Executed by:
executed 51851 times by 4 tests: break; Executed by:
| 51851 | ||||||||||||||||||||||||||||||||||||
198 | } | - | ||||||||||||||||||||||||||||||||||||
199 | if (sn.pos == -1
| 0-51851 | ||||||||||||||||||||||||||||||||||||
200 | QMessageLogger(__FILE__, 293, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionPos Internal error (%s)", QString(sn.name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
201 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
202 | } | - | ||||||||||||||||||||||||||||||||||||
203 | return executed 51851 times by 4 tests: sn.pos;return sn.pos; Executed by:
executed 51851 times by 4 tests: return sn.pos; Executed by:
| 51851 | ||||||||||||||||||||||||||||||||||||
204 | } | - | ||||||||||||||||||||||||||||||||||||
205 | static QString unquote(const QString &str) | - | ||||||||||||||||||||||||||||||||||||
206 | { | - | ||||||||||||||||||||||||||||||||||||
207 | const QChar quote(QLatin1Char('\'')); | - | ||||||||||||||||||||||||||||||||||||
208 | const QChar slash(QLatin1Char('\\')); | - | ||||||||||||||||||||||||||||||||||||
209 | const QChar zero(QLatin1Char('0')); | - | ||||||||||||||||||||||||||||||||||||
210 | QString ret; | - | ||||||||||||||||||||||||||||||||||||
211 | QChar status(zero); | - | ||||||||||||||||||||||||||||||||||||
212 | const int max = str.size(); | - | ||||||||||||||||||||||||||||||||||||
213 | for (int i=0; i<max
| 506-1021 | ||||||||||||||||||||||||||||||||||||
214 | if (str.at(i) == quote
| 21-485 | ||||||||||||||||||||||||||||||||||||
215 | if (status != quote
| 10-11 | ||||||||||||||||||||||||||||||||||||
216 | status = quote; | - | ||||||||||||||||||||||||||||||||||||
217 | } executed 11 times by 4 tests: else if (!ret.isEmpty()end of block Executed by:
| 0-11 | ||||||||||||||||||||||||||||||||||||
218 | ret[ret.size() - 1] = quote; | - | ||||||||||||||||||||||||||||||||||||
219 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
220 | status = zero; | - | ||||||||||||||||||||||||||||||||||||
221 | } executed 10 times by 4 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
222 | } else { | - | ||||||||||||||||||||||||||||||||||||
223 | ret += str.at(i); | - | ||||||||||||||||||||||||||||||||||||
224 | } executed 485 times by 5 tests: end of block Executed by:
| 485 | ||||||||||||||||||||||||||||||||||||
225 | } | - | ||||||||||||||||||||||||||||||||||||
226 | return executed 1021 times by 10 tests: ret;return ret; Executed by:
executed 1021 times by 10 tests: return ret; Executed by:
| 1021 | ||||||||||||||||||||||||||||||||||||
227 | } | - | ||||||||||||||||||||||||||||||||||||
228 | static inline int countRepeat(const QString &str, int index, int maxCount) | - | ||||||||||||||||||||||||||||||||||||
229 | { | - | ||||||||||||||||||||||||||||||||||||
230 | int count = 1; | - | ||||||||||||||||||||||||||||||||||||
231 | const QChar ch(str.at(index)); | - | ||||||||||||||||||||||||||||||||||||
232 | const int max = qMin(index + maxCount, str.size()); | - | ||||||||||||||||||||||||||||||||||||
233 | while (index + count < max
| 1990-8271 | ||||||||||||||||||||||||||||||||||||
234 | ++count; | - | ||||||||||||||||||||||||||||||||||||
235 | } executed 6281 times by 11 tests: end of block Executed by:
| 6281 | ||||||||||||||||||||||||||||||||||||
236 | return executed 4090 times by 11 tests: count;return count; Executed by:
executed 4090 times by 11 tests: return count; Executed by:
| 4090 | ||||||||||||||||||||||||||||||||||||
237 | } | - | ||||||||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||||||||
239 | static inline void appendSeparator(QStringList *list, const QString &string, int from, int size, int lastQuote) | - | ||||||||||||||||||||||||||||||||||||
240 | { | - | ||||||||||||||||||||||||||||||||||||
241 | QString str(string.mid(from, size)); | - | ||||||||||||||||||||||||||||||||||||
242 | if (lastQuote >= from
| 10-3177 | ||||||||||||||||||||||||||||||||||||
243 | str = unquote(str); executed 10 times by 4 tests: str = unquote(str); Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
244 | list->append(str); | - | ||||||||||||||||||||||||||||||||||||
245 | } executed 3187 times by 11 tests: end of block Executed by:
| 3187 | ||||||||||||||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||
248 | bool QDateTimeParser::parseFormat(const QString &newFormat) | - | ||||||||||||||||||||||||||||||||||||
249 | { | - | ||||||||||||||||||||||||||||||||||||
250 | const QLatin1Char quote('\''); | - | ||||||||||||||||||||||||||||||||||||
251 | const QLatin1Char slash('\\'); | - | ||||||||||||||||||||||||||||||||||||
252 | const QLatin1Char zero('0'); | - | ||||||||||||||||||||||||||||||||||||
253 | if (newFormat == displayFormat
| 2-1179 | ||||||||||||||||||||||||||||||||||||
254 | return executed 173 times by 1 test: true;return true; Executed by:
executed 173 times by 1 test: return true; Executed by:
| 173 | ||||||||||||||||||||||||||||||||||||
255 | } | - | ||||||||||||||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||||||||||||||
257 | if (false) QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__).debug("parseFormat: %s", newFormat.toLatin1().constData()); dead code: QMessageLogger(__FILE__, 368, __PRETTY_FUNCTION__).debug("parseFormat: %s", newFormat.toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||||||||||||||
259 | QVector<SectionNode> newSectionNodes; | - | ||||||||||||||||||||||||||||||||||||
260 | Sections newDisplay = 0; | - | ||||||||||||||||||||||||||||||||||||
261 | QStringList newSeparators; | - | ||||||||||||||||||||||||||||||||||||
262 | int i, index = 0; | - | ||||||||||||||||||||||||||||||||||||
263 | int add = 0; | - | ||||||||||||||||||||||||||||||||||||
264 | QChar status(zero); | - | ||||||||||||||||||||||||||||||||||||
265 | const int max = newFormat.size(); | - | ||||||||||||||||||||||||||||||||||||
266 | int lastQuote = -1; | - | ||||||||||||||||||||||||||||||||||||
267 | for (i = 0; i<max
| 1181-7522 | ||||||||||||||||||||||||||||||||||||
268 | if (newFormat.at(i) == quote
| 21-7501 | ||||||||||||||||||||||||||||||||||||
269 | lastQuote = i; | - | ||||||||||||||||||||||||||||||||||||
270 | ++add; | - | ||||||||||||||||||||||||||||||||||||
271 | if (status != quote
| 10-11 | ||||||||||||||||||||||||||||||||||||
272 | status = quote; | - | ||||||||||||||||||||||||||||||||||||
273 | } executed 11 times by 4 tests: else if (i > 0end of block Executed by:
| 0-11 | ||||||||||||||||||||||||||||||||||||
274 | status = zero; | - | ||||||||||||||||||||||||||||||||||||
275 | } executed 10 times by 4 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
276 | } executed 21 times by 4 tests: else if (status != quoteend of block Executed by:
| 21-7462 | ||||||||||||||||||||||||||||||||||||
277 | const char sect = newFormat.at(i).toLatin1(); | - | ||||||||||||||||||||||||||||||||||||
278 | switch (sect) { | - | ||||||||||||||||||||||||||||||||||||
279 | case executed 111 times by 4 tests: 'H':case 'H': Executed by:
executed 111 times by 4 tests: case 'H': Executed by:
| 111 | ||||||||||||||||||||||||||||||||||||
280 | case executed 319 times by 8 tests: 'h':case 'h': Executed by:
executed 319 times by 8 tests: case 'h': Executed by:
| 319 | ||||||||||||||||||||||||||||||||||||
281 | if (parserType != QVariant::Date
| 3-427 | ||||||||||||||||||||||||||||||||||||
282 | const Section hour = (
| 111-316 | ||||||||||||||||||||||||||||||||||||
283 | const SectionNode sn = { hour, i - add, countRepeat(newFormat, i, 2), 0 }; | - | ||||||||||||||||||||||||||||||||||||
284 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
285 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
286 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
287 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
288 | newDisplay |= hour; | - | ||||||||||||||||||||||||||||||||||||
289 | } executed 427 times by 8 tests: end of block Executed by:
| 427 | ||||||||||||||||||||||||||||||||||||
290 | break; executed 430 times by 9 tests: break; Executed by:
| 430 | ||||||||||||||||||||||||||||||||||||
291 | case executed 409 times by 8 tests: 'm':case 'm': Executed by:
executed 409 times by 8 tests: case 'm': Executed by:
| 409 | ||||||||||||||||||||||||||||||||||||
292 | if (parserType != QVariant::Date
| 0-409 | ||||||||||||||||||||||||||||||||||||
293 | const SectionNode sn = { MinuteSection, i - add, countRepeat(newFormat, i, 2), 0 }; | - | ||||||||||||||||||||||||||||||||||||
294 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
295 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
296 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
297 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
298 | newDisplay |= MinuteSection; | - | ||||||||||||||||||||||||||||||||||||
299 | } executed 409 times by 8 tests: end of block Executed by:
| 409 | ||||||||||||||||||||||||||||||||||||
300 | break; executed 409 times by 8 tests: break; Executed by:
| 409 | ||||||||||||||||||||||||||||||||||||
301 | case executed 260 times by 4 tests: 's':case 's': Executed by:
executed 260 times by 4 tests: case 's': Executed by:
| 260 | ||||||||||||||||||||||||||||||||||||
302 | if (parserType != QVariant::Date
| 0-260 | ||||||||||||||||||||||||||||||||||||
303 | const SectionNode sn = { SecondSection, i - add, countRepeat(newFormat, i, 2), 0 }; | - | ||||||||||||||||||||||||||||||||||||
304 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
305 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
306 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
307 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
308 | newDisplay |= SecondSection; | - | ||||||||||||||||||||||||||||||||||||
309 | } executed 260 times by 4 tests: end of block Executed by:
| 260 | ||||||||||||||||||||||||||||||||||||
310 | break; executed 260 times by 4 tests: break; Executed by:
| 260 | ||||||||||||||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||||||||||||||
312 | case executed 47 times by 2 tests: 'z':case 'z': Executed by:
executed 47 times by 2 tests: case 'z': Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||
313 | if (parserType != QVariant::Date
| 0-47 | ||||||||||||||||||||||||||||||||||||
314 | const SectionNode sn = { MSecSection, i - add, countRepeat(newFormat, i, 3) < 3 ? 1 : 3, 0 }; | - | ||||||||||||||||||||||||||||||||||||
315 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
316 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
317 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
318 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
319 | newDisplay |= MSecSection; | - | ||||||||||||||||||||||||||||||||||||
320 | } executed 47 times by 2 tests: end of block Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||
321 | break; executed 47 times by 2 tests: break; Executed by:
| 47 | ||||||||||||||||||||||||||||||||||||
322 | case executed 16 times by 5 tests: 'A':case 'A': Executed by:
executed 16 times by 5 tests: case 'A': Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||
323 | case executed 79 times by 4 tests: 'a':case 'a': Executed by:
executed 79 times by 4 tests: case 'a': Executed by:
| 79 | ||||||||||||||||||||||||||||||||||||
324 | if (parserType != QVariant::Date
| 2-93 | ||||||||||||||||||||||||||||||||||||
325 | const bool cap = (sect == 'A'); | - | ||||||||||||||||||||||||||||||||||||
326 | const SectionNode sn = { AmPmSection, i - add, (cap ? 1 : 0), 0 }; | - | ||||||||||||||||||||||||||||||||||||
327 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
328 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
329 | newDisplay |= AmPmSection; | - | ||||||||||||||||||||||||||||||||||||
330 | if (i + 1 < newFormat.size()
| 1-92 | ||||||||||||||||||||||||||||||||||||
331 | && newFormat.at(i+1) == (cap
| 0-92 | ||||||||||||||||||||||||||||||||||||
332 | ++i; | - | ||||||||||||||||||||||||||||||||||||
333 | } executed 92 times by 5 tests: end of block Executed by:
| 92 | ||||||||||||||||||||||||||||||||||||
334 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
335 | } executed 93 times by 5 tests: end of block Executed by:
| 93 | ||||||||||||||||||||||||||||||||||||
336 | break; executed 95 times by 6 tests: break; Executed by:
| 95 | ||||||||||||||||||||||||||||||||||||
337 | case executed 893 times by 10 tests: 'y':case 'y': Executed by:
executed 893 times by 10 tests: case 'y': Executed by:
| 893 | ||||||||||||||||||||||||||||||||||||
338 | if (parserType != QVariant::Time
| 4-889 | ||||||||||||||||||||||||||||||||||||
339 | const int repeat = countRepeat(newFormat, i, 4); | - | ||||||||||||||||||||||||||||||||||||
340 | if (repeat >= 2
| 1-888 | ||||||||||||||||||||||||||||||||||||
341 | const SectionNode sn = { repeat == 4 ? YearSection : YearSection2Digits, | - | ||||||||||||||||||||||||||||||||||||
342 | i - add, repeat == 4 ? 4 : 2, 0 }; | - | ||||||||||||||||||||||||||||||||||||
343 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
344 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
345 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
346 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
347 | newDisplay |= sn.type; | - | ||||||||||||||||||||||||||||||||||||
348 | } executed 888 times by 10 tests: end of block Executed by:
| 888 | ||||||||||||||||||||||||||||||||||||
349 | } executed 889 times by 10 tests: end of block Executed by:
| 889 | ||||||||||||||||||||||||||||||||||||
350 | break; executed 893 times by 10 tests: break; Executed by:
| 893 | ||||||||||||||||||||||||||||||||||||
351 | case executed 1011 times by 10 tests: 'M':case 'M': Executed by:
executed 1011 times by 10 tests: case 'M': Executed by:
| 1011 | ||||||||||||||||||||||||||||||||||||
352 | if (parserType != QVariant::Time
| 0-1011 | ||||||||||||||||||||||||||||||||||||
353 | const SectionNode sn = { MonthSection, i - add, countRepeat(newFormat, i, 4), 0 }; | - | ||||||||||||||||||||||||||||||||||||
354 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
355 | newSeparators.append(unquote(newFormat.mid(index, i - index))); | - | ||||||||||||||||||||||||||||||||||||
356 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
357 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
358 | newDisplay |= MonthSection; | - | ||||||||||||||||||||||||||||||||||||
359 | } executed 1011 times by 10 tests: end of block Executed by:
| 1011 | ||||||||||||||||||||||||||||||||||||
360 | break; executed 1011 times by 10 tests: break; Executed by:
| 1011 | ||||||||||||||||||||||||||||||||||||
361 | case executed 1047 times by 10 tests: 'd':case 'd': Executed by:
executed 1047 times by 10 tests: case 'd': Executed by:
| 1047 | ||||||||||||||||||||||||||||||||||||
362 | if (parserType != QVariant::Time
| 0-1047 | ||||||||||||||||||||||||||||||||||||
363 | const int repeat = countRepeat(newFormat, i, 4); | - | ||||||||||||||||||||||||||||||||||||
364 | const Section sectionType = (repeat == 4
| 49-998 | ||||||||||||||||||||||||||||||||||||
365 | : (repeat == 3
| 6-992 | ||||||||||||||||||||||||||||||||||||
366 | const SectionNode sn = { sectionType, i - add, repeat, 0 }; | - | ||||||||||||||||||||||||||||||||||||
367 | newSectionNodes.append(sn); | - | ||||||||||||||||||||||||||||||||||||
368 | appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
369 | i += sn.count - 1; | - | ||||||||||||||||||||||||||||||||||||
370 | index = i + 1; | - | ||||||||||||||||||||||||||||||||||||
371 | newDisplay |= sn.type; | - | ||||||||||||||||||||||||||||||||||||
372 | } executed 1047 times by 10 tests: end of block Executed by:
| 1047 | ||||||||||||||||||||||||||||||||||||
373 | break; executed 1047 times by 10 tests: break; Executed by:
| 1047 | ||||||||||||||||||||||||||||||||||||
374 | - | |||||||||||||||||||||||||||||||||||||
375 | default executed 3270 times by 10 tests: :default: Executed by:
executed 3270 times by 10 tests: default: Executed by:
| 3270 | ||||||||||||||||||||||||||||||||||||
376 | break; executed 3270 times by 10 tests: break; Executed by:
| 3270 | ||||||||||||||||||||||||||||||||||||
377 | } | - | ||||||||||||||||||||||||||||||||||||
378 | } | - | ||||||||||||||||||||||||||||||||||||
379 | } executed 7522 times by 11 tests: end of block Executed by:
| 7522 | ||||||||||||||||||||||||||||||||||||
380 | if (newSectionNodes.isEmpty()
| 2-1170 | ||||||||||||||||||||||||||||||||||||
381 | return executed 2 times by 1 test: false;return false; Executed by:
executed 2 times by 1 test: return false; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
382 | } | - | ||||||||||||||||||||||||||||||||||||
383 | - | |||||||||||||||||||||||||||||||||||||
384 | if ((
| 218-961 | ||||||||||||||||||||||||||||||||||||
385 | const int count = newSectionNodes.size(); | - | ||||||||||||||||||||||||||||||||||||
386 | for (int i = 0; i < count
| 218-878 | ||||||||||||||||||||||||||||||||||||
387 | SectionNode &node = newSectionNodes[i]; | - | ||||||||||||||||||||||||||||||||||||
388 | if (node.type == Hour12Section
| 229-649 | ||||||||||||||||||||||||||||||||||||
389 | node.type = Hour24Section; executed 229 times by 5 tests: node.type = Hour24Section; Executed by:
| 229 | ||||||||||||||||||||||||||||||||||||
390 | } executed 878 times by 5 tests: end of block Executed by:
| 878 | ||||||||||||||||||||||||||||||||||||
391 | } executed 218 times by 5 tests: end of block Executed by:
| 218 | ||||||||||||||||||||||||||||||||||||
392 | - | |||||||||||||||||||||||||||||||||||||
393 | if (index < max
| 16-1163 | ||||||||||||||||||||||||||||||||||||
394 | appendSeparator(&newSeparators, newFormat, index, index - max, lastQuote); | - | ||||||||||||||||||||||||||||||||||||
395 | } executed 16 times by 4 tests: else {end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||
396 | newSeparators.append(QString()); | - | ||||||||||||||||||||||||||||||||||||
397 | } executed 1163 times by 10 tests: end of block Executed by:
| 1163 | ||||||||||||||||||||||||||||||||||||
398 | - | |||||||||||||||||||||||||||||||||||||
399 | displayFormat = newFormat; | - | ||||||||||||||||||||||||||||||||||||
400 | separators = newSeparators; | - | ||||||||||||||||||||||||||||||||||||
401 | sectionNodes = newSectionNodes; | - | ||||||||||||||||||||||||||||||||||||
402 | display = newDisplay; | - | ||||||||||||||||||||||||||||||||||||
403 | last.pos = -1; | - | ||||||||||||||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||||||||||||||
406 | - | |||||||||||||||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||||||||||||||
408 | - | |||||||||||||||||||||||||||||||||||||
409 | if (false) QMessageLogger(__FILE__, 520, __PRETTY_FUNCTION__).debug() << newFormat << displayFormat; dead code: QMessageLogger(__FILE__, 520, __PRETTY_FUNCTION__).debug() << newFormat << displayFormat; | - | ||||||||||||||||||||||||||||||||||||
410 | if (false) QMessageLogger(__FILE__, 521, __PRETTY_FUNCTION__).debug("separators:\n'%s'", separators.join(QLatin1String("\n")).toLatin1().constData()); dead code: QMessageLogger(__FILE__, 521, __PRETTY_FUNCTION__).debug("separators:\n'%s'", separators.join(QLatin1String("\n")).toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||||||||||||||
412 | return executed 1179 times by 11 tests: true;return true; Executed by:
executed 1179 times by 11 tests: return true; Executed by:
| 1179 | ||||||||||||||||||||||||||||||||||||
413 | } | - | ||||||||||||||||||||||||||||||||||||
414 | - | |||||||||||||||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||||||||||||||
416 | - | |||||||||||||||||||||||||||||||||||||
417 | - | |||||||||||||||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||||||||||||||
419 | - | |||||||||||||||||||||||||||||||||||||
420 | - | |||||||||||||||||||||||||||||||||||||
421 | int QDateTimeParser::sectionSize(int sectionIndex) const | - | ||||||||||||||||||||||||||||||||||||
422 | { | - | ||||||||||||||||||||||||||||||||||||
423 | if (sectionIndex < 0
| 0-18759 | ||||||||||||||||||||||||||||||||||||
424 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
425 | - | |||||||||||||||||||||||||||||||||||||
426 | if (sectionIndex >= sectionNodes.size()
| 0-18759 | ||||||||||||||||||||||||||||||||||||
427 | QMessageLogger(__FILE__, 538, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionSize Internal error (%d)", sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
428 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
429 | } | - | ||||||||||||||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||||||||||||||
431 | if (sectionIndex == sectionNodes.size() - 1
| 4554-14205 | ||||||||||||||||||||||||||||||||||||
432 | - | |||||||||||||||||||||||||||||||||||||
433 | - | |||||||||||||||||||||||||||||||||||||
434 | - | |||||||||||||||||||||||||||||||||||||
435 | - | |||||||||||||||||||||||||||||||||||||
436 | int sizeAdjustment = 0; | - | ||||||||||||||||||||||||||||||||||||
437 | if (displayText().size() != text.size()
| 23-4531 | ||||||||||||||||||||||||||||||||||||
438 | - | |||||||||||||||||||||||||||||||||||||
439 | int preceedingZeroesAdded = 0; | - | ||||||||||||||||||||||||||||||||||||
440 | if (sectionNodes.size() > 1
| 0-23 | ||||||||||||||||||||||||||||||||||||
441 | for (QVector<SectionNode>::ConstIterator sectionIt = sectionNodes.constBegin(); | - | ||||||||||||||||||||||||||||||||||||
442 | sectionIt != sectionNodes.constBegin() + sectionIndex
| 23-40 | ||||||||||||||||||||||||||||||||||||
443 | preceedingZeroesAdded += sectionIt->zeroesAdded; | - | ||||||||||||||||||||||||||||||||||||
444 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
445 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||||||||||||||||||||
446 | sizeAdjustment = preceedingZeroesAdded; | - | ||||||||||||||||||||||||||||||||||||
447 | } executed 23 times by 1 test: end of block Executed by:
| 23 | ||||||||||||||||||||||||||||||||||||
448 | - | |||||||||||||||||||||||||||||||||||||
449 | return executed 4554 times by 1 test: displayText().size() + sizeAdjustment - sectionPos(sectionIndex) - separators.last().size();return displayText().size() + sizeAdjustment - sectionPos(sectionIndex) - separators.last().size(); Executed by:
executed 4554 times by 1 test: return displayText().size() + sizeAdjustment - sectionPos(sectionIndex) - separators.last().size(); Executed by:
| 4554 | ||||||||||||||||||||||||||||||||||||
450 | } else { | - | ||||||||||||||||||||||||||||||||||||
451 | return executed 14205 times by 4 tests: sectionPos(sectionIndex + 1) - sectionPos(sectionIndex)return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex) - separators.at(sectionIndex + 1).size(); Executed by:
executed 14205 times by 4 tests: return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex) - separators.at(sectionIndex + 1).size(); Executed by:
| 14205 | ||||||||||||||||||||||||||||||||||||
452 | - separators.at(sectionIndex + 1).size(); executed 14205 times by 4 tests: return sectionPos(sectionIndex + 1) - sectionPos(sectionIndex) - separators.at(sectionIndex + 1).size(); Executed by:
| 14205 | ||||||||||||||||||||||||||||||||||||
453 | } | - | ||||||||||||||||||||||||||||||||||||
454 | } | - | ||||||||||||||||||||||||||||||||||||
455 | - | |||||||||||||||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||||||||||||||
457 | int QDateTimeParser::sectionMaxSize(Section s, int count) const | - | ||||||||||||||||||||||||||||||||||||
458 | { | - | ||||||||||||||||||||||||||||||||||||
459 | - | |||||||||||||||||||||||||||||||||||||
460 | int mcount = 12; | - | ||||||||||||||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||||||||||||||
463 | switch (s) { | - | ||||||||||||||||||||||||||||||||||||
464 | case never executed: FirstSection:case FirstSection: never executed: case FirstSection: | 0 | ||||||||||||||||||||||||||||||||||||
465 | case never executed: NoSection:case NoSection: never executed: case NoSection: | 0 | ||||||||||||||||||||||||||||||||||||
466 | case never executed: LastSection:case LastSection: never executed: returncase LastSection: never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
467 | - | |||||||||||||||||||||||||||||||||||||
468 | case executed 1726 times by 5 tests: AmPmSection:case AmPmSection: Executed by:
executed 1726 times by 5 tests: {case AmPmSection: Executed by:
| 1726 | ||||||||||||||||||||||||||||||||||||
469 | const int lowerMax = qMin(getAmPmText(AmText, LowerCase).size(), | - | ||||||||||||||||||||||||||||||||||||
470 | getAmPmText(PmText, LowerCase).size()); | - | ||||||||||||||||||||||||||||||||||||
471 | const int upperMax = qMin(getAmPmText(AmText, UpperCase).size(), | - | ||||||||||||||||||||||||||||||||||||
472 | getAmPmText(PmText, UpperCase).size()); | - | ||||||||||||||||||||||||||||||||||||
473 | return executed 1726 times by 5 tests: qMin(4, qMin(lowerMax, upperMax));return qMin(4, qMin(lowerMax, upperMax)); Executed by:
executed 1726 times by 5 tests: return qMin(4, qMin(lowerMax, upperMax)); Executed by:
| 1726 | ||||||||||||||||||||||||||||||||||||
474 | } | - | ||||||||||||||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||||||||||||||
476 | case executed 1513 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1513 times by 6 tests: case Hour24Section: Executed by:
| 1513 | ||||||||||||||||||||||||||||||||||||
477 | case executed 943 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 943 times by 5 tests: case Hour12Section: Executed by:
| 943 | ||||||||||||||||||||||||||||||||||||
478 | case executed 2262 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 2262 times by 8 tests: case MinuteSection: Executed by:
| 2262 | ||||||||||||||||||||||||||||||||||||
479 | case executed 1955 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 1955 times by 4 tests: case SecondSection: Executed by:
| 1955 | ||||||||||||||||||||||||||||||||||||
480 | case executed 3203 times by 10 tests: DaySection:case DaySection: Executed by:
executed 3203 times by 10 tests: returncase DaySection: Executed by:
executed 9876 times by 11 tests: 2;return 2; Executed by:
executed 9876 times by 11 tests: return 2; Executed by:
| 3203-9876 | ||||||||||||||||||||||||||||||||||||
481 | case executed 40 times by 3 tests: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 40 times by 3 tests: case DayOfWeekSectionShort: Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
482 | case executed 442 times by 3 tests: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 442 times by 3 tests: case DayOfWeekSectionLong: Executed by:
| 442 | ||||||||||||||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||||||||
485 | - | |||||||||||||||||||||||||||||||||||||
486 | mcount = 7; | - | ||||||||||||||||||||||||||||||||||||
487 | - | |||||||||||||||||||||||||||||||||||||
488 | - | |||||||||||||||||||||||||||||||||||||
489 | case executed 3657 times by 10 tests: MonthSection:case MonthSection: Executed by:
executed 3657 times by 10 tests: case MonthSection: Executed by:
code before this statement executed 482 times by 3 tests: case MonthSection: Executed by:
| 482-3657 | ||||||||||||||||||||||||||||||||||||
490 | - | |||||||||||||||||||||||||||||||||||||
491 | - | |||||||||||||||||||||||||||||||||||||
492 | - | |||||||||||||||||||||||||||||||||||||
493 | if (count <= 2
| 1922-2217 | ||||||||||||||||||||||||||||||||||||
494 | return executed 2217 times by 7 tests: 2;return 2; Executed by:
executed 2217 times by 7 tests: return 2; Executed by:
| 2217 | ||||||||||||||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||||||||||||||
496 | { | - | ||||||||||||||||||||||||||||||||||||
497 | int ret = 0; | - | ||||||||||||||||||||||||||||||||||||
498 | const QLocale l = locale(); | - | ||||||||||||||||||||||||||||||||||||
499 | const QLocale::FormatType format = count == 4
| 655-1267 | ||||||||||||||||||||||||||||||||||||
500 | for (int i=1; i<=mcount
| 1922-20654 | ||||||||||||||||||||||||||||||||||||
501 | const QString str = (s == MonthSection
| 3374-17280 | ||||||||||||||||||||||||||||||||||||
502 | ? l.monthName(i, format) | - | ||||||||||||||||||||||||||||||||||||
503 | : l.dayName(i, format)); | - | ||||||||||||||||||||||||||||||||||||
504 | ret = qMax(str.size(), ret); | - | ||||||||||||||||||||||||||||||||||||
505 | } executed 20654 times by 6 tests: end of block Executed by:
| 20654 | ||||||||||||||||||||||||||||||||||||
506 | return executed 1922 times by 6 tests: ret;return ret; Executed by:
executed 1922 times by 6 tests: return ret; Executed by:
| 1922 | ||||||||||||||||||||||||||||||||||||
507 | } | - | ||||||||||||||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||||||||||||||
509 | case executed 283 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 283 times by 2 tests: returncase MSecSection: Executed by:
executed 283 times by 2 tests: 3;return 3; Executed by:
executed 283 times by 2 tests: return 3; Executed by:
| 283 | ||||||||||||||||||||||||||||||||||||
510 | case executed 2142 times by 6 tests: YearSection:case YearSection: Executed by:
executed 2142 times by 6 tests: returncase YearSection: Executed by:
executed 2142 times by 6 tests: 4;return 4; Executed by:
executed 2142 times by 6 tests: return 4; Executed by:
| 2142 | ||||||||||||||||||||||||||||||||||||
511 | case executed 907 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 907 times by 7 tests: returncase YearSection2Digits: Executed by:
executed 907 times by 7 tests: 2;return 2; Executed by:
executed 907 times by 7 tests: return 2; Executed by:
| 907 | ||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||
513 | case never executed: CalendarPopupSection:case CalendarPopupSection: never executed: case CalendarPopupSection: | 0 | ||||||||||||||||||||||||||||||||||||
514 | case never executed: Internal:case Internal: never executed: case Internal: | 0 | ||||||||||||||||||||||||||||||||||||
515 | case never executed: TimeSectionMask:case TimeSectionMask: never executed: case TimeSectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
516 | case never executed: DateSectionMask:case DateSectionMask: never executed: case DateSectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
517 | case never executed: HourSectionMask:case HourSectionMask: never executed: case HourSectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
518 | case never executed: YearSectionMask:case YearSectionMask: never executed: case YearSectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
519 | case never executed: DayOfWeekSectionMask:case DayOfWeekSectionMask: never executed: case DayOfWeekSectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
520 | case never executed: DaySectionMask:case DaySectionMask: never executed: case DaySectionMask: | 0 | ||||||||||||||||||||||||||||||||||||
521 | QMessageLogger(__FILE__, 632, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionMaxSize: Invalid section %s", | - | ||||||||||||||||||||||||||||||||||||
522 | SectionNode::name(s).toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
523 | - | |||||||||||||||||||||||||||||||||||||
524 | case never executed: NoSectionIndex:case NoSectionIndex: never executed: case NoSectionIndex: code before this statement never executed: case NoSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
525 | case never executed: FirstSectionIndex:case FirstSectionIndex: never executed: case FirstSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
526 | case never executed: LastSectionIndex:case LastSectionIndex: never executed: case LastSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
527 | case never executed: CalendarPopupIndex:case CalendarPopupIndex: never executed: case CalendarPopupIndex: | 0 | ||||||||||||||||||||||||||||||||||||
528 | - | |||||||||||||||||||||||||||||||||||||
529 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
530 | } | - | ||||||||||||||||||||||||||||||||||||
531 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
532 | } | - | ||||||||||||||||||||||||||||||||||||
533 | - | |||||||||||||||||||||||||||||||||||||
534 | - | |||||||||||||||||||||||||||||||||||||
535 | int QDateTimeParser::sectionMaxSize(int index) const | - | ||||||||||||||||||||||||||||||||||||
536 | { | - | ||||||||||||||||||||||||||||||||||||
537 | const SectionNode &sn = sectionNode(index); | - | ||||||||||||||||||||||||||||||||||||
538 | return executed 19073 times by 11 tests: sectionMaxSize(sn.type, sn.count);return sectionMaxSize(sn.type, sn.count); Executed by:
executed 19073 times by 11 tests: return sectionMaxSize(sn.type, sn.count); Executed by:
| 19073 | ||||||||||||||||||||||||||||||||||||
539 | } | - | ||||||||||||||||||||||||||||||||||||
540 | QString QDateTimeParser::sectionText(const QString &text, int sectionIndex, int index) const | - | ||||||||||||||||||||||||||||||||||||
541 | { | - | ||||||||||||||||||||||||||||||||||||
542 | const SectionNode &sn = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
543 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
544 | case never executed: NoSectionIndex:case NoSectionIndex: never executed: case NoSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
545 | case never executed: FirstSectionIndex:case FirstSectionIndex: never executed: case FirstSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
546 | case never executed: LastSectionIndex:case LastSectionIndex: never executed: case LastSectionIndex: | 0 | ||||||||||||||||||||||||||||||||||||
547 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||||||||
548 | default executed 175 times by 1 test: :default: Executed by:
executed 175 times by 1 test: break;default: Executed by:
executed 175 times by 1 test: break; Executed by:
| 175 | ||||||||||||||||||||||||||||||||||||
549 | } | - | ||||||||||||||||||||||||||||||||||||
550 | - | |||||||||||||||||||||||||||||||||||||
551 | return executed 175 times by 1 test: text.mid(index, sectionSize(sectionIndex));return text.mid(index, sectionSize(sectionIndex)); Executed by:
executed 175 times by 1 test: return text.mid(index, sectionSize(sectionIndex)); Executed by:
| 175 | ||||||||||||||||||||||||||||||||||||
552 | } | - | ||||||||||||||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||||||||||||||
554 | QString QDateTimeParser::sectionText(int sectionIndex) const | - | ||||||||||||||||||||||||||||||||||||
555 | { | - | ||||||||||||||||||||||||||||||||||||
556 | const SectionNode &sn = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
557 | return executed 46 times by 1 test: sectionText(displayText(), sectionIndex, sn.pos);return sectionText(displayText(), sectionIndex, sn.pos); Executed by:
executed 46 times by 1 test: return sectionText(displayText(), sectionIndex, sn.pos); Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||
558 | } | - | ||||||||||||||||||||||||||||||||||||
559 | int QDateTimeParser::parseSection(const QDateTime ¤tValue, int sectionIndex, | - | ||||||||||||||||||||||||||||||||||||
560 | QString &text, int &cursorPosition, int index, | - | ||||||||||||||||||||||||||||||||||||
561 | State &state, int *usedptr) const | - | ||||||||||||||||||||||||||||||||||||
562 | { | - | ||||||||||||||||||||||||||||||||||||
563 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
564 | int num = 0; | - | ||||||||||||||||||||||||||||||||||||
565 | const SectionNode &sn = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
566 | if ((
| 0-15944 | ||||||||||||||||||||||||||||||||||||
567 | QMessageLogger(__FILE__, 698, __PRETTY_FUNCTION__).warning("QDateTimeParser::parseSection Internal error (%s %d)", | - | ||||||||||||||||||||||||||||||||||||
568 | QString(sn.name()).toLocal8Bit().constData(), sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
569 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
570 | } | - | ||||||||||||||||||||||||||||||||||||
571 | - | |||||||||||||||||||||||||||||||||||||
572 | const int sectionmaxsize = sectionMaxSize(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
573 | QString sectiontext = text.mid(index, sectionmaxsize); | - | ||||||||||||||||||||||||||||||||||||
574 | int sectiontextSize = sectiontext.size(); | - | ||||||||||||||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||||||||||||||
576 | if (false) QMessageLogger(__FILE__, 707, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() dead code: QMessageLogger(__FILE__, 707, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectiontext << text.mid(index, sectionmaxsize) << index; | - | ||||||||||||||||||||||||||||||||||||
577 | << "with text" << text << "and st" << sectiontext dead code: QMessageLogger(__FILE__, 707, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectiontext << text.mid(index, sectionmaxsize) << index; | - | ||||||||||||||||||||||||||||||||||||
578 | << text.mid(index, sectionmaxsize) dead code: QMessageLogger(__FILE__, 707, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectiontext << text.mid(index, sectionmaxsize) << index; | - | ||||||||||||||||||||||||||||||||||||
579 | << index; dead code: QMessageLogger(__FILE__, 707, __PRETTY_FUNCTION__).debug() << "sectionValue for" << sn.name() << "with text" << text << "and st" << sectiontext << text.mid(index, sectionmaxsize) << index; | - | ||||||||||||||||||||||||||||||||||||
580 | - | |||||||||||||||||||||||||||||||||||||
581 | int used = 0; | - | ||||||||||||||||||||||||||||||||||||
582 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
583 | case executed 863 times by 5 tests: AmPmSection:case AmPmSection: Executed by:
executed 863 times by 5 tests: {case AmPmSection: Executed by:
| 863 | ||||||||||||||||||||||||||||||||||||
584 | const int ampm = findAmPm(sectiontext, sectionIndex, &used); | - | ||||||||||||||||||||||||||||||||||||
585 | switch (ampm) { | - | ||||||||||||||||||||||||||||||||||||
586 | case executed 758 times by 5 tests: AM:case AM: Executed by:
executed 758 times by 5 tests: case AM: Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||
587 | case executed 103 times by 3 tests: PM:case PM: Executed by:
executed 103 times by 3 tests: case PM: Executed by:
| 103 | ||||||||||||||||||||||||||||||||||||
588 | num = ampm; | - | ||||||||||||||||||||||||||||||||||||
589 | state = Acceptable; | - | ||||||||||||||||||||||||||||||||||||
590 | break; executed 861 times by 5 tests: break; Executed by:
| 861 | ||||||||||||||||||||||||||||||||||||
591 | case never executed: PossibleAM:case PossibleAM: never executed: case PossibleAM: | 0 | ||||||||||||||||||||||||||||||||||||
592 | case never executed: PossiblePM:case PossiblePM: never executed: case PossiblePM: | 0 | ||||||||||||||||||||||||||||||||||||
593 | num = ampm - 2; | - | ||||||||||||||||||||||||||||||||||||
594 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
595 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
596 | case never executed: PossibleBoth:case PossibleBoth: never executed: case PossibleBoth: | 0 | ||||||||||||||||||||||||||||||||||||
597 | num = 0; | - | ||||||||||||||||||||||||||||||||||||
598 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
599 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
600 | case executed 2 times by 2 tests: Neither:case Neither: Executed by:
executed 2 times by 2 tests: case Neither: Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
601 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
602 | if (false) QMessageLogger(__FILE__, 733, __PRETTY_FUNCTION__).debug() << "invalid because findAmPm(" << sectiontext << ") returned -1"; dead code: QMessageLogger(__FILE__, 733, __PRETTY_FUNCTION__).debug() << "invalid because findAmPm(" << sectiontext << ") returned -1"; | - | ||||||||||||||||||||||||||||||||||||
603 | break; executed 2 times by 2 tests: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
604 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
605 | if (false) QMessageLogger(__FILE__, 736, __PRETTY_FUNCTION__).debug("This should never happen (findAmPm returned %d)", ampm); dead code: QMessageLogger(__FILE__, 736, __PRETTY_FUNCTION__).debug("This should never happen (findAmPm returned %d)", ampm); | - | ||||||||||||||||||||||||||||||||||||
606 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
607 | } | - | ||||||||||||||||||||||||||||||||||||
608 | if (state != Invalid
| 2-861 | ||||||||||||||||||||||||||||||||||||
609 | text.replace(index, used, sectiontext.left(used)); | - | ||||||||||||||||||||||||||||||||||||
610 | } executed 861 times by 5 tests: end of block Executed by:
| 861 | ||||||||||||||||||||||||||||||||||||
611 | break; executed 863 times by 5 tests: }break; Executed by:
| 863 | ||||||||||||||||||||||||||||||||||||
612 | case executed 3176 times by 10 tests: MonthSection:case MonthSection: Executed by:
executed 3176 times by 10 tests: case MonthSection: Executed by:
| 3176 | ||||||||||||||||||||||||||||||||||||
613 | case executed 40 times by 3 tests: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 40 times by 3 tests: case DayOfWeekSectionShort: Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
614 | case executed 442 times by 3 tests: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 442 times by 3 tests: case DayOfWeekSectionLong: Executed by:
| 442 | ||||||||||||||||||||||||||||||||||||
615 | if (sn.count >= 3
| 1739-1919 | ||||||||||||||||||||||||||||||||||||
616 | if (sn.type == MonthSection
| 482-1437 | ||||||||||||||||||||||||||||||||||||
617 | int min = 1; | - | ||||||||||||||||||||||||||||||||||||
618 | const QDate minDate = getMinimum().date(); | - | ||||||||||||||||||||||||||||||||||||
619 | if (currentValue.date().year() == minDate.year()
| 17-1420 | ||||||||||||||||||||||||||||||||||||
620 | min = minDate.month(); | - | ||||||||||||||||||||||||||||||||||||
621 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||
622 | num = findMonth(sectiontext.toLower(), min, sectionIndex, §iontext, &used); | - | ||||||||||||||||||||||||||||||||||||
623 | } executed 1437 times by 6 tests: else {end of block Executed by:
| 1437 | ||||||||||||||||||||||||||||||||||||
624 | num = findDay(sectiontext.toLower(), 1, sectionIndex, §iontext, &used); | - | ||||||||||||||||||||||||||||||||||||
625 | } executed 482 times by 3 tests: end of block Executed by:
| 482 | ||||||||||||||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||||||||||||||
627 | if (num != -1
| 5-1914 | ||||||||||||||||||||||||||||||||||||
628 | state = (used == sectiontext.size()
| 107-1807 | ||||||||||||||||||||||||||||||||||||
629 | text.replace(index, used, sectiontext.left(used)); | - | ||||||||||||||||||||||||||||||||||||
630 | } executed 1914 times by 6 tests: else {end of block Executed by:
| 1914 | ||||||||||||||||||||||||||||||||||||
631 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
632 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
633 | break; executed 1919 times by 6 tests: break; Executed by:
| 1919 | ||||||||||||||||||||||||||||||||||||
634 | } | - | ||||||||||||||||||||||||||||||||||||
635 | case executed 2672 times by 10 tests: DaySection:case DaySection: Executed by:
executed 2672 times by 10 tests: case DaySection: Executed by:
code before this statement executed 1739 times by 7 tests: case DaySection: Executed by:
| 1739-2672 | ||||||||||||||||||||||||||||||||||||
636 | case executed 1913 times by 6 tests: YearSection:case YearSection: Executed by:
executed 1913 times by 6 tests: case YearSection: Executed by:
| 1913 | ||||||||||||||||||||||||||||||||||||
637 | case executed 880 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 880 times by 7 tests: case YearSection2Digits: Executed by:
| 880 | ||||||||||||||||||||||||||||||||||||
638 | case executed 820 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 820 times by 5 tests: case Hour12Section: Executed by:
| 820 | ||||||||||||||||||||||||||||||||||||
639 | case executed 1276 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1276 times by 6 tests: case Hour24Section: Executed by:
| 1276 | ||||||||||||||||||||||||||||||||||||
640 | case executed 1916 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 1916 times by 8 tests: case MinuteSection: Executed by:
| 1916 | ||||||||||||||||||||||||||||||||||||
641 | case executed 1727 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 1727 times by 4 tests: case SecondSection: Executed by:
| 1727 | ||||||||||||||||||||||||||||||||||||
642 | case executed 219 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 219 times by 2 tests: {case MSecSection: Executed by:
| 219 | ||||||||||||||||||||||||||||||||||||
643 | if (sectiontextSize == 0
| 17-13145 | ||||||||||||||||||||||||||||||||||||
644 | num = 0; | - | ||||||||||||||||||||||||||||||||||||
645 | used = 0; | - | ||||||||||||||||||||||||||||||||||||
646 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
647 | } executed 17 times by 2 tests: else {end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||
648 | const int absMax = absoluteMax(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
649 | QLocale loc; | - | ||||||||||||||||||||||||||||||||||||
650 | bool ok = true; | - | ||||||||||||||||||||||||||||||||||||
651 | int last = -1; | - | ||||||||||||||||||||||||||||||||||||
652 | used = -1; | - | ||||||||||||||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||||||||||||||
654 | QString digitsStr(sectiontext); | - | ||||||||||||||||||||||||||||||||||||
655 | for (int i = 0; i < sectiontextSize
| 12948-29874 | ||||||||||||||||||||||||||||||||||||
656 | if (digitsStr.at(i).isSpace()
| 197-29677 | ||||||||||||||||||||||||||||||||||||
657 | sectiontextSize = i; | - | ||||||||||||||||||||||||||||||||||||
658 | break; executed 197 times by 4 tests: break; Executed by:
| 197 | ||||||||||||||||||||||||||||||||||||
659 | } | - | ||||||||||||||||||||||||||||||||||||
660 | } executed 29677 times by 11 tests: end of block Executed by:
| 29677 | ||||||||||||||||||||||||||||||||||||
661 | - | |||||||||||||||||||||||||||||||||||||
662 | const int max = qMin(sectionmaxsize, sectiontextSize); | - | ||||||||||||||||||||||||||||||||||||
663 | for (int digits = max; digits >= 1
| 48-14117 | ||||||||||||||||||||||||||||||||||||
664 | digitsStr.truncate(digits); | - | ||||||||||||||||||||||||||||||||||||
665 | int tmp = (int)loc.toUInt(digitsStr, &ok); | - | ||||||||||||||||||||||||||||||||||||
666 | if (ok
| 822-13105 | ||||||||||||||||||||||||||||||||||||
667 | if (tmp > 12
| 2-820 | ||||||||||||||||||||||||||||||||||||
668 | tmp = -1; | - | ||||||||||||||||||||||||||||||||||||
669 | ok = false; | - | ||||||||||||||||||||||||||||||||||||
670 | } executed 2 times by 1 test: else if (tmp == 12end of block Executed by:
| 2-720 | ||||||||||||||||||||||||||||||||||||
671 | tmp = 0; | - | ||||||||||||||||||||||||||||||||||||
672 | } executed 100 times by 3 tests: end of block Executed by:
| 100 | ||||||||||||||||||||||||||||||||||||
673 | } executed 822 times by 5 tests: end of block Executed by:
| 822 | ||||||||||||||||||||||||||||||||||||
674 | if (ok
| 6-13103 | ||||||||||||||||||||||||||||||||||||
675 | if (false) QMessageLogger(__FILE__, 806, __PRETTY_FUNCTION__).debug() << sectiontext.left(digits) << tmp << digits; dead code: QMessageLogger(__FILE__, 806, __PRETTY_FUNCTION__).debug() << sectiontext.left(digits) << tmp << digits; | - | ||||||||||||||||||||||||||||||||||||
676 | last = tmp; | - | ||||||||||||||||||||||||||||||||||||
677 | used = digits; | - | ||||||||||||||||||||||||||||||||||||
678 | break; executed 13097 times by 11 tests: break; Executed by:
| 13097 | ||||||||||||||||||||||||||||||||||||
679 | } | - | ||||||||||||||||||||||||||||||||||||
680 | } executed 1020 times by 7 tests: end of block Executed by:
| 1020 | ||||||||||||||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||||||||||||||
682 | if (last == -1
| 48-13097 | ||||||||||||||||||||||||||||||||||||
683 | QChar first(sectiontext.at(0)); | - | ||||||||||||||||||||||||||||||||||||
684 | if (separators.at(sectionIndex + 1).startsWith(first)
| 2-46 | ||||||||||||||||||||||||||||||||||||
685 | used = 0; | - | ||||||||||||||||||||||||||||||||||||
686 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
687 | } executed 46 times by 2 tests: else {end of block Executed by:
| 46 | ||||||||||||||||||||||||||||||||||||
688 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
689 | if (false) QMessageLogger(__FILE__, 820, __PRETTY_FUNCTION__).debug() << "invalid because" << sectiontext << "can't become a uint" << last << ok; dead code: QMessageLogger(__FILE__, 820, __PRETTY_FUNCTION__).debug() << "invalid because" << sectiontext << "can't become a uint" << last << ok; | - | ||||||||||||||||||||||||||||||||||||
690 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
691 | } else { | - | ||||||||||||||||||||||||||||||||||||
692 | num += last; | - | ||||||||||||||||||||||||||||||||||||
693 | const FieldInfo fi = fieldInfo(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
694 | const bool done = (used == sectionmaxsize); | - | ||||||||||||||||||||||||||||||||||||
695 | if (!done
| 1466-11631 | ||||||||||||||||||||||||||||||||||||
696 | for (int i=used; i<sectionmaxsize
| 78-148 | ||||||||||||||||||||||||||||||||||||
697 | num *= 10; | - | ||||||||||||||||||||||||||||||||||||
698 | } executed 148 times by 1 test: end of block Executed by:
| 148 | ||||||||||||||||||||||||||||||||||||
699 | } executed 78 times by 1 test: end of block Executed by:
| 78 | ||||||||||||||||||||||||||||||||||||
700 | const int absMin = absoluteMin(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
701 | if (num < absMin
| 25-13072 | ||||||||||||||||||||||||||||||||||||
702 | state = done
| 3-22 | ||||||||||||||||||||||||||||||||||||
703 | if (done
| 3-22 | ||||||||||||||||||||||||||||||||||||
704 | if (false) QMessageLogger(__FILE__, 835, __PRETTY_FUNCTION__).debug() << "invalid because" << num << "is less than absoluteMin" << absMin; dead code: QMessageLogger(__FILE__, 835, __PRETTY_FUNCTION__).debug() << "invalid because" << num << "is less than absoluteMin" << absMin; | - | ||||||||||||||||||||||||||||||||||||
705 | } executed 25 times by 1 test: else if (num > absMaxend of block Executed by:
| 0-13072 | ||||||||||||||||||||||||||||||||||||
706 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
707 | } never executed: else if (!doneend of block
| 0-11628 | ||||||||||||||||||||||||||||||||||||
708 | if (skipToNextSection(sectionIndex, currentValue, digitsStr)
| 27-438 | ||||||||||||||||||||||||||||||||||||
709 | state = Acceptable; | - | ||||||||||||||||||||||||||||||||||||
710 | const int missingZeroes = sectionmaxsize - digitsStr.size(); | - | ||||||||||||||||||||||||||||||||||||
711 | text.insert(index, QString().fill(QLatin1Char('0'), missingZeroes)); | - | ||||||||||||||||||||||||||||||||||||
712 | used = sectionmaxsize; | - | ||||||||||||||||||||||||||||||||||||
713 | cursorPosition += missingZeroes; | - | ||||||||||||||||||||||||||||||||||||
714 | ++(const_cast<QDateTimeParser*>(this)->sectionNodes[sectionIndex].zeroesAdded); | - | ||||||||||||||||||||||||||||||||||||
715 | } executed 27 times by 1 test: else {end of block Executed by:
| 27 | ||||||||||||||||||||||||||||||||||||
716 | state = Intermediate;; | - | ||||||||||||||||||||||||||||||||||||
717 | } executed 438 times by 4 tests: end of block Executed by:
| 438 | ||||||||||||||||||||||||||||||||||||
718 | } else { | - | ||||||||||||||||||||||||||||||||||||
719 | state = Acceptable; | - | ||||||||||||||||||||||||||||||||||||
720 | } executed 12607 times by 11 tests: end of block Executed by:
| 12607 | ||||||||||||||||||||||||||||||||||||
721 | } | - | ||||||||||||||||||||||||||||||||||||
722 | } | - | ||||||||||||||||||||||||||||||||||||
723 | break; executed 13162 times by 11 tests: }break; Executed by:
| 13162 | ||||||||||||||||||||||||||||||||||||
724 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
725 | QMessageLogger(__FILE__, 856, __PRETTY_FUNCTION__).warning("QDateTimeParser::parseSection Internal error (%s %d)", | - | ||||||||||||||||||||||||||||||||||||
726 | QString(sn.name()).toLocal8Bit().constData(), sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
727 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
728 | } | - | ||||||||||||||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||||||||||||||
730 | if (usedptr
| 0-15944 | ||||||||||||||||||||||||||||||||||||
731 | * executed 15944 times by 11 tests: usedptr = used;*usedptr = used; Executed by:
executed 15944 times by 11 tests: *usedptr = used; Executed by:
| 15944 | ||||||||||||||||||||||||||||||||||||
732 | - | |||||||||||||||||||||||||||||||||||||
733 | return executed 15944 times by 11 tests: (state != Invalidreturn (state != Invalid ? num : -1); Executed by:
executed 15944 times by 11 tests: return (state != Invalid ? num : -1); Executed by:
| 7-15944 | ||||||||||||||||||||||||||||||||||||
734 | } | - | ||||||||||||||||||||||||||||||||||||
735 | - | |||||||||||||||||||||||||||||||||||||
736 | - | |||||||||||||||||||||||||||||||||||||
737 | - | |||||||||||||||||||||||||||||||||||||
738 | - | |||||||||||||||||||||||||||||||||||||
739 | - | |||||||||||||||||||||||||||||||||||||
740 | - | |||||||||||||||||||||||||||||||||||||
741 | - | |||||||||||||||||||||||||||||||||||||
742 | QDateTimeParser::StateNode QDateTimeParser::parse(QString &input, int &cursorPosition, | - | ||||||||||||||||||||||||||||||||||||
743 | const QDateTime ¤tValue, bool fixup) const | - | ||||||||||||||||||||||||||||||||||||
744 | { | - | ||||||||||||||||||||||||||||||||||||
745 | const QDateTime minimum = getMinimum(); | - | ||||||||||||||||||||||||||||||||||||
746 | const QDateTime maximum = getMaximum(); | - | ||||||||||||||||||||||||||||||||||||
747 | - | |||||||||||||||||||||||||||||||||||||
748 | State state = Acceptable; | - | ||||||||||||||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||||||||||||||
750 | QDateTime newCurrentValue; | - | ||||||||||||||||||||||||||||||||||||
751 | bool conflicts = false; | - | ||||||||||||||||||||||||||||||||||||
752 | const int sectionNodesCount = sectionNodes.size(); | - | ||||||||||||||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||||||||||||||
754 | if (false) QMessageLogger(__FILE__, 885, __PRETTY_FUNCTION__).debug() << "parse" << input; dead code: QMessageLogger(__FILE__, 885, __PRETTY_FUNCTION__).debug() << "parse" << input; | - | ||||||||||||||||||||||||||||||||||||
755 | { | - | ||||||||||||||||||||||||||||||||||||
756 | int pos = 0; | - | ||||||||||||||||||||||||||||||||||||
757 | int year, month, day; | - | ||||||||||||||||||||||||||||||||||||
758 | currentValue.date().getDate(&year, &month, &day); | - | ||||||||||||||||||||||||||||||||||||
759 | int year2digits = year % 100; | - | ||||||||||||||||||||||||||||||||||||
760 | int hour = currentValue.time().hour(); | - | ||||||||||||||||||||||||||||||||||||
761 | int hour12 = -1; | - | ||||||||||||||||||||||||||||||||||||
762 | int minute = currentValue.time().minute(); | - | ||||||||||||||||||||||||||||||||||||
763 | int second = currentValue.time().second(); | - | ||||||||||||||||||||||||||||||||||||
764 | int msec = currentValue.time().msec(); | - | ||||||||||||||||||||||||||||||||||||
765 | int dayofweek = currentValue.date().dayOfWeek(); | - | ||||||||||||||||||||||||||||||||||||
766 | - | |||||||||||||||||||||||||||||||||||||
767 | int ampm = -1; | - | ||||||||||||||||||||||||||||||||||||
768 | Sections isSet = NoSection; | - | ||||||||||||||||||||||||||||||||||||
769 | int num; | - | ||||||||||||||||||||||||||||||||||||
770 | State tmpstate; | - | ||||||||||||||||||||||||||||||||||||
771 | - | |||||||||||||||||||||||||||||||||||||
772 | for (int index=0; state != Invalid
| 7-20663 | ||||||||||||||||||||||||||||||||||||
773 | if (QStringRef(&input, pos, separators.at(index).size()) != separators.at(index)
| 122-15944 | ||||||||||||||||||||||||||||||||||||
774 | if (false) QMessageLogger(__FILE__, 905, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos, separators.at(index).size()) dead code: QMessageLogger(__FILE__, 905, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex; | - | ||||||||||||||||||||||||||||||||||||
775 | << "!=" << separators.at(index) dead code: QMessageLogger(__FILE__, 905, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex; | - | ||||||||||||||||||||||||||||||||||||
776 | << index << pos << currentSectionIndex; dead code: QMessageLogger(__FILE__, 905, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos, separators.at(index).size()) << "!=" << separators.at(index) << index << pos << currentSectionIndex; | - | ||||||||||||||||||||||||||||||||||||
777 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
778 | goto executed 122 times by 2 tests: end;goto end; Executed by:
executed 122 times by 2 tests: goto end; Executed by:
| 122 | ||||||||||||||||||||||||||||||||||||
779 | } | - | ||||||||||||||||||||||||||||||||||||
780 | pos += separators.at(index).size(); | - | ||||||||||||||||||||||||||||||||||||
781 | sectionNodes[index].pos = pos; | - | ||||||||||||||||||||||||||||||||||||
782 | int *current = 0; | - | ||||||||||||||||||||||||||||||||||||
783 | const SectionNode sn = sectionNodes.at(index); | - | ||||||||||||||||||||||||||||||||||||
784 | int used; | - | ||||||||||||||||||||||||||||||||||||
785 | - | |||||||||||||||||||||||||||||||||||||
786 | num = parseSection(currentValue, index, input, cursorPosition, pos, tmpstate, &used); | - | ||||||||||||||||||||||||||||||||||||
787 | if (false) QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).debug() << "sectionValue" << sn.name() << input dead code: QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).debug() << "sectionValue" << sn.name() << input << "pos" << pos << "used" << used << stateName(tmpstate); | - | ||||||||||||||||||||||||||||||||||||
788 | << "pos" << pos << "used" << used << stateName(tmpstate); dead code: QMessageLogger(__FILE__, 918, __PRETTY_FUNCTION__).debug() << "sectionValue" << sn.name() << input << "pos" << pos << "used" << used << stateName(tmpstate); | - | ||||||||||||||||||||||||||||||||||||
789 | if (fixup
| 1-15871 | ||||||||||||||||||||||||||||||||||||
790 | const FieldInfo fi = fieldInfo(index); | - | ||||||||||||||||||||||||||||||||||||
791 | if ((
| 3-17 | ||||||||||||||||||||||||||||||||||||
792 | const QString newText = QString::fromLatin1("%1").arg(num, sn.count, 10, QLatin1Char('0')); | - | ||||||||||||||||||||||||||||||||||||
793 | input.replace(pos, used, newText); | - | ||||||||||||||||||||||||||||||||||||
794 | used = sn.count; | - | ||||||||||||||||||||||||||||||||||||
795 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||
796 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||
797 | pos += qMax(0, used); | - | ||||||||||||||||||||||||||||||||||||
798 | - | |||||||||||||||||||||||||||||||||||||
799 | state = qMin<State>(state, tmpstate); | - | ||||||||||||||||||||||||||||||||||||
800 | if (state == Intermediate
| 12-14591 | ||||||||||||||||||||||||||||||||||||
801 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
802 | break; executed 12 times by 4 tests: break; Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||
803 | } | - | ||||||||||||||||||||||||||||||||||||
804 | - | |||||||||||||||||||||||||||||||||||||
805 | if (false) QMessageLogger(__FILE__, 936, __PRETTY_FUNCTION__).debug() << index << sn.name() << "is set to" dead code: QMessageLogger(__FILE__, 936, __PRETTY_FUNCTION__).debug() << index << sn.name() << "is set to" << pos << "state is" << stateName(state); | - | ||||||||||||||||||||||||||||||||||||
806 | << pos << "state is" << stateName(state); dead code: QMessageLogger(__FILE__, 936, __PRETTY_FUNCTION__).debug() << index << sn.name() << "is set to" << pos << "state is" << stateName(state); | - | ||||||||||||||||||||||||||||||||||||
807 | - | |||||||||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||||||||
809 | if (state != Invalid
| 7-15925 | ||||||||||||||||||||||||||||||||||||
810 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
811 | case executed 1275 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1275 times by 6 tests: current = &hour; break;case Hour24Section: Executed by:
executed 1275 times by 6 tests: break; Executed by:
| 1275 | ||||||||||||||||||||||||||||||||||||
812 | case executed 820 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 820 times by 5 tests: current = &hour12; break;case Hour12Section: Executed by:
executed 820 times by 5 tests: break; Executed by:
| 820 | ||||||||||||||||||||||||||||||||||||
813 | case executed 1915 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 1915 times by 8 tests: current = &minute; break;case MinuteSection: Executed by:
executed 1915 times by 8 tests: break; Executed by:
| 1915 | ||||||||||||||||||||||||||||||||||||
814 | case executed 1727 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 1727 times by 4 tests: current = &second; break;case SecondSection: Executed by:
executed 1727 times by 4 tests: break; Executed by:
| 1727 | ||||||||||||||||||||||||||||||||||||
815 | case executed 219 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 219 times by 2 tests: current = &msec; break;case MSecSection: Executed by:
executed 219 times by 2 tests: break; Executed by:
| 219 | ||||||||||||||||||||||||||||||||||||
816 | case executed 1913 times by 6 tests: YearSection:case YearSection: Executed by:
executed 1913 times by 6 tests: current = &year; break;case YearSection: Executed by:
executed 1913 times by 6 tests: break; Executed by:
| 1913 | ||||||||||||||||||||||||||||||||||||
817 | case executed 879 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 879 times by 7 tests: current = &year2digits; break;case YearSection2Digits: Executed by:
executed 879 times by 7 tests: break; Executed by:
| 879 | ||||||||||||||||||||||||||||||||||||
818 | case executed 3173 times by 10 tests: MonthSection:case MonthSection: Executed by:
executed 3173 times by 10 tests: current = &month; break;case MonthSection: Executed by:
executed 3173 times by 10 tests: break; Executed by:
| 3173 | ||||||||||||||||||||||||||||||||||||
819 | case executed 40 times by 3 tests: DayOfWeekSectionShort:case DayOfWeekSectionShort: Executed by:
executed 40 times by 3 tests: case DayOfWeekSectionShort: Executed by:
| 40 | ||||||||||||||||||||||||||||||||||||
820 | case executed 442 times by 3 tests: DayOfWeekSectionLong:case DayOfWeekSectionLong: Executed by:
executed 442 times by 3 tests: current = &dayofweek; break;case DayOfWeekSectionLong: Executed by:
executed 482 times by 3 tests: break; Executed by:
| 442-482 | ||||||||||||||||||||||||||||||||||||
821 | case executed 2661 times by 10 tests: DaySection:case DaySection: Executed by:
executed 2661 times by 10 tests: current = &day; num = qMax<int>(1, num); break;case DaySection: Executed by:
executed 2661 times by 10 tests: break; Executed by:
| 2661 | ||||||||||||||||||||||||||||||||||||
822 | case executed 861 times by 5 tests: AmPmSection:case AmPmSection: Executed by:
executed 861 times by 5 tests: current = &m; break;case AmPmSection: Executed by:
executed 861 times by 5 tests: break; Executed by:
| 861 | ||||||||||||||||||||||||||||||||||||
823 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
824 | QMessageLogger(__FILE__, 955, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error (%s)", | - | ||||||||||||||||||||||||||||||||||||
825 | QString(sn.name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
826 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
827 | } | - | ||||||||||||||||||||||||||||||||||||
828 | if (!current
| 0-15925 | ||||||||||||||||||||||||||||||||||||
829 | QMessageLogger(__FILE__, 960, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 2"); | - | ||||||||||||||||||||||||||||||||||||
830 | return never executed: StateNode();return StateNode(); never executed: return StateNode(); | 0 | ||||||||||||||||||||||||||||||||||||
831 | } | - | ||||||||||||||||||||||||||||||||||||
832 | if (isSet & sn.type && *
| 101-416 | ||||||||||||||||||||||||||||||||||||
833 | if (false) QMessageLogger(__FILE__, 964, __PRETTY_FUNCTION__).debug() << "CONFLICT " << sn.name() << *current << num; dead code: QMessageLogger(__FILE__, 964, __PRETTY_FUNCTION__).debug() << "CONFLICT " << sn.name() << *current << num; | - | ||||||||||||||||||||||||||||||||||||
834 | conflicts = true; | - | ||||||||||||||||||||||||||||||||||||
835 | if (index != currentSectionIndex
| 0-96 | ||||||||||||||||||||||||||||||||||||
836 | continue; executed 96 times by 3 tests: continue; Executed by:
| 96 | ||||||||||||||||||||||||||||||||||||
837 | } | - | ||||||||||||||||||||||||||||||||||||
838 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||||||||||||||
839 | if (num != -1
| 5-15824 | ||||||||||||||||||||||||||||||||||||
840 | * executed 15824 times by 11 tests: current = num;*current = num; Executed by:
executed 15824 times by 11 tests: *current = num; Executed by:
| 15824 | ||||||||||||||||||||||||||||||||||||
841 | isSet |= sn.type; | - | ||||||||||||||||||||||||||||||||||||
842 | } executed 15829 times by 11 tests: end of block Executed by:
| 15829 | ||||||||||||||||||||||||||||||||||||
843 | } executed 15836 times by 11 tests: end of block Executed by:
| 15836 | ||||||||||||||||||||||||||||||||||||
844 | - | |||||||||||||||||||||||||||||||||||||
845 | if (state != Invalid
| 15-4597 | ||||||||||||||||||||||||||||||||||||
846 | if (false) QMessageLogger(__FILE__, 977, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos) dead code: QMessageLogger(__FILE__, 977, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos) << "!=" << separators.last() << pos; | - | ||||||||||||||||||||||||||||||||||||
847 | << "!=" << separators.last() << pos; dead code: QMessageLogger(__FILE__, 977, __PRETTY_FUNCTION__).debug() << "invalid because" << input.mid(pos) << "!=" << separators.last() << pos; | - | ||||||||||||||||||||||||||||||||||||
848 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
849 | } executed 15 times by 4 tests: end of block Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||||||||||||||
851 | if (state != Invalid
| 34-4582 | ||||||||||||||||||||||||||||||||||||
852 | if (parserType != QVariant::Time
| 23-4559 | ||||||||||||||||||||||||||||||||||||
853 | if (year % 100 != year2digits
| 389-4170 | ||||||||||||||||||||||||||||||||||||
854 | if (!(isSet & YearSection)
| 1-16 | ||||||||||||||||||||||||||||||||||||
855 | year = (year / 100) * 100; | - | ||||||||||||||||||||||||||||||||||||
856 | year += year2digits; | - | ||||||||||||||||||||||||||||||||||||
857 | } executed 16 times by 4 tests: else {end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||||||||
858 | conflicts = true; | - | ||||||||||||||||||||||||||||||||||||
859 | const SectionNode &sn = sectionNode(currentSectionIndex); | - | ||||||||||||||||||||||||||||||||||||
860 | if (sn.type == YearSection2Digits
| 0-1 | ||||||||||||||||||||||||||||||||||||
861 | year = (year / 100) * 100; | - | ||||||||||||||||||||||||||||||||||||
862 | year += year2digits; | - | ||||||||||||||||||||||||||||||||||||
863 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
864 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
865 | } | - | ||||||||||||||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||||||||||||||
867 | const QDate date(year, month, day); | - | ||||||||||||||||||||||||||||||||||||
868 | const int diff = dayofweek - date.dayOfWeek(); | - | ||||||||||||||||||||||||||||||||||||
869 | if (diff != 0
| 209-4023 | ||||||||||||||||||||||||||||||||||||
870 | if (isSet & DaySection
| 2-26 | ||||||||||||||||||||||||||||||||||||
871 | conflicts = true; executed 2 times by 1 test: conflicts = true; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
872 | const SectionNode &sn = sectionNode(currentSectionIndex); | - | ||||||||||||||||||||||||||||||||||||
873 | if (sn.type & DayOfWeekSectionMask
| 0-28 | ||||||||||||||||||||||||||||||||||||
874 | - | |||||||||||||||||||||||||||||||||||||
875 | day += diff; | - | ||||||||||||||||||||||||||||||||||||
876 | if (day <= 0
| 6-8 | ||||||||||||||||||||||||||||||||||||
877 | day += 7; | - | ||||||||||||||||||||||||||||||||||||
878 | } executed 8 times by 2 tests: else if (day > date.daysInMonth()end of block Executed by:
| 0-8 | ||||||||||||||||||||||||||||||||||||
879 | day -= 7; | - | ||||||||||||||||||||||||||||||||||||
880 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
881 | if (false) QMessageLogger(__FILE__, 1012, __PRETTY_FUNCTION__).debug() << year << month << day << dayofweek dead code: QMessageLogger(__FILE__, 1012, __PRETTY_FUNCTION__).debug() << year << month << day << dayofweek << diff << QDate(year, month, day).dayOfWeek(); | - | ||||||||||||||||||||||||||||||||||||
882 | << diff << QDate(year, month, day).dayOfWeek(); dead code: QMessageLogger(__FILE__, 1012, __PRETTY_FUNCTION__).debug() << year << month << day << dayofweek << diff << QDate(year, month, day).dayOfWeek(); | - | ||||||||||||||||||||||||||||||||||||
883 | } executed 14 times by 2 tests: end of block Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||
884 | } executed 28 times by 3 tests: end of block Executed by:
| 28 | ||||||||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||||||||
886 | bool needfixday = false; | - | ||||||||||||||||||||||||||||||||||||
887 | if (sectionType(currentSectionIndex) & DaySectionMask
| 1208-3351 | ||||||||||||||||||||||||||||||||||||
888 | cachedDay = day; | - | ||||||||||||||||||||||||||||||||||||
889 | } executed 1208 times by 1 test: else if (cachedDay > dayend of block Executed by:
| 12-3339 | ||||||||||||||||||||||||||||||||||||
890 | day = cachedDay; | - | ||||||||||||||||||||||||||||||||||||
891 | needfixday = true; | - | ||||||||||||||||||||||||||||||||||||
892 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||||||||||||||
894 | if (!QDate::isValid(year, month, day)
| 88-4471 | ||||||||||||||||||||||||||||||||||||
895 | if (day < 32
| 0-88 | ||||||||||||||||||||||||||||||||||||
896 | cachedDay = day; | - | ||||||||||||||||||||||||||||||||||||
897 | } executed 88 times by 2 tests: end of block Executed by:
| 88 | ||||||||||||||||||||||||||||||||||||
898 | if (day > 28
| 0-51 | ||||||||||||||||||||||||||||||||||||
899 | needfixday = true; | - | ||||||||||||||||||||||||||||||||||||
900 | } executed 51 times by 2 tests: end of block Executed by:
| 51 | ||||||||||||||||||||||||||||||||||||
901 | } executed 88 times by 2 tests: end of block Executed by:
| 88 | ||||||||||||||||||||||||||||||||||||
902 | if (needfixday
| 51-4508 | ||||||||||||||||||||||||||||||||||||
903 | if (context == FromString
| 1-50 | ||||||||||||||||||||||||||||||||||||
904 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
905 | goto executed 1 time by 1 test: end;goto end; Executed by:
executed 1 time by 1 test: goto end; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
906 | } | - | ||||||||||||||||||||||||||||||||||||
907 | if (state == Acceptable
| 0-50 | ||||||||||||||||||||||||||||||||||||
908 | day = qMin<int>(day, QDate(year, month, 1).daysInMonth()); | - | ||||||||||||||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||||||||||||||
910 | const QLocale loc = locale(); | - | ||||||||||||||||||||||||||||||||||||
911 | for (int i=0; i<sectionNodesCount
| 50-149 | ||||||||||||||||||||||||||||||||||||
912 | const SectionNode sn = sectionNode(i); | - | ||||||||||||||||||||||||||||||||||||
913 | if (sn.type & DaySection
| 38-111 | ||||||||||||||||||||||||||||||||||||
914 | input.replace(sectionPos(sn), sectionSize(i), loc.toString(day)); | - | ||||||||||||||||||||||||||||||||||||
915 | } executed 38 times by 1 test: else if (sn.type & DayOfWeekSectionMaskend of block Executed by:
| 14-97 | ||||||||||||||||||||||||||||||||||||
916 | const int dayOfWeek = QDate(year, month, day).dayOfWeek(); | - | ||||||||||||||||||||||||||||||||||||
917 | const QLocale::FormatType dayFormat = | - | ||||||||||||||||||||||||||||||||||||
918 | (sn.type == DayOfWeekSectionShort
| 1-13 | ||||||||||||||||||||||||||||||||||||
919 | ? QLocale::ShortFormat : QLocale::LongFormat); | - | ||||||||||||||||||||||||||||||||||||
920 | const QString dayName(loc.dayName(dayOfWeek, dayFormat)); | - | ||||||||||||||||||||||||||||||||||||
921 | input.replace(sectionPos(sn), sectionSize(i), dayName); | - | ||||||||||||||||||||||||||||||||||||
922 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||
923 | } executed 149 times by 1 test: end of block Executed by:
| 149 | ||||||||||||||||||||||||||||||||||||
924 | } executed 50 times by 1 test: else {end of block Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||
925 | state = qMin(Intermediate, state); | - | ||||||||||||||||||||||||||||||||||||
926 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
927 | } | - | ||||||||||||||||||||||||||||||||||||
928 | } executed 4558 times by 10 tests: end of block Executed by:
| 4558 | ||||||||||||||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||||||||||||||
930 | if (parserType != QVariant::Date
| 870-3711 | ||||||||||||||||||||||||||||||||||||
931 | if (isSet & Hour12Section
| 808-2903 | ||||||||||||||||||||||||||||||||||||
932 | const bool hasHour = isSet & Hour24Section; | - | ||||||||||||||||||||||||||||||||||||
933 | if (ampm == -1
| 0-808 | ||||||||||||||||||||||||||||||||||||
934 | if (hasHour
| 0 | ||||||||||||||||||||||||||||||||||||
935 | ampm = (hour < 12
| 0 | ||||||||||||||||||||||||||||||||||||
936 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
937 | ampm = 0; | - | ||||||||||||||||||||||||||||||||||||
938 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
939 | } | - | ||||||||||||||||||||||||||||||||||||
940 | hour12 = (ampm == 0
| 78-730 | ||||||||||||||||||||||||||||||||||||
941 | if (!hasHour
| 2-806 | ||||||||||||||||||||||||||||||||||||
942 | hour = hour12; | - | ||||||||||||||||||||||||||||||||||||
943 | } executed 806 times by 5 tests: else if (hour != hour12end of block Executed by:
| 0-806 | ||||||||||||||||||||||||||||||||||||
944 | conflicts = true; | - | ||||||||||||||||||||||||||||||||||||
945 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
946 | } executed 808 times by 5 tests: else if (ampm != -1end of block Executed by:
| 51-2852 | ||||||||||||||||||||||||||||||||||||
947 | if (!(isSet & (Hour24Section))
| 3-48 | ||||||||||||||||||||||||||||||||||||
948 | hour = (12 * ampm); | - | ||||||||||||||||||||||||||||||||||||
949 | } executed 3 times by 2 tests: else if ((end of block Executed by:
| 0-48 | ||||||||||||||||||||||||||||||||||||
950 | conflicts = true; | - | ||||||||||||||||||||||||||||||||||||
951 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
952 | } executed 51 times by 3 tests: end of block Executed by:
| 51 | ||||||||||||||||||||||||||||||||||||
953 | - | |||||||||||||||||||||||||||||||||||||
954 | } executed 3711 times by 9 tests: end of block Executed by:
| 3711 | ||||||||||||||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||||||||||||||
956 | newCurrentValue = QDateTime(QDate(year, month, day), QTime(hour, minute, second, msec), spec); | - | ||||||||||||||||||||||||||||||||||||
957 | if (false) QMessageLogger(__FILE__, 1088, __PRETTY_FUNCTION__).debug() << year << month << day << hour << minute << second << msec; dead code: QMessageLogger(__FILE__, 1088, __PRETTY_FUNCTION__).debug() << year << month << day << hour << minute << second << msec; | - | ||||||||||||||||||||||||||||||||||||
958 | } executed 4581 times by 11 tests: end of block Executed by:
| 4581 | ||||||||||||||||||||||||||||||||||||
959 | if (false) QMessageLogger(__FILE__, 1090, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), dead code: QMessageLogger(__FILE__, 1090, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
960 | newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), dead code: QMessageLogger(__FILE__, 1090, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
961 | stateName(state).toLatin1().constData()); dead code: QMessageLogger(__FILE__, 1090, __PRETTY_FUNCTION__).debug("'%s' => '%s'(%s)", input.toLatin1().constData(), newCurrentValue.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")).toLatin1().constData(), stateName(state).toLatin1().constData()); | - | ||||||||||||||||||||||||||||||||||||
962 | } | - | ||||||||||||||||||||||||||||||||||||
963 | end: code before this statement executed 4615 times by 11 tests: end: Executed by:
| 4615 | ||||||||||||||||||||||||||||||||||||
964 | if (newCurrentValue.isValid()
| 194-4544 | ||||||||||||||||||||||||||||||||||||
965 | if (context != FromString
| 0-4049 | ||||||||||||||||||||||||||||||||||||
966 | const QLatin1Char space(' '); | - | ||||||||||||||||||||||||||||||||||||
967 | if (newCurrentValue >= minimum
| 0-53 | ||||||||||||||||||||||||||||||||||||
968 | QMessageLogger(__FILE__, 1099, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 3 (%s %s)", never executed: QMessageLogger(__FILE__, 1099, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 3 (%s %s)", QString(newCurrentValue.toString()).toLocal8Bit().constData(), QString(minimum.toString()).toLocal8Bit().constData()); | 0 | ||||||||||||||||||||||||||||||||||||
969 | QString(newCurrentValue.toString()).toLocal8Bit().constData(), QString(minimum.toString()).toLocal8Bit().constData()); never executed: QMessageLogger(__FILE__, 1099, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 3 (%s %s)", QString(newCurrentValue.toString()).toLocal8Bit().constData(), QString(minimum.toString()).toLocal8Bit().constData()); | 0 | ||||||||||||||||||||||||||||||||||||
970 | - | |||||||||||||||||||||||||||||||||||||
971 | bool done = false; | - | ||||||||||||||||||||||||||||||||||||
972 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
973 | for (int i=0; i<sectionNodesCount
| 9-138 | ||||||||||||||||||||||||||||||||||||
974 | const SectionNode &sn = sectionNodes.at(i); | - | ||||||||||||||||||||||||||||||||||||
975 | QString t = sectionText(input, i, sn.pos).toLower(); | - | ||||||||||||||||||||||||||||||||||||
976 | if ((t.size() < sectionMaxSize(i)
| 0-74 | ||||||||||||||||||||||||||||||||||||
977 | || t.contains(space)
| 0-74 | ||||||||||||||||||||||||||||||||||||
978 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
979 | case never executed: AmPmSection:case AmPmSection: never executed: case AmPmSection: | 0 | ||||||||||||||||||||||||||||||||||||
980 | switch (findAmPm(t, i)) { | - | ||||||||||||||||||||||||||||||||||||
981 | case never executed: AM:case AM: never executed: case AM: | 0 | ||||||||||||||||||||||||||||||||||||
982 | case never executed: PM:case PM: never executed: case PM: | 0 | ||||||||||||||||||||||||||||||||||||
983 | state = Acceptable; | - | ||||||||||||||||||||||||||||||||||||
984 | done = true; | - | ||||||||||||||||||||||||||||||||||||
985 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
986 | case never executed: Neither:case Neither: never executed: case Neither: | 0 | ||||||||||||||||||||||||||||||||||||
987 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
988 | done = true; | - | ||||||||||||||||||||||||||||||||||||
989 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
990 | case never executed: PossibleAM:case PossibleAM: never executed: case PossibleAM: | 0 | ||||||||||||||||||||||||||||||||||||
991 | case never executed: PossiblePM:case PossiblePM: never executed: case PossiblePM: | 0 | ||||||||||||||||||||||||||||||||||||
992 | case never executed: PossibleBoth:case PossibleBoth: never executed: {case PossibleBoth: | 0 | ||||||||||||||||||||||||||||||||||||
993 | const QDateTime copy(newCurrentValue.addSecs(12 * 60 * 60)); | - | ||||||||||||||||||||||||||||||||||||
994 | if (copy >= minimum
| 0 | ||||||||||||||||||||||||||||||||||||
995 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
996 | done = true; | - | ||||||||||||||||||||||||||||||||||||
997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
998 | break; never executed: }break; | 0 | ||||||||||||||||||||||||||||||||||||
999 | } | - | ||||||||||||||||||||||||||||||||||||
1000 | case executed 3 times by 1 test: case MonthSection: Executed by:
code before this statement never executed: case MonthSection: executed 3 times by 1 test: MonthSection:case MonthSection: Executed by:
code before this statement never executed: case MonthSection: executed 3 times by 1 test: case MonthSection: Executed by:
| 0-3 | ||||||||||||||||||||||||||||||||||||
1001 | if (sn.count >= 3
| 0-3 | ||||||||||||||||||||||||||||||||||||
1002 | int tmp = newCurrentValue.date().month(); | - | ||||||||||||||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||||||||||||||
1004 | while ((
| 3-6 | ||||||||||||||||||||||||||||||||||||
1005 | const QDateTime copy(newCurrentValue.addMonths(tmp - newCurrentValue.date().month())); | - | ||||||||||||||||||||||||||||||||||||
1006 | if (copy >= minimum
| 0-6 | ||||||||||||||||||||||||||||||||||||
1007 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1008 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
1009 | if (tmp == -1
| 0-3 | ||||||||||||||||||||||||||||||||||||
1010 | break; executed 3 times by 1 test: break; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1011 | } | - | ||||||||||||||||||||||||||||||||||||
1012 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
1013 | done = true; | - | ||||||||||||||||||||||||||||||||||||
1014 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1015 | } | - | ||||||||||||||||||||||||||||||||||||
1016 | - | |||||||||||||||||||||||||||||||||||||
1017 | default executed 52 times by 1 test: default: Executed by:
code before this statement never executed: default: executed 52 times by 1 test: :default: Executed by:
code before this statement never executed: default: executed 52 times by 1 test: {default: Executed by:
| 0-52 | ||||||||||||||||||||||||||||||||||||
1018 | int toMin; | - | ||||||||||||||||||||||||||||||||||||
1019 | int toMax; | - | ||||||||||||||||||||||||||||||||||||
1020 | - | |||||||||||||||||||||||||||||||||||||
1021 | if (sn.type & TimeSectionMask
| 20-32 | ||||||||||||||||||||||||||||||||||||
1022 | if (newCurrentValue.daysTo(minimum) != 0
| 0-20 | ||||||||||||||||||||||||||||||||||||
1023 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1024 | } | - | ||||||||||||||||||||||||||||||||||||
1025 | toMin = newCurrentValue.time().msecsTo(minimum.time()); | - | ||||||||||||||||||||||||||||||||||||
1026 | if (newCurrentValue.daysTo(maximum) > 0
| 0-20 | ||||||||||||||||||||||||||||||||||||
1027 | toMax = -1; | - | ||||||||||||||||||||||||||||||||||||
1028 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
1029 | toMax = newCurrentValue.time().msecsTo(maximum.time()); | - | ||||||||||||||||||||||||||||||||||||
1030 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||
1031 | } else { | - | ||||||||||||||||||||||||||||||||||||
1032 | toMin = newCurrentValue.daysTo(minimum); | - | ||||||||||||||||||||||||||||||||||||
1033 | toMax = newCurrentValue.daysTo(maximum); | - | ||||||||||||||||||||||||||||||||||||
1034 | } executed 32 times by 1 test: end of block Executed by:
| 32 | ||||||||||||||||||||||||||||||||||||
1035 | const int maxChange = sn.maxChange(); | - | ||||||||||||||||||||||||||||||||||||
1036 | if (toMin > maxChange
| 0-52 | ||||||||||||||||||||||||||||||||||||
1037 | if (false) QMessageLogger(__FILE__, 1168, __PRETTY_FUNCTION__).debug() << "invalid because toMin > maxChange" << toMin dead code: QMessageLogger(__FILE__, 1168, __PRETTY_FUNCTION__).debug() << "invalid because toMin > maxChange" << toMin << maxChange << t << newCurrentValue << minimum; | - | ||||||||||||||||||||||||||||||||||||
1038 | << maxChange << t << newCurrentValue << minimum; dead code: QMessageLogger(__FILE__, 1168, __PRETTY_FUNCTION__).debug() << "invalid because toMin > maxChange" << toMin << maxChange << t << newCurrentValue << minimum; | - | ||||||||||||||||||||||||||||||||||||
1039 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
1040 | done = true; | - | ||||||||||||||||||||||||||||||||||||
1041 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1042 | } else if (toMax > maxChange
| 14-38 | ||||||||||||||||||||||||||||||||||||
1043 | toMax = -1; | - | ||||||||||||||||||||||||||||||||||||
1044 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||
1045 | - | |||||||||||||||||||||||||||||||||||||
1046 | const int min = getDigit(minimum, i); | - | ||||||||||||||||||||||||||||||||||||
1047 | if (min == -1
| 0-52 | ||||||||||||||||||||||||||||||||||||
1048 | QMessageLogger(__FILE__, 1179, __PRETTY_FUNCTION__).warning("QDateTimeParser::parse Internal error 4 (%s)", | - | ||||||||||||||||||||||||||||||||||||
1049 | QString(sn.name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
1050 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
1051 | done = true; | - | ||||||||||||||||||||||||||||||||||||
1052 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1053 | } | - | ||||||||||||||||||||||||||||||||||||
1054 | - | |||||||||||||||||||||||||||||||||||||
1055 | int max = toMax != -1
| 14-38 | ||||||||||||||||||||||||||||||||||||
1056 | int pos = cursorPosition - sn.pos; | - | ||||||||||||||||||||||||||||||||||||
1057 | if (pos < 0
| 4-48 | ||||||||||||||||||||||||||||||||||||
1058 | pos = -1; executed 45 times by 1 test: pos = -1; Executed by:
| 45 | ||||||||||||||||||||||||||||||||||||
1059 | if (!potentialValue(t.simplified(), min, max, i, newCurrentValue, pos)
| 2-50 | ||||||||||||||||||||||||||||||||||||
1060 | if (false) QMessageLogger(__FILE__, 1191, __PRETTY_FUNCTION__).debug() << "invalid because potentialValue(" << t.simplified() << min << max dead code: QMessageLogger(__FILE__, 1191, __PRETTY_FUNCTION__).debug() << "invalid because potentialValue(" << t.simplified() << min << max << sn.name() << "returned" << toMax << toMin << pos; | - | ||||||||||||||||||||||||||||||||||||
1061 | << sn.name() << "returned" << toMax << toMin << pos; dead code: QMessageLogger(__FILE__, 1191, __PRETTY_FUNCTION__).debug() << "invalid because potentialValue(" << t.simplified() << min << max << sn.name() << "returned" << toMax << toMin << pos; | - | ||||||||||||||||||||||||||||||||||||
1062 | state = Invalid; | - | ||||||||||||||||||||||||||||||||||||
1063 | done = true; | - | ||||||||||||||||||||||||||||||||||||
1064 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
1065 | } | - | ||||||||||||||||||||||||||||||||||||
1066 | state = Intermediate; | - | ||||||||||||||||||||||||||||||||||||
1067 | done = true; | - | ||||||||||||||||||||||||||||||||||||
1068 | break; executed 50 times by 1 test: }break; Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||
1069 | } | - | ||||||||||||||||||||||||||||||||||||
1070 | } | - | ||||||||||||||||||||||||||||||||||||
1071 | } executed 129 times by 1 test: end of block Executed by:
| 129 | ||||||||||||||||||||||||||||||||||||
1072 | } executed 53 times by 1 test: else {end of block Executed by:
| 53 | ||||||||||||||||||||||||||||||||||||
1073 | if (context == FromString
| 495-3996 | ||||||||||||||||||||||||||||||||||||
1074 | - | |||||||||||||||||||||||||||||||||||||
1075 | ((!(getMaximum().date().toJulianDay() == 4642999)) ? qt_assert("getMaximum().date().toJulianDay() == 4642999",__FILE__,1206) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
1076 | if (newCurrentValue.date().toJulianDay() > 4642999
| 0-495 | ||||||||||||||||||||||||||||||||||||
1077 | state = Invalid; never executed: state = Invalid; | 0 | ||||||||||||||||||||||||||||||||||||
1078 | } executed 495 times by 8 tests: else {end of block Executed by:
| 495 | ||||||||||||||||||||||||||||||||||||
1079 | if (newCurrentValue > getMaximum()
| 1-3995 | ||||||||||||||||||||||||||||||||||||
1080 | state = Invalid; executed 1 time by 1 test: state = Invalid; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1081 | } executed 3996 times by 4 tests: end of block Executed by:
| 3996 | ||||||||||||||||||||||||||||||||||||
1082 | - | |||||||||||||||||||||||||||||||||||||
1083 | if (false) QMessageLogger(__FILE__, 1214, __PRETTY_FUNCTION__).debug() << "not checking intermediate because newCurrentValue is" << newCurrentValue << getMinimum() << getMaximum(); dead code: QMessageLogger(__FILE__, 1214, __PRETTY_FUNCTION__).debug() << "not checking intermediate because newCurrentValue is" << newCurrentValue << getMinimum() << getMaximum(); | - | ||||||||||||||||||||||||||||||||||||
1084 | } executed 4491 times by 11 tests: end of block Executed by:
| 4491 | ||||||||||||||||||||||||||||||||||||
1085 | } | - | ||||||||||||||||||||||||||||||||||||
1086 | StateNode node; | - | ||||||||||||||||||||||||||||||||||||
1087 | node.input = input; | - | ||||||||||||||||||||||||||||||||||||
1088 | node.state = state; | - | ||||||||||||||||||||||||||||||||||||
1089 | node.conflicts = conflicts; | - | ||||||||||||||||||||||||||||||||||||
1090 | node.value = newCurrentValue.toTimeSpec(spec); | - | ||||||||||||||||||||||||||||||||||||
1091 | text = input; | - | ||||||||||||||||||||||||||||||||||||
1092 | return executed 4738 times by 11 tests: node;return node; Executed by:
executed 4738 times by 11 tests: return node; Executed by:
| 4738 | ||||||||||||||||||||||||||||||||||||
1093 | } | - | ||||||||||||||||||||||||||||||||||||
1094 | int QDateTimeParser::findMonth(const QString &str1, int startMonth, int sectionIndex, | - | ||||||||||||||||||||||||||||||||||||
1095 | QString *usedMonth, int *used) const | - | ||||||||||||||||||||||||||||||||||||
1096 | { | - | ||||||||||||||||||||||||||||||||||||
1097 | int bestMatch = -1; | - | ||||||||||||||||||||||||||||||||||||
1098 | int bestCount = 0; | - | ||||||||||||||||||||||||||||||||||||
1099 | if (!str1.isEmpty()
| 0-1446 | ||||||||||||||||||||||||||||||||||||
1100 | const SectionNode &sn = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
1101 | if (sn.type != MonthSection
| 0-1446 | ||||||||||||||||||||||||||||||||||||
1102 | QMessageLogger(__FILE__, 1242, __PRETTY_FUNCTION__).warning("QDateTimeParser::findMonth Internal error"); | - | ||||||||||||||||||||||||||||||||||||
1103 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
1104 | } | - | ||||||||||||||||||||||||||||||||||||
1105 | - | |||||||||||||||||||||||||||||||||||||
1106 | QLocale::FormatType type = sn.count == 3
| 219-1227 | ||||||||||||||||||||||||||||||||||||
1107 | QLocale l = locale(); | - | ||||||||||||||||||||||||||||||||||||
1108 | - | |||||||||||||||||||||||||||||||||||||
1109 | for (int month=startMonth; month<=12
| 118-6730 | ||||||||||||||||||||||||||||||||||||
1110 | QString str2 = l.monthName(month, type).toLower(); | - | ||||||||||||||||||||||||||||||||||||
1111 | - | |||||||||||||||||||||||||||||||||||||
1112 | if (str1.startsWith(str2)
| 1325-5405 | ||||||||||||||||||||||||||||||||||||
1113 | if (used
| 0-1325 | ||||||||||||||||||||||||||||||||||||
1114 | if (false) QMessageLogger(__FILE__, 1254, __PRETTY_FUNCTION__).debug() << "used is set to" << str2.size(); dead code: QMessageLogger(__FILE__, 1254, __PRETTY_FUNCTION__).debug() << "used is set to" << str2.size(); | - | ||||||||||||||||||||||||||||||||||||
1115 | *used = str2.size(); | - | ||||||||||||||||||||||||||||||||||||
1116 | } executed 1325 times by 6 tests: end of block Executed by:
| 1325 | ||||||||||||||||||||||||||||||||||||
1117 | if (usedMonth
| 0-1325 | ||||||||||||||||||||||||||||||||||||
1118 | * executed 1325 times by 6 tests: usedMonth = l.monthName(month, type);*usedMonth = l.monthName(month, type); Executed by:
executed 1325 times by 6 tests: *usedMonth = l.monthName(month, type); Executed by:
| 1325 | ||||||||||||||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||||||||||||||
1120 | return executed 1325 times by 6 tests: month;return month; Executed by:
executed 1325 times by 6 tests: return month; Executed by:
| 1325 | ||||||||||||||||||||||||||||||||||||
1121 | } | - | ||||||||||||||||||||||||||||||||||||
1122 | if (context == FromString
| 1599-3806 | ||||||||||||||||||||||||||||||||||||
1123 | continue; executed 3806 times by 5 tests: continue; Executed by:
| 3806 | ||||||||||||||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||||||||||||||
1125 | const int limit = qMin(str1.size(), str2.size()); | - | ||||||||||||||||||||||||||||||||||||
1126 | - | |||||||||||||||||||||||||||||||||||||
1127 | if (false) QMessageLogger(__FILE__, 1267, __PRETTY_FUNCTION__).debug() << "limit is" << limit << str1 << str2; dead code: QMessageLogger(__FILE__, 1267, __PRETTY_FUNCTION__).debug() << "limit is" << limit << str1 << str2; | - | ||||||||||||||||||||||||||||||||||||
1128 | bool equal = true; | - | ||||||||||||||||||||||||||||||||||||
1129 | for (int i=0; i<limit
| 3-2263 | ||||||||||||||||||||||||||||||||||||
1130 | if (str1.at(i) != str2.at(i)
| 667-1596 | ||||||||||||||||||||||||||||||||||||
1131 | equal = false; | - | ||||||||||||||||||||||||||||||||||||
1132 | if (i > bestCount
| 177-1419 | ||||||||||||||||||||||||||||||||||||
1133 | bestCount = i; | - | ||||||||||||||||||||||||||||||||||||
1134 | bestMatch = month; | - | ||||||||||||||||||||||||||||||||||||
1135 | } executed 177 times by 1 test: end of block Executed by:
| 177 | ||||||||||||||||||||||||||||||||||||
1136 | break; executed 1596 times by 1 test: break; Executed by:
| 1596 | ||||||||||||||||||||||||||||||||||||
1137 | } | - | ||||||||||||||||||||||||||||||||||||
1138 | } executed 667 times by 1 test: end of block Executed by:
| 667 | ||||||||||||||||||||||||||||||||||||
1139 | if (equal
| 3-1596 | ||||||||||||||||||||||||||||||||||||
1140 | if (used
| 0-3 | ||||||||||||||||||||||||||||||||||||
1141 | * executed 3 times by 1 test: used = limit;*used = limit; Executed by:
executed 3 times by 1 test: *used = limit; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1142 | if (usedMonth
| 0-3 | ||||||||||||||||||||||||||||||||||||
1143 | * executed 3 times by 1 test: usedMonth = l.monthName(month, type);*usedMonth = l.monthName(month, type); Executed by:
executed 3 times by 1 test: *usedMonth = l.monthName(month, type); Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1144 | return executed 3 times by 1 test: month;return month; Executed by:
executed 3 times by 1 test: return month; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1145 | } | - | ||||||||||||||||||||||||||||||||||||
1146 | } executed 1596 times by 1 test: end of block Executed by:
| 1596 | ||||||||||||||||||||||||||||||||||||
1147 | if (usedMonth
| 5-109 | ||||||||||||||||||||||||||||||||||||
1148 | * executed 104 times by 1 test: usedMonth = l.monthName(bestMatch, type);*usedMonth = l.monthName(bestMatch, type); Executed by:
executed 104 times by 1 test: *usedMonth = l.monthName(bestMatch, type); Executed by:
| 104 | ||||||||||||||||||||||||||||||||||||
1149 | } executed 118 times by 1 test: end of block Executed by:
| 118 | ||||||||||||||||||||||||||||||||||||
1150 | if (used
| 9-109 | ||||||||||||||||||||||||||||||||||||
1151 | if (false) QMessageLogger(__FILE__, 1291, __PRETTY_FUNCTION__).debug() << "used is set to" << bestCount; dead code: QMessageLogger(__FILE__, 1291, __PRETTY_FUNCTION__).debug() << "used is set to" << bestCount; | - | ||||||||||||||||||||||||||||||||||||
1152 | *used = bestCount; | - | ||||||||||||||||||||||||||||||||||||
1153 | } executed 109 times by 1 test: end of block Executed by:
| 109 | ||||||||||||||||||||||||||||||||||||
1154 | return executed 118 times by 1 test: bestMatch;return bestMatch; Executed by:
executed 118 times by 1 test: return bestMatch; Executed by:
| 118 | ||||||||||||||||||||||||||||||||||||
1155 | } | - | ||||||||||||||||||||||||||||||||||||
1156 | - | |||||||||||||||||||||||||||||||||||||
1157 | int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex, QString *usedDay, int *used) const | - | ||||||||||||||||||||||||||||||||||||
1158 | { | - | ||||||||||||||||||||||||||||||||||||
1159 | int bestMatch = -1; | - | ||||||||||||||||||||||||||||||||||||
1160 | int bestCount = 0; | - | ||||||||||||||||||||||||||||||||||||
1161 | if (!str1.isEmpty()
| 0-482 | ||||||||||||||||||||||||||||||||||||
1162 | const SectionNode &sn = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
1163 | if (!(sn.type & DaySectionMask)
| 0-482 | ||||||||||||||||||||||||||||||||||||
1164 | QMessageLogger(__FILE__, 1304, __PRETTY_FUNCTION__).warning("QDateTimeParser::findDay Internal error"); | - | ||||||||||||||||||||||||||||||||||||
1165 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
1166 | } | - | ||||||||||||||||||||||||||||||||||||
1167 | const QLocale l = locale(); | - | ||||||||||||||||||||||||||||||||||||
1168 | for (int day=startDay; day<=7
| 482-3374 | ||||||||||||||||||||||||||||||||||||
1169 | const QString dayName = l.dayName(day, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); | - | ||||||||||||||||||||||||||||||||||||
1170 | const QString str2 = dayName.toLower(); | - | ||||||||||||||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||||||||||||||
1172 | const int limit = qMin(str1.size(), str2.size()); | - | ||||||||||||||||||||||||||||||||||||
1173 | int i = 0; | - | ||||||||||||||||||||||||||||||||||||
1174 | while (i < limit
| 488-6442 | ||||||||||||||||||||||||||||||||||||
1175 | ++ executed 3556 times by 3 tests: i;++i; Executed by:
executed 3556 times by 3 tests: ++i; Executed by:
| 3556 | ||||||||||||||||||||||||||||||||||||
1176 | if (i > bestCount
| 602-2772 | ||||||||||||||||||||||||||||||||||||
1177 | bestCount = i; | - | ||||||||||||||||||||||||||||||||||||
1178 | bestMatch = day; | - | ||||||||||||||||||||||||||||||||||||
1179 | } executed 602 times by 3 tests: end of block Executed by:
| 602 | ||||||||||||||||||||||||||||||||||||
1180 | } executed 3374 times by 3 tests: end of block Executed by:
| 3374 | ||||||||||||||||||||||||||||||||||||
1181 | if (usedDay
| 0-482 | ||||||||||||||||||||||||||||||||||||
1182 | *usedDay = l.dayName(bestMatch, sn.count == 4 ? QLocale::LongFormat : QLocale::ShortFormat); | - | ||||||||||||||||||||||||||||||||||||
1183 | } executed 482 times by 3 tests: end of block Executed by:
| 482 | ||||||||||||||||||||||||||||||||||||
1184 | } executed 482 times by 3 tests: end of block Executed by:
| 482 | ||||||||||||||||||||||||||||||||||||
1185 | if (used
| 0-482 | ||||||||||||||||||||||||||||||||||||
1186 | * executed 482 times by 3 tests: used = bestCount;*used = bestCount; Executed by:
executed 482 times by 3 tests: *used = bestCount; Executed by:
| 482 | ||||||||||||||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||||||||||||||
1188 | return executed 482 times by 3 tests: bestMatch;return bestMatch; Executed by:
executed 482 times by 3 tests: return bestMatch; Executed by:
| 482 | ||||||||||||||||||||||||||||||||||||
1189 | } | - | ||||||||||||||||||||||||||||||||||||
1190 | QDateTimeParser::AmPmFinder QDateTimeParser::findAmPm(QString &str, int sectionIndex, int *used) const | - | ||||||||||||||||||||||||||||||||||||
1191 | { | - | ||||||||||||||||||||||||||||||||||||
1192 | const SectionNode &s = sectionNode(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
1193 | if (s.type != AmPmSection
| 0-863 | ||||||||||||||||||||||||||||||||||||
1194 | QMessageLogger(__FILE__, 1347, __PRETTY_FUNCTION__).warning("QDateTimeParser::findAmPm Internal error"); | - | ||||||||||||||||||||||||||||||||||||
1195 | return never executed: Neither;return Neither; never executed: return Neither; | 0 | ||||||||||||||||||||||||||||||||||||
1196 | } | - | ||||||||||||||||||||||||||||||||||||
1197 | if (used
| 0-863 | ||||||||||||||||||||||||||||||||||||
1198 | * executed 863 times by 5 tests: used = str.size();*used = str.size(); Executed by:
executed 863 times by 5 tests: *used = str.size(); Executed by:
| 863 | ||||||||||||||||||||||||||||||||||||
1199 | if (str.trimmed().isEmpty()
| 0-863 | ||||||||||||||||||||||||||||||||||||
1200 | return never executed: PossibleBoth;return PossibleBoth; never executed: return PossibleBoth; | 0 | ||||||||||||||||||||||||||||||||||||
1201 | } | - | ||||||||||||||||||||||||||||||||||||
1202 | const QLatin1Char space(' '); | - | ||||||||||||||||||||||||||||||||||||
1203 | int size = sectionMaxSize(sectionIndex); | - | ||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||
1205 | enum { | - | ||||||||||||||||||||||||||||||||||||
1206 | amindex = 0, | - | ||||||||||||||||||||||||||||||||||||
1207 | pmindex = 1 | - | ||||||||||||||||||||||||||||||||||||
1208 | }; | - | ||||||||||||||||||||||||||||||||||||
1209 | QString ampm[2]; | - | ||||||||||||||||||||||||||||||||||||
1210 | ampm[amindex] = getAmPmText(AmText, s.count == 1 ? UpperCase : LowerCase); | - | ||||||||||||||||||||||||||||||||||||
1211 | ampm[pmindex] = getAmPmText(PmText, s.count == 1 ? UpperCase : LowerCase); | - | ||||||||||||||||||||||||||||||||||||
1212 | for (int i=0; i<2
| 863-1726 | ||||||||||||||||||||||||||||||||||||
1213 | ampm[i].truncate(size); executed 1726 times by 5 tests: ampm[i].truncate(size); Executed by:
| 1726 | ||||||||||||||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||||||||||||||
1215 | if (false) QMessageLogger(__FILE__, 1368, __PRETTY_FUNCTION__).debug() << "findAmPm" << str << ampm[0] << ampm[1]; dead code: QMessageLogger(__FILE__, 1368, __PRETTY_FUNCTION__).debug() << "findAmPm" << str << ampm[0] << ampm[1]; | - | ||||||||||||||||||||||||||||||||||||
1216 | - | |||||||||||||||||||||||||||||||||||||
1217 | if (str.indexOf(ampm[amindex], 0, Qt::CaseInsensitive) == 0
| 105-758 | ||||||||||||||||||||||||||||||||||||
1218 | str = ampm[amindex]; | - | ||||||||||||||||||||||||||||||||||||
1219 | return executed 758 times by 5 tests: AM;return AM; Executed by:
executed 758 times by 5 tests: return AM; Executed by:
| 758 | ||||||||||||||||||||||||||||||||||||
1220 | } else if (str.indexOf(ampm[pmindex], 0, Qt::CaseInsensitive) == 0
| 2-103 | ||||||||||||||||||||||||||||||||||||
1221 | str = ampm[pmindex]; | - | ||||||||||||||||||||||||||||||||||||
1222 | return executed 103 times by 3 tests: PM;return PM; Executed by:
executed 103 times by 3 tests: return PM; Executed by:
| 103 | ||||||||||||||||||||||||||||||||||||
1223 | } else if (context == FromString
| 0-1 | ||||||||||||||||||||||||||||||||||||
1224 | return executed 1 time by 1 test: Neither;return Neither; Executed by:
executed 1 time by 1 test: return Neither; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1225 | } | - | ||||||||||||||||||||||||||||||||||||
1226 | size = qMin(size, str.size()); | - | ||||||||||||||||||||||||||||||||||||
1227 | - | |||||||||||||||||||||||||||||||||||||
1228 | bool broken[2] = {false, false}; | - | ||||||||||||||||||||||||||||||||||||
1229 | for (int i=0; i<size
| 0-1 | ||||||||||||||||||||||||||||||||||||
1230 | if (str.at(i) != space
| 0-1 | ||||||||||||||||||||||||||||||||||||
1231 | for (int j=0; j<2
| 0-2 | ||||||||||||||||||||||||||||||||||||
1232 | if (!broken[j]
| 0-2 | ||||||||||||||||||||||||||||||||||||
1233 | int index = ampm[j].indexOf(str.at(i)); | - | ||||||||||||||||||||||||||||||||||||
1234 | if (false) QMessageLogger(__FILE__, 1387, __PRETTY_FUNCTION__).debug() << "looking for" << str.at(i) dead code: QMessageLogger(__FILE__, 1387, __PRETTY_FUNCTION__).debug() << "looking for" << str.at(i) << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1235 | << "in" << ampm[j] << "and got" << index; dead code: QMessageLogger(__FILE__, 1387, __PRETTY_FUNCTION__).debug() << "looking for" << str.at(i) << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1236 | if (index == -1
| 0-2 | ||||||||||||||||||||||||||||||||||||
1237 | if (str.at(i).category() == QChar::Letter_Uppercase
| 0-2 | ||||||||||||||||||||||||||||||||||||
1238 | index = ampm[j].indexOf(str.at(i).toLower()); | - | ||||||||||||||||||||||||||||||||||||
1239 | if (false) QMessageLogger(__FILE__, 1392, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toLower() dead code: QMessageLogger(__FILE__, 1392, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toLower() << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1240 | << "in" << ampm[j] << "and got" << index; dead code: QMessageLogger(__FILE__, 1392, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toLower() << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1241 | } never executed: else if (str.at(i).category() == QChar::Letter_Lowercaseend of block
| 0-2 | ||||||||||||||||||||||||||||||||||||
1242 | index = ampm[j].indexOf(str.at(i).toUpper()); | - | ||||||||||||||||||||||||||||||||||||
1243 | if (false) QMessageLogger(__FILE__, 1396, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toUpper() dead code: QMessageLogger(__FILE__, 1396, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toUpper() << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1244 | << "in" << ampm[j] << "and got" << index; dead code: QMessageLogger(__FILE__, 1396, __PRETTY_FUNCTION__).debug() << "trying with" << str.at(i).toUpper() << "in" << ampm[j] << "and got" << index; | - | ||||||||||||||||||||||||||||||||||||
1245 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1246 | if (index == -1
| 0-2 | ||||||||||||||||||||||||||||||||||||
1247 | broken[j] = true; | - | ||||||||||||||||||||||||||||||||||||
1248 | if (broken[amindex]
| 0-2 | ||||||||||||||||||||||||||||||||||||
1249 | if (false) QMessageLogger(__FILE__, 1402, __PRETTY_FUNCTION__).debug() << str << "didn't make it"; dead code: QMessageLogger(__FILE__, 1402, __PRETTY_FUNCTION__).debug() << str << "didn't make it"; | - | ||||||||||||||||||||||||||||||||||||
1250 | return executed 1 time by 1 test: Neither;return Neither; Executed by:
executed 1 time by 1 test: return Neither; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1251 | } | - | ||||||||||||||||||||||||||||||||||||
1252 | continue; executed 1 time by 1 test: continue; Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
1253 | } else { | - | ||||||||||||||||||||||||||||||||||||
1254 | str[i] = ampm[j].at(index); | - | ||||||||||||||||||||||||||||||||||||
1255 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1256 | } | - | ||||||||||||||||||||||||||||||||||||
1257 | ampm[j].remove(index, 1); | - | ||||||||||||||||||||||||||||||||||||
1258 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1259 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1262 | if (!broken[pmindex]
| 0 | ||||||||||||||||||||||||||||||||||||
1263 | return never executed: PossibleBoth;return PossibleBoth; never executed: return PossibleBoth; | 0 | ||||||||||||||||||||||||||||||||||||
1264 | return never executed: (!broken[amindex]return (!broken[amindex] ? PossibleAM : PossiblePM);
never executed: return (!broken[amindex] ? PossibleAM : PossiblePM); | 0 | ||||||||||||||||||||||||||||||||||||
1265 | } | - | ||||||||||||||||||||||||||||||||||||
1266 | - | |||||||||||||||||||||||||||||||||||||
1267 | - | |||||||||||||||||||||||||||||||||||||
1268 | - | |||||||||||||||||||||||||||||||||||||
1269 | - | |||||||||||||||||||||||||||||||||||||
1270 | - | |||||||||||||||||||||||||||||||||||||
1271 | - | |||||||||||||||||||||||||||||||||||||
1272 | int QDateTimeParser::SectionNode::maxChange() const | - | ||||||||||||||||||||||||||||||||||||
1273 | { | - | ||||||||||||||||||||||||||||||||||||
1274 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
1275 | - | |||||||||||||||||||||||||||||||||||||
1276 | case never executed: MSecSection:case MSecSection: never executed: returncase MSecSection: never executed: 999;return 999; never executed: return 999; | 0 | ||||||||||||||||||||||||||||||||||||
1277 | case never executed: SecondSection:case SecondSection: never executed: returncase SecondSection: never executed: 59 * 1000;return 59 * 1000; never executed: return 59 * 1000; | 0 | ||||||||||||||||||||||||||||||||||||
1278 | case executed 11 times by 1 test: MinuteSection:case MinuteSection: Executed by:
executed 11 times by 1 test: returncase MinuteSection: Executed by:
executed 11 times by 1 test: 59 * 60 * 1000;return 59 * 60 * 1000; Executed by:
executed 11 times by 1 test: return 59 * 60 * 1000; Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||
1279 | case executed 9 times by 1 test: Hour24Section:case Hour24Section: Executed by:
executed 9 times by 1 test: casecase Hour24Section: Executed by:
never executed: Hour12Section:case Hour12Section: never executed: returncase Hour12Section: executed 9 times by 1 test: 59 * 60 * 60 * 1000;return 59 * 60 * 60 * 1000; Executed by:
executed 9 times by 1 test: return 59 * 60 * 60 * 1000; Executed by:
| 0-9 | ||||||||||||||||||||||||||||||||||||
1280 | - | |||||||||||||||||||||||||||||||||||||
1281 | - | |||||||||||||||||||||||||||||||||||||
1282 | case never executed: DayOfWeekSectionShort:case DayOfWeekSectionShort: never executed: case DayOfWeekSectionShort: | 0 | ||||||||||||||||||||||||||||||||||||
1283 | case never executed: DayOfWeekSectionLong:case DayOfWeekSectionLong: never executed: returncase DayOfWeekSectionLong: never executed: 7;return 7; never executed: return 7; | 0 | ||||||||||||||||||||||||||||||||||||
1284 | case never executed: DaySection:case DaySection: never executed: returncase DaySection: never executed: 30;return 30; never executed: return 30; | 0 | ||||||||||||||||||||||||||||||||||||
1285 | case never executed: MonthSection:case MonthSection: never executed: returncase MonthSection: never executed: 365 - 31;return 365 - 31; never executed: return 365 - 31; | 0 | ||||||||||||||||||||||||||||||||||||
1286 | case executed 29 times by 1 test: YearSection:case YearSection: Executed by:
executed 29 times by 1 test: returncase YearSection: Executed by:
executed 29 times by 1 test: 9999 * 365;return 9999 * 365; Executed by:
executed 29 times by 1 test: return 9999 * 365; Executed by:
| 29 | ||||||||||||||||||||||||||||||||||||
1287 | case executed 3 times by 1 test: YearSection2Digits:case YearSection2Digits: Executed by:
executed 3 times by 1 test: returncase YearSection2Digits: Executed by:
executed 3 times by 1 test: 100 * 365;return 100 * 365; Executed by:
executed 3 times by 1 test: return 100 * 365; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1288 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1289 | QMessageLogger(__FILE__, 1442, __PRETTY_FUNCTION__).warning("QDateTimeParser::maxChange() Internal error (%s)", | - | ||||||||||||||||||||||||||||||||||||
1290 | QString(name()).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
1291 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1292 | - | |||||||||||||||||||||||||||||||||||||
1293 | return never executed: -1;return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
1294 | } | - | ||||||||||||||||||||||||||||||||||||
1295 | - | |||||||||||||||||||||||||||||||||||||
1296 | QDateTimeParser::FieldInfo QDateTimeParser::fieldInfo(int index) const | - | ||||||||||||||||||||||||||||||||||||
1297 | { | - | ||||||||||||||||||||||||||||||||||||
1298 | FieldInfo ret = 0; | - | ||||||||||||||||||||||||||||||||||||
1299 | const SectionNode &sn = sectionNode(index); | - | ||||||||||||||||||||||||||||||||||||
1300 | switch (sn.type) { | - | ||||||||||||||||||||||||||||||||||||
1301 | case executed 221 times by 2 tests: MSecSection:case MSecSection: Executed by:
executed 221 times by 2 tests: case MSecSection: Executed by:
| 221 | ||||||||||||||||||||||||||||||||||||
1302 | ret |= Fraction; | - | ||||||||||||||||||||||||||||||||||||
1303 | - | |||||||||||||||||||||||||||||||||||||
1304 | case executed 1736 times by 4 tests: SecondSection:case SecondSection: Executed by:
executed 1736 times by 4 tests: case SecondSection: Executed by:
code before this statement executed 221 times by 2 tests: case SecondSection: Executed by:
| 221-1736 | ||||||||||||||||||||||||||||||||||||
1305 | case executed 1952 times by 8 tests: MinuteSection:case MinuteSection: Executed by:
executed 1952 times by 8 tests: case MinuteSection: Executed by:
| 1952 | ||||||||||||||||||||||||||||||||||||
1306 | case executed 1299 times by 6 tests: Hour24Section:case Hour24Section: Executed by:
executed 1299 times by 6 tests: case Hour24Section: Executed by:
| 1299 | ||||||||||||||||||||||||||||||||||||
1307 | case executed 831 times by 5 tests: Hour12Section:case Hour12Section: Executed by:
executed 831 times by 5 tests: case Hour12Section: Executed by:
| 831 | ||||||||||||||||||||||||||||||||||||
1308 | case executed 1932 times by 6 tests: YearSection:case YearSection: Executed by:
executed 1932 times by 6 tests: case YearSection: Executed by:
| 1932 | ||||||||||||||||||||||||||||||||||||
1309 | case executed 883 times by 7 tests: YearSection2Digits:case YearSection2Digits: Executed by:
executed 883 times by 7 tests: case YearSection2Digits: Executed by:
| 883 | ||||||||||||||||||||||||||||||||||||
1310 | ret |= Numeric; | - | ||||||||||||||||||||||||||||||||||||
1311 | if (sn.type != YearSection
| 1932-6922 | ||||||||||||||||||||||||||||||||||||
1312 | ret |= AllowPartial; | - | ||||||||||||||||||||||||||||||||||||
1313 | } executed 6922 times by 10 tests: end of block Executed by:
| 6922 | ||||||||||||||||||||||||||||||||||||
1314 | if (sn.count != 1
| 318-8536 | ||||||||||||||||||||||||||||||||||||
1315 | ret |= FixedWidth; | - | ||||||||||||||||||||||||||||||||||||
1316 | } executed 8536 times by 11 tests: end of block Executed by:
| 8536 | ||||||||||||||||||||||||||||||||||||
1317 | break; executed 8854 times by 11 tests: break; Executed by:
| 8854 | ||||||||||||||||||||||||||||||||||||
1318 | case executed 1786 times by 7 tests: MonthSection:case MonthSection: Executed by:
executed 1786 times by 7 tests: case MonthSection: Executed by:
| 1786 | ||||||||||||||||||||||||||||||||||||
1319 | case executed 2715 times by 10 tests: DaySection:case DaySection: Executed by:
executed 2715 times by 10 tests: case DaySection: Executed by:
| 2715 | ||||||||||||||||||||||||||||||||||||
1320 | switch (sn.count) { | - | ||||||||||||||||||||||||||||||||||||
1321 | case executed 3511 times by 7 tests: 2:case 2: Executed by:
executed 3511 times by 7 tests: case 2: Executed by:
| 3511 | ||||||||||||||||||||||||||||||||||||
1322 | ret |= FixedWidth; | - | ||||||||||||||||||||||||||||||||||||
1323 | - | |||||||||||||||||||||||||||||||||||||
1324 | case executed 970 times by 7 tests: 1:case 1: Executed by:
executed 970 times by 7 tests: case 1: Executed by:
code before this statement executed 3511 times by 7 tests: case 1: Executed by:
| 970-3511 | ||||||||||||||||||||||||||||||||||||
1325 | ret |= (Numeric|AllowPartial); | - | ||||||||||||||||||||||||||||||||||||
1326 | break; executed 4481 times by 10 tests: break; Executed by:
| 4481 | ||||||||||||||||||||||||||||||||||||
1327 | } | - | ||||||||||||||||||||||||||||||||||||
1328 | break; executed 4501 times by 10 tests: break; Executed by:
| 4501 | ||||||||||||||||||||||||||||||||||||
1329 | case never executed: DayOfWeekSectionShort:case DayOfWeekSectionShort: never executed: case DayOfWeekSectionShort: | 0 | ||||||||||||||||||||||||||||||||||||
1330 | case never executed: DayOfWeekSectionLong:case DayOfWeekSectionLong: never executed: case DayOfWeekSectionLong: | 0 | ||||||||||||||||||||||||||||||||||||
1331 | if (sn.count == 3
| 0 | ||||||||||||||||||||||||||||||||||||
1332 | ret |= FixedWidth; never executed: ret |= FixedWidth; | 0 | ||||||||||||||||||||||||||||||||||||
1333 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1334 | case never executed: AmPmSection:case AmPmSection: never executed: case AmPmSection: | 0 | ||||||||||||||||||||||||||||||||||||
1335 | ret |= FixedWidth; | - | ||||||||||||||||||||||||||||||||||||
1336 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1337 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1338 | QMessageLogger(__FILE__, 1491, __PRETTY_FUNCTION__).warning("QDateTimeParser::fieldInfo Internal error 2 (%d %s %d)", | - | ||||||||||||||||||||||||||||||||||||
1339 | index, QString(sn.name()).toLocal8Bit().constData(), sn.count); | - | ||||||||||||||||||||||||||||||||||||
1340 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1341 | } | - | ||||||||||||||||||||||||||||||||||||
1342 | return executed 13355 times by 11 tests: ret;return ret; Executed by:
executed 13355 times by 11 tests: return ret; Executed by:
| 13355 | ||||||||||||||||||||||||||||||||||||
1343 | } | - | ||||||||||||||||||||||||||||||||||||
1344 | - | |||||||||||||||||||||||||||||||||||||
1345 | QString QDateTimeParser::SectionNode::format() const | - | ||||||||||||||||||||||||||||||||||||
1346 | { | - | ||||||||||||||||||||||||||||||||||||
1347 | QChar fillChar; | - | ||||||||||||||||||||||||||||||||||||
1348 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
1349 | case never executed: AmPmSection:case AmPmSection: never executed: returncase AmPmSection: never executed: count == 1return count == 1 ? QLatin1String("AP") : QLatin1String("ap");
never executed: return count == 1 ? QLatin1String("AP") : QLatin1String("ap"); | 0 | ||||||||||||||||||||||||||||||||||||
1350 | case never executed: MSecSection:case MSecSection: never executed: fillChar = QLatin1Char('z'); break;case MSecSection: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1351 | case never executed: SecondSection:case SecondSection: never executed: fillChar = QLatin1Char('s'); break;case SecondSection: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1352 | case never executed: MinuteSection:case MinuteSection: never executed: fillChar = QLatin1Char('m'); break;case MinuteSection: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1353 | case never executed: Hour24Section:case Hour24Section: never executed: fillChar = QLatin1Char('H'); break;case Hour24Section: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1354 | case never executed: Hour12Section:case Hour12Section: never executed: fillChar = QLatin1Char('h'); break;case Hour12Section: never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1355 | case never executed: DayOfWeekSectionShort:case DayOfWeekSectionShort: never executed: case DayOfWeekSectionShort: | 0 | ||||||||||||||||||||||||||||||||||||
1356 | case never executed: DayOfWeekSectionLong:case DayOfWeekSectionLong: never executed: case DayOfWeekSectionLong: | 0 | ||||||||||||||||||||||||||||||||||||
1357 | case executed 2 times by 1 test: DaySection:case DaySection: Executed by:
executed 2 times by 1 test: fillChar = QLatin1Char('d'); break;case DaySection: Executed by:
executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
1358 | case executed 2 times by 1 test: MonthSection:case MonthSection: Executed by:
executed 2 times by 1 test: fillChar = QLatin1Char('M'); break;case MonthSection: Executed by:
executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
1359 | case never executed: YearSection2Digits:case YearSection2Digits: never executed: case YearSection2Digits: | 0 | ||||||||||||||||||||||||||||||||||||
1360 | case executed 2 times by 1 test: YearSection:case YearSection: Executed by:
executed 2 times by 1 test: fillChar = QLatin1Char('y'); break;case YearSection: Executed by:
executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
1361 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1362 | QMessageLogger(__FILE__, 1515, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionFormat Internal error (%s)", | - | ||||||||||||||||||||||||||||||||||||
1363 | QString(name(type)).toLocal8Bit().constData()); | - | ||||||||||||||||||||||||||||||||||||
1364 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||||||||
1365 | } | - | ||||||||||||||||||||||||||||||||||||
1366 | if (fillChar.isNull()
| 0-6 | ||||||||||||||||||||||||||||||||||||
1367 | QMessageLogger(__FILE__, 1520, __PRETTY_FUNCTION__).warning("QDateTimeParser::sectionFormat Internal error 2"); | - | ||||||||||||||||||||||||||||||||||||
1368 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||||||||
1369 | } | - | ||||||||||||||||||||||||||||||||||||
1370 | - | |||||||||||||||||||||||||||||||||||||
1371 | QString str; | - | ||||||||||||||||||||||||||||||||||||
1372 | str.fill(fillChar, count); | - | ||||||||||||||||||||||||||||||||||||
1373 | return executed 6 times by 1 test: str;return str; Executed by:
executed 6 times by 1 test: return str; Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
1374 | } | - | ||||||||||||||||||||||||||||||||||||
1375 | bool QDateTimeParser::potentialValue(const QString &str, int min, int max, int index, | - | ||||||||||||||||||||||||||||||||||||
1376 | const QDateTime ¤tValue, int insert) const | - | ||||||||||||||||||||||||||||||||||||
1377 | { | - | ||||||||||||||||||||||||||||||||||||
1378 | if (str.isEmpty()
| 3-1610 | ||||||||||||||||||||||||||||||||||||
1379 | return executed 3 times by 1 test: true;return true; Executed by:
executed 3 times by 1 test: return true; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1380 | } | - | ||||||||||||||||||||||||||||||||||||
1381 | const int size = sectionMaxSize(index); | - | ||||||||||||||||||||||||||||||||||||
1382 | int val = (int)locale().toUInt(str); | - | ||||||||||||||||||||||||||||||||||||
1383 | const SectionNode &sn = sectionNode(index); | - | ||||||||||||||||||||||||||||||||||||
1384 | if (sn.type == YearSection2Digits
| 20-1590 | ||||||||||||||||||||||||||||||||||||
1385 | val += currentValue.date().year() - (currentValue.date().year() % 100); | - | ||||||||||||||||||||||||||||||||||||
1386 | } executed 20 times by 2 tests: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||||||||
1387 | if (val >= min
| 201-1409 | ||||||||||||||||||||||||||||||||||||
1388 | return executed 495 times by 4 tests: true;return true; Executed by:
executed 495 times by 4 tests: return true; Executed by:
| 495 | ||||||||||||||||||||||||||||||||||||
1389 | } else if (val > max
| 410-705 | ||||||||||||||||||||||||||||||||||||
1390 | return executed 410 times by 1 test: false;return false; Executed by:
executed 410 times by 1 test: return false; Executed by:
| 410 | ||||||||||||||||||||||||||||||||||||
1391 | } else if (str.size() == size
| 0-590 | ||||||||||||||||||||||||||||||||||||
1392 | return executed 115 times by 1 test: false;return false; Executed by:
executed 115 times by 1 test: return false; Executed by:
| 115 | ||||||||||||||||||||||||||||||||||||
1393 | } | - | ||||||||||||||||||||||||||||||||||||
1394 | - | |||||||||||||||||||||||||||||||||||||
1395 | const int len = size - str.size(); | - | ||||||||||||||||||||||||||||||||||||
1396 | for (int i=0; i<len
| 45-590 | ||||||||||||||||||||||||||||||||||||
1397 | for (int j=0; j<10
| 45-1061 | ||||||||||||||||||||||||||||||||||||
1398 | if (potentialValue(str + QLatin1Char('0' + j), min, max, index, currentValue, insert)
| 519-542 | ||||||||||||||||||||||||||||||||||||
1399 | return executed 542 times by 4 tests: true;return true; Executed by:
executed 542 times by 4 tests: return true; Executed by:
| 542 | ||||||||||||||||||||||||||||||||||||
1400 | } else if (insert >= 0
| 9-510 | ||||||||||||||||||||||||||||||||||||
1401 | QString tmp = str; | - | ||||||||||||||||||||||||||||||||||||
1402 | tmp.insert(insert, QLatin1Char('0' + j)); | - | ||||||||||||||||||||||||||||||||||||
1403 | if (potentialValue(tmp, min, max, index, currentValue, insert)
| 3-6 | ||||||||||||||||||||||||||||||||||||
1404 | return executed 3 times by 1 test: true;return true; Executed by:
executed 3 times by 1 test: return true; Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
1405 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
1406 | } executed 516 times by 1 test: end of block Executed by:
| 516 | ||||||||||||||||||||||||||||||||||||
1407 | } executed 45 times by 1 test: end of block Executed by:
| 45 | ||||||||||||||||||||||||||||||||||||
1408 | - | |||||||||||||||||||||||||||||||||||||
1409 | return executed 45 times by 1 test: false;return false; Executed by:
executed 45 times by 1 test: return false; Executed by:
| 45 | ||||||||||||||||||||||||||||||||||||
1410 | } | - | ||||||||||||||||||||||||||||||||||||
1411 | - | |||||||||||||||||||||||||||||||||||||
1412 | bool QDateTimeParser::skipToNextSection(int index, const QDateTime ¤t, const QString &text) const | - | ||||||||||||||||||||||||||||||||||||
1413 | { | - | ||||||||||||||||||||||||||||||||||||
1414 | ((!(current >= getMinimum() && current <= getMaximum())) ? qt_assert("current >= getMinimum() && current <= getMaximum()",__FILE__,1576) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
1415 | - | |||||||||||||||||||||||||||||||||||||
1416 | const SectionNode &node = sectionNode(index); | - | ||||||||||||||||||||||||||||||||||||
1417 | ((!(text.size() < sectionMaxSize(index))) ? qt_assert("text.size() < sectionMaxSize(index)",__FILE__,1579) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||||||||||||||
1419 | const QDateTime maximum = getMaximum(); | - | ||||||||||||||||||||||||||||||||||||
1420 | const QDateTime minimum = getMinimum(); | - | ||||||||||||||||||||||||||||||||||||
1421 | QDateTime tmp = current; | - | ||||||||||||||||||||||||||||||||||||
1422 | int min = absoluteMin(index); | - | ||||||||||||||||||||||||||||||||||||
1423 | setDigit(tmp, index, min); | - | ||||||||||||||||||||||||||||||||||||
1424 | if (tmp < minimum
| 17-474 | ||||||||||||||||||||||||||||||||||||
1425 | min = getDigit(minimum, index); | - | ||||||||||||||||||||||||||||||||||||
1426 | } executed 17 times by 1 test: end of block Executed by:
| 17 | ||||||||||||||||||||||||||||||||||||
1427 | - | |||||||||||||||||||||||||||||||||||||
1428 | int max = absoluteMax(index, current); | - | ||||||||||||||||||||||||||||||||||||
1429 | setDigit(tmp, index, max); | - | ||||||||||||||||||||||||||||||||||||
1430 | if (tmp > maximum
| 33-458 | ||||||||||||||||||||||||||||||||||||
1431 | max = getDigit(maximum, index); | - | ||||||||||||||||||||||||||||||||||||
1432 | } executed 33 times by 2 tests: end of block Executed by:
| 33 | ||||||||||||||||||||||||||||||||||||
1433 | int pos = cursorPosition() - node.pos; | - | ||||||||||||||||||||||||||||||||||||
1434 | if (pos < 0
| 7-479 | ||||||||||||||||||||||||||||||||||||
1435 | pos = -1; executed 484 times by 4 tests: pos = -1; Executed by:
| 484 | ||||||||||||||||||||||||||||||||||||
1436 | - | |||||||||||||||||||||||||||||||||||||
1437 | const bool potential = potentialValue(text, min, max, index, current, pos); | - | ||||||||||||||||||||||||||||||||||||
1438 | return executed 491 times by 4 tests: !potential;return !potential; Executed by:
executed 491 times by 4 tests: return !potential; Executed by:
| 491 | ||||||||||||||||||||||||||||||||||||
1439 | - | |||||||||||||||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||||||||||||||
1441 | - | |||||||||||||||||||||||||||||||||||||
1442 | - | |||||||||||||||||||||||||||||||||||||
1443 | - | |||||||||||||||||||||||||||||||||||||
1444 | - | |||||||||||||||||||||||||||||||||||||
1445 | } | - | ||||||||||||||||||||||||||||||||||||
1446 | - | |||||||||||||||||||||||||||||||||||||
1447 | - | |||||||||||||||||||||||||||||||||||||
1448 | - | |||||||||||||||||||||||||||||||||||||
1449 | - | |||||||||||||||||||||||||||||||||||||
1450 | - | |||||||||||||||||||||||||||||||||||||
1451 | - | |||||||||||||||||||||||||||||||||||||
1452 | QString QDateTimeParser::SectionNode::name(QDateTimeParser::Section s) | - | ||||||||||||||||||||||||||||||||||||
1453 | { | - | ||||||||||||||||||||||||||||||||||||
1454 | switch (s) { | - | ||||||||||||||||||||||||||||||||||||
1455 | case never executed: QDateTimeParser::AmPmSection:case QDateTimeParser::AmPmSection: never executed: returncase QDateTimeParser::AmPmSection: never executed: QLatin1String("AmPmSection");return QLatin1String("AmPmSection"); never executed: return QLatin1String("AmPmSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1456 | case never executed: QDateTimeParser::DaySection:case QDateTimeParser::DaySection: never executed: returncase QDateTimeParser::DaySection: never executed: QLatin1String("DaySection");return QLatin1String("DaySection"); never executed: return QLatin1String("DaySection"); | 0 | ||||||||||||||||||||||||||||||||||||
1457 | case never executed: QDateTimeParser::DayOfWeekSectionShort:case QDateTimeParser::DayOfWeekSectionShort: never executed: returncase QDateTimeParser::DayOfWeekSectionShort: never executed: QLatin1String("DayOfWeekSectionShort");return QLatin1String("DayOfWeekSectionShort"); never executed: return QLatin1String("DayOfWeekSectionShort"); | 0 | ||||||||||||||||||||||||||||||||||||
1458 | case never executed: QDateTimeParser::DayOfWeekSectionLong:case QDateTimeParser::DayOfWeekSectionLong: never executed: returncase QDateTimeParser::DayOfWeekSectionLong: never executed: QLatin1String("DayOfWeekSectionLong");return QLatin1String("DayOfWeekSectionLong"); never executed: return QLatin1String("DayOfWeekSectionLong"); | 0 | ||||||||||||||||||||||||||||||||||||
1459 | case never executed: QDateTimeParser::Hour24Section:case QDateTimeParser::Hour24Section: never executed: returncase QDateTimeParser::Hour24Section: never executed: QLatin1String("Hour24Section");return QLatin1String("Hour24Section"); never executed: return QLatin1String("Hour24Section"); | 0 | ||||||||||||||||||||||||||||||||||||
1460 | case never executed: QDateTimeParser::Hour12Section:case QDateTimeParser::Hour12Section: never executed: returncase QDateTimeParser::Hour12Section: never executed: QLatin1String("Hour12Section");return QLatin1String("Hour12Section"); never executed: return QLatin1String("Hour12Section"); | 0 | ||||||||||||||||||||||||||||||||||||
1461 | case never executed: QDateTimeParser::MSecSection:case QDateTimeParser::MSecSection: never executed: returncase QDateTimeParser::MSecSection: never executed: QLatin1String("MSecSection");return QLatin1String("MSecSection"); never executed: return QLatin1String("MSecSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1462 | case never executed: QDateTimeParser::MinuteSection:case QDateTimeParser::MinuteSection: never executed: returncase QDateTimeParser::MinuteSection: never executed: QLatin1String("MinuteSection");return QLatin1String("MinuteSection"); never executed: return QLatin1String("MinuteSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1463 | case never executed: QDateTimeParser::MonthSection:case QDateTimeParser::MonthSection: never executed: returncase QDateTimeParser::MonthSection: never executed: QLatin1String("MonthSection");return QLatin1String("MonthSection"); never executed: return QLatin1String("MonthSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1464 | case never executed: QDateTimeParser::SecondSection:case QDateTimeParser::SecondSection: never executed: returncase QDateTimeParser::SecondSection: never executed: QLatin1String("SecondSection");return QLatin1String("SecondSection"); never executed: return QLatin1String("SecondSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1465 | case never executed: QDateTimeParser::YearSection:case QDateTimeParser::YearSection: never executed: returncase QDateTimeParser::YearSection: never executed: QLatin1String("YearSection");return QLatin1String("YearSection"); never executed: return QLatin1String("YearSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1466 | case never executed: QDateTimeParser::YearSection2Digits:case QDateTimeParser::YearSection2Digits: never executed: returncase QDateTimeParser::YearSection2Digits: never executed: QLatin1String("YearSection2Digits");return QLatin1String("YearSection2Digits"); never executed: return QLatin1String("YearSection2Digits"); | 0 | ||||||||||||||||||||||||||||||||||||
1467 | case never executed: QDateTimeParser::NoSection:case QDateTimeParser::NoSection: never executed: returncase QDateTimeParser::NoSection: never executed: QLatin1String("NoSection");return QLatin1String("NoSection"); never executed: return QLatin1String("NoSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1468 | case never executed: QDateTimeParser::FirstSection:case QDateTimeParser::FirstSection: never executed: returncase QDateTimeParser::FirstSection: never executed: QLatin1String("FirstSection");return QLatin1String("FirstSection"); never executed: return QLatin1String("FirstSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1469 | case never executed: QDateTimeParser::LastSection:case QDateTimeParser::LastSection: never executed: returncase QDateTimeParser::LastSection: never executed: QLatin1String("LastSection");return QLatin1String("LastSection"); never executed: return QLatin1String("LastSection"); | 0 | ||||||||||||||||||||||||||||||||||||
1470 | default never executed: :default: never executed: returndefault: never executed: QLatin1String("Unknown section ") + QString::number(int(s));return QLatin1String("Unknown section ") + QString::number(int(s)); never executed: return QLatin1String("Unknown section ") + QString::number(int(s)); | 0 | ||||||||||||||||||||||||||||||||||||
1471 | } | - | ||||||||||||||||||||||||||||||||||||
1472 | } | - | ||||||||||||||||||||||||||||||||||||
1473 | - | |||||||||||||||||||||||||||||||||||||
1474 | - | |||||||||||||||||||||||||||||||||||||
1475 | - | |||||||||||||||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||||||||||||||
1477 | - | |||||||||||||||||||||||||||||||||||||
1478 | - | |||||||||||||||||||||||||||||||||||||
1479 | QString QDateTimeParser::stateName(State s) const | - | ||||||||||||||||||||||||||||||||||||
1480 | { | - | ||||||||||||||||||||||||||||||||||||
1481 | switch (s) { | - | ||||||||||||||||||||||||||||||||||||
1482 | case never executed: Invalid:case Invalid: never executed: returncase Invalid: never executed: QLatin1String("Invalid");return QLatin1String("Invalid"); never executed: return QLatin1String("Invalid"); | 0 | ||||||||||||||||||||||||||||||||||||
1483 | case never executed: Intermediate:case Intermediate: never executed: returncase Intermediate: never executed: QLatin1String("Intermediate");return QLatin1String("Intermediate"); never executed: return QLatin1String("Intermediate"); | 0 | ||||||||||||||||||||||||||||||||||||
1484 | case never executed: Acceptable:case Acceptable: never executed: returncase Acceptable: never executed: QLatin1String("Acceptable");return QLatin1String("Acceptable"); never executed: return QLatin1String("Acceptable"); | 0 | ||||||||||||||||||||||||||||||||||||
1485 | default never executed: :default: never executed: returndefault: never executed: QLatin1String("Unknown state ") + QString::number(s);return QLatin1String("Unknown state ") + QString::number(s); never executed: return QLatin1String("Unknown state ") + QString::number(s); | 0 | ||||||||||||||||||||||||||||||||||||
1486 | } | - | ||||||||||||||||||||||||||||||||||||
1487 | } | - | ||||||||||||||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||||||||
1490 | bool QDateTimeParser::fromString(const QString &t, QDate *date, QTime *time) const | - | ||||||||||||||||||||||||||||||||||||
1491 | { | - | ||||||||||||||||||||||||||||||||||||
1492 | QDateTime val(QDate(1900, 1, 1), QTime(0, 0, 0, 0)); | - | ||||||||||||||||||||||||||||||||||||
1493 | QString text = t; | - | ||||||||||||||||||||||||||||||||||||
1494 | int copy = -1; | - | ||||||||||||||||||||||||||||||||||||
1495 | const StateNode tmp = parse(text, copy, val, false); | - | ||||||||||||||||||||||||||||||||||||
1496 | if (tmp.state != Acceptable
| 5-495 | ||||||||||||||||||||||||||||||||||||
1497 | return executed 148 times by 4 tests: false;return false; Executed by:
executed 148 times by 4 tests: return false; Executed by:
| 148 | ||||||||||||||||||||||||||||||||||||
1498 | } | - | ||||||||||||||||||||||||||||||||||||
1499 | if (time
| 36-454 | ||||||||||||||||||||||||||||||||||||
1500 | const QTime t = tmp.value.time(); | - | ||||||||||||||||||||||||||||||||||||
1501 | if (!t.isValid()
| 0-454 | ||||||||||||||||||||||||||||||||||||
1502 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
1503 | } | - | ||||||||||||||||||||||||||||||||||||
1504 | *time = t; | - | ||||||||||||||||||||||||||||||||||||
1505 | } executed 454 times by 7 tests: end of block Executed by:
| 454 | ||||||||||||||||||||||||||||||||||||
1506 | - | |||||||||||||||||||||||||||||||||||||
1507 | if (date
| 6-484 | ||||||||||||||||||||||||||||||||||||
1508 | const QDate d = tmp.value.date(); | - | ||||||||||||||||||||||||||||||||||||
1509 | if (!d.isValid()
| 0-484 | ||||||||||||||||||||||||||||||||||||
1510 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
1511 | } | - | ||||||||||||||||||||||||||||||||||||
1512 | *date = d; | - | ||||||||||||||||||||||||||||||||||||
1513 | } executed 484 times by 7 tests: end of block Executed by:
| 484 | ||||||||||||||||||||||||||||||||||||
1514 | return executed 490 times by 8 tests: true;return true; Executed by:
executed 490 times by 8 tests: return true; Executed by:
| 490 | ||||||||||||||||||||||||||||||||||||
1515 | } | - | ||||||||||||||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||||||||||||||
1518 | QDateTime QDateTimeParser::getMinimum() const | - | ||||||||||||||||||||||||||||||||||||
1519 | { | - | ||||||||||||||||||||||||||||||||||||
1520 | return executed 1175 times by 8 tests: QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0), spec);return QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0), spec); Executed by:
executed 1175 times by 8 tests: return QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0), spec); Executed by:
| 1175 | ||||||||||||||||||||||||||||||||||||
1521 | } | - | ||||||||||||||||||||||||||||||||||||
1522 | - | |||||||||||||||||||||||||||||||||||||
1523 | QDateTime QDateTimeParser::getMaximum() const | - | ||||||||||||||||||||||||||||||||||||
1524 | { | - | ||||||||||||||||||||||||||||||||||||
1525 | return executed 1139 times by 8 tests: QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999), spec);return QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999), spec); Executed by:
executed 1139 times by 8 tests: return QDateTime(QDate(7999, 12, 31), QTime(23, 59, 59, 999), spec); Executed by:
| 1139 | ||||||||||||||||||||||||||||||||||||
1526 | } | - | ||||||||||||||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||||||||||||||
1528 | QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const | - | ||||||||||||||||||||||||||||||||||||
1529 | { | - | ||||||||||||||||||||||||||||||||||||
1530 | const QLocale loc = locale(); | - | ||||||||||||||||||||||||||||||||||||
1531 | QString raw = ap == AmText
| 60 | ||||||||||||||||||||||||||||||||||||
1532 | return executed 120 times by 2 tests: cs == UpperCasereturn cs == UpperCase ? raw.toUpper() : raw.toLower(); Executed by:
executed 120 times by 2 tests: return cs == UpperCase ? raw.toUpper() : raw.toLower(); Executed by:
| 56-120 | ||||||||||||||||||||||||||||||||||||
1533 | } | - | ||||||||||||||||||||||||||||||||||||
1534 | - | |||||||||||||||||||||||||||||||||||||
1535 | - | |||||||||||||||||||||||||||||||||||||
1536 | - | |||||||||||||||||||||||||||||||||||||
1537 | - | |||||||||||||||||||||||||||||||||||||
1538 | - | |||||||||||||||||||||||||||||||||||||
1539 | - | |||||||||||||||||||||||||||||||||||||
1540 | - | |||||||||||||||||||||||||||||||||||||
1541 | bool operator==(const QDateTimeParser::SectionNode &s1, const QDateTimeParser::SectionNode &s2) | - | ||||||||||||||||||||||||||||||||||||
1542 | { | - | ||||||||||||||||||||||||||||||||||||
1543 | return never executed: (return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count);
never executed: return (s1.type == s2.type) && (s1.pos == s2.pos) && (s1.count == s2.count); | 0 | ||||||||||||||||||||||||||||||||||||
1544 | } | - | ||||||||||||||||||||||||||||||||||||
1545 | - | |||||||||||||||||||||||||||||||||||||
1546 | - | |||||||||||||||||||||||||||||||||||||
1547 | - | |||||||||||||||||||||||||||||||||||||
1548 | - | |||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |