Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportDesign.cpp
Show First 20 Lines • Show All 200 Lines • ▼ Show 20 Line(s) | 198 | if (!plugin) { | |||
---|---|---|---|---|---|
201 | } | 201 | } | ||
202 | return KReportElement(); | 202 | return KReportElement(); | ||
203 | } | 203 | } | ||
204 | return plugin->createElement(); | 204 | return plugin->createElement(); | ||
205 | } | 205 | } | ||
206 | 206 | | |||
207 | bool KReportDesign::hasSection(KReportSection::Type type) const | 207 | bool KReportDesign::hasSection(KReportSection::Type type) const | ||
208 | { | 208 | { | ||
209 | const int index = type - 1; | 209 | const int index = static_cast<int>(type) - 1; | ||
210 | if (0 <= index && index < d->sections.length()) { | 210 | if (0 <= index && index < d->sections.length()) { | ||
211 | return d->sections[index]; | 211 | return d->sections[index]; | ||
212 | } | 212 | } | ||
213 | return false; | 213 | return false; | ||
214 | } | 214 | } | ||
215 | 215 | | |||
216 | KReportSection KReportDesign::section(KReportSection::Type type) const | 216 | KReportSection KReportDesign::section(KReportSection::Type type) const | ||
217 | { | 217 | { | ||
218 | const int index = type - 1; | 218 | const int index = static_cast<int>(type) - 1; | ||
219 | if (0 <= index && index < d->sections.length()) { | 219 | if (0 <= index && index < d->sections.length()) { | ||
220 | KReportSection *section = d->sections[index]; | 220 | KReportSection *section = d->sections[index]; | ||
221 | if (section) { | 221 | if (section) { | ||
222 | return *section; | 222 | return *section; | ||
223 | } | 223 | } | ||
224 | } | 224 | } | ||
225 | return KReportSection(); | 225 | return KReportSection(); | ||
226 | } | 226 | } | ||
227 | 227 | | |||
228 | void KReportDesign::addSection(const KReportSection §ion) | 228 | void KReportDesign::addSection(const KReportSection §ion) | ||
229 | { | 229 | { | ||
230 | const int index = section.type() - 1; | 230 | const int index = static_cast<int>(section.type()) - 1; | ||
231 | if (0 <= index && index < d->sections.length()) { | 231 | if (0 <= index && index < d->sections.length()) { | ||
232 | if (d->sections[index]) { | 232 | if (d->sections[index]) { | ||
233 | *d->sections[index] = section; | 233 | *d->sections[index] = section; | ||
234 | } else { | 234 | } else { | ||
235 | d->sections[index] = new KReportSection(section); | 235 | d->sections[index] = new KReportSection(section); | ||
236 | } | 236 | } | ||
237 | } | 237 | } | ||
238 | } | 238 | } | ||
Show All 29 Lines |