Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprinterinfo.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | - | |||||||
5 | - | |||||||
6 | - | |||||||
7 | - | |||||||
8 | - | |||||||
9 | namespace { namespace Q_QGS_shared_null { typedef QPrinterInfoPrivate Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 3 times by 3 tests: }guard.store(QtGlobalStatic::Destroyed); Executed by:
executed 3 times by 3 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of block Executed by:
executed 1502 times by 3 tests: &holder.value;return &holder.value; Executed by:
executed 1502 times by 3 tests: } } } static QGlobalStatic<QPrinterInfoPrivate, Q_QGS_shared_null::innerFunction, Q_QGS_shared_null::guard> shared_null;;return &holder.value; Executed by:
| 0-1502 | ||||||
10 | - | |||||||
11 | class QPrinterInfoPrivateDeleter | - | ||||||
12 | { | - | ||||||
13 | public: | - | ||||||
14 | static inline void cleanup(QPrinterInfoPrivate *d) | - | ||||||
15 | { | - | ||||||
16 | if (d != shared_null
| 274 | ||||||
17 | delete d; executed 274 times by 3 tests: delete d; Executed by:
| 274 | ||||||
18 | } executed 548 times by 3 tests: end of block Executed by:
| 548 | ||||||
19 | }; | - | ||||||
20 | - | |||||||
21 | QPrinterInfoPrivate::QPrinterInfoPrivate(const QString &id) | - | ||||||
22 | { | - | ||||||
23 | if (!id.isEmpty()
| 1-140 | ||||||
24 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
25 | if (ps
| 0-1 | ||||||
26 | m_printDevice = ps->createPrintDevice(id); executed 1 time by 1 test: m_printDevice = ps->createPrintDevice(id); Executed by:
| 1 | ||||||
27 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||
28 | } executed 141 times by 3 tests: end of block Executed by:
| 141 | ||||||
29 | - | |||||||
30 | QPrinterInfoPrivate::~QPrinterInfoPrivate() | - | ||||||
31 | { | - | ||||||
32 | } | - | ||||||
33 | QPrinterInfo::QPrinterInfo() | - | ||||||
34 | : d_ptr(shared_null) | - | ||||||
35 | { | - | ||||||
36 | } executed 137 times by 3 tests: end of block Executed by:
| 137 | ||||||
37 | - | |||||||
38 | - | |||||||
39 | - | |||||||
40 | - | |||||||
41 | QPrinterInfo::QPrinterInfo(const QPrinterInfo &other) | - | ||||||
42 | : d_ptr((other.d_ptr.data() == shared_null) ? shared_null : new QPrinterInfoPrivate(*other.d_ptr)) | - | ||||||
43 | { | - | ||||||
44 | } executed 135 times by 3 tests: end of block Executed by:
| 135 | ||||||
45 | - | |||||||
46 | - | |||||||
47 | - | |||||||
48 | - | |||||||
49 | QPrinterInfo::QPrinterInfo(const QPrinter &printer) | - | ||||||
50 | : d_ptr(shared_null) | - | ||||||
51 | { | - | ||||||
52 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
53 | if (ps
| 0-2 | ||||||
54 | QPrinterInfo pi(printer.printerName()); | - | ||||||
55 | if (pi.d_ptr.data() == shared_null
| 0-2 | ||||||
56 | d_ptr.reset(shared_null); never executed: d_ptr.reset(shared_null); | 0 | ||||||
57 | else | - | ||||||
58 | d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); executed 2 times by 1 test: d_ptr.reset(new QPrinterInfoPrivate(*pi.d_ptr)); Executed by:
| 2 | ||||||
59 | } | - | ||||||
60 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||
61 | - | |||||||
62 | - | |||||||
63 | - | |||||||
64 | - | |||||||
65 | QPrinterInfo::QPrinterInfo(const QString &name) | - | ||||||
66 | : d_ptr(new QPrinterInfoPrivate(name)) | - | ||||||
67 | { | - | ||||||
68 | } executed 138 times by 3 tests: end of block Executed by:
| 138 | ||||||
69 | - | |||||||
70 | - | |||||||
71 | - | |||||||
72 | - | |||||||
73 | - | |||||||
74 | QPrinterInfo::~QPrinterInfo() | - | ||||||
75 | { | - | ||||||
76 | } | - | ||||||
77 | - | |||||||
78 | - | |||||||
79 | - | |||||||
80 | - | |||||||
81 | QPrinterInfo &QPrinterInfo::operator=(const QPrinterInfo &other) | - | ||||||
82 | { | - | ||||||
83 | ((!(d_ptr)) ? qt_assert("d_ptr",__FILE__,138) : qt_noop()); | - | ||||||
84 | if (other.d_ptr.data() == shared_null
| 1-134 | ||||||
85 | d_ptr.reset(shared_null); executed 1 time by 1 test: d_ptr.reset(shared_null); Executed by:
| 1 | ||||||
86 | else | - | ||||||
87 | d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr)); executed 134 times by 2 tests: d_ptr.reset(new QPrinterInfoPrivate(*other.d_ptr)); Executed by:
| 134 | ||||||
88 | return executed 135 times by 3 tests: *this;return *this; Executed by:
executed 135 times by 3 tests: return *this; Executed by:
| 135 | ||||||
89 | } | - | ||||||
90 | QString QPrinterInfo::printerName() const | - | ||||||
91 | { | - | ||||||
92 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
93 | return executed 2 times by 1 test: d->m_printDevice.id();return d->m_printDevice.id(); Executed by:
executed 2 times by 1 test: return d->m_printDevice.id(); Executed by:
| 2 | ||||||
94 | } | - | ||||||
95 | - | |||||||
96 | - | |||||||
97 | - | |||||||
98 | - | |||||||
99 | - | |||||||
100 | - | |||||||
101 | - | |||||||
102 | QString QPrinterInfo::description() const | - | ||||||
103 | { | - | ||||||
104 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
105 | return never executed: d->m_printDevice.name();return d->m_printDevice.name(); never executed: return d->m_printDevice.name(); | 0 | ||||||
106 | } | - | ||||||
107 | - | |||||||
108 | - | |||||||
109 | - | |||||||
110 | - | |||||||
111 | - | |||||||
112 | - | |||||||
113 | QString QPrinterInfo::location() const | - | ||||||
114 | { | - | ||||||
115 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
116 | return never executed: d->m_printDevice.location();return d->m_printDevice.location(); never executed: return d->m_printDevice.location(); | 0 | ||||||
117 | } | - | ||||||
118 | - | |||||||
119 | - | |||||||
120 | - | |||||||
121 | - | |||||||
122 | - | |||||||
123 | - | |||||||
124 | QString QPrinterInfo::makeAndModel() const | - | ||||||
125 | { | - | ||||||
126 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
127 | return never executed: d->m_printDevice.makeAndModel();return d->m_printDevice.makeAndModel(); never executed: return d->m_printDevice.makeAndModel(); | 0 | ||||||
128 | } | - | ||||||
129 | - | |||||||
130 | - | |||||||
131 | - | |||||||
132 | - | |||||||
133 | - | |||||||
134 | - | |||||||
135 | - | |||||||
136 | bool QPrinterInfo::isNull() const | - | ||||||
137 | { | - | ||||||
138 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
139 | return executed 407 times by 3 tests: d == shared_null || !d->m_printDevice.isValid();return d == shared_null || !d->m_printDevice.isValid(); Executed by:
executed 407 times by 3 tests: return d == shared_null || !d->m_printDevice.isValid(); Executed by:
| 407 | ||||||
140 | } | - | ||||||
141 | - | |||||||
142 | - | |||||||
143 | - | |||||||
144 | - | |||||||
145 | bool QPrinterInfo::isDefault() const | - | ||||||
146 | { | - | ||||||
147 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
148 | return never executed: d->m_printDevice.isDefault();return d->m_printDevice.isDefault(); never executed: return d->m_printDevice.isDefault(); | 0 | ||||||
149 | } | - | ||||||
150 | - | |||||||
151 | - | |||||||
152 | - | |||||||
153 | - | |||||||
154 | - | |||||||
155 | - | |||||||
156 | bool QPrinterInfo::isRemote() const | - | ||||||
157 | { | - | ||||||
158 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
159 | return never executed: d->m_printDevice.isRemote();return d->m_printDevice.isRemote(); never executed: return d->m_printDevice.isRemote(); | 0 | ||||||
160 | } | - | ||||||
161 | QPrinter::PrinterState QPrinterInfo::state() const | - | ||||||
162 | { | - | ||||||
163 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
164 | return never executed: QPrinter::PrinterState(d->m_printDevice.state());return QPrinter::PrinterState(d->m_printDevice.state()); never executed: return QPrinter::PrinterState(d->m_printDevice.state()); | 0 | ||||||
165 | } | - | ||||||
166 | - | |||||||
167 | - | |||||||
168 | - | |||||||
169 | - | |||||||
170 | - | |||||||
171 | - | |||||||
172 | - | |||||||
173 | QList<QPageSize> QPrinterInfo::supportedPageSizes() const | - | ||||||
174 | { | - | ||||||
175 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
176 | return executed 2 times by 1 test: d->m_printDevice.supportedPageSizes();return d->m_printDevice.supportedPageSizes(); Executed by:
executed 2 times by 1 test: return d->m_printDevice.supportedPageSizes(); Executed by:
| 2 | ||||||
177 | } | - | ||||||
178 | - | |||||||
179 | - | |||||||
180 | - | |||||||
181 | - | |||||||
182 | - | |||||||
183 | - | |||||||
184 | - | |||||||
185 | QPageSize QPrinterInfo::defaultPageSize() const | - | ||||||
186 | { | - | ||||||
187 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
188 | return never executed: d->m_printDevice.defaultPageSize();return d->m_printDevice.defaultPageSize(); never executed: return d->m_printDevice.defaultPageSize(); | 0 | ||||||
189 | } | - | ||||||
190 | - | |||||||
191 | - | |||||||
192 | - | |||||||
193 | - | |||||||
194 | - | |||||||
195 | - | |||||||
196 | - | |||||||
197 | bool QPrinterInfo::supportsCustomPageSizes() const | - | ||||||
198 | { | - | ||||||
199 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
200 | return never executed: d->m_printDevice.supportsCustomPageSizes();return d->m_printDevice.supportsCustomPageSizes(); never executed: return d->m_printDevice.supportsCustomPageSizes(); | 0 | ||||||
201 | } | - | ||||||
202 | QPageSize QPrinterInfo::minimumPhysicalPageSize() const | - | ||||||
203 | { | - | ||||||
204 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
205 | return never executed: QPageSize(d->m_printDevice.minimumPhysicalPageSize(), QString(), QPageSize::ExactMatch);return QPageSize(d->m_printDevice.minimumPhysicalPageSize(), QString(), QPageSize::ExactMatch); never executed: return QPageSize(d->m_printDevice.minimumPhysicalPageSize(), QString(), QPageSize::ExactMatch); | 0 | ||||||
206 | } | - | ||||||
207 | QPageSize QPrinterInfo::maximumPhysicalPageSize() const | - | ||||||
208 | { | - | ||||||
209 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
210 | return never executed: QPageSize(d->m_printDevice.maximumPhysicalPageSize(), QString(), QPageSize::ExactMatch);return QPageSize(d->m_printDevice.maximumPhysicalPageSize(), QString(), QPageSize::ExactMatch); never executed: return QPageSize(d->m_printDevice.maximumPhysicalPageSize(), QString(), QPageSize::ExactMatch); | 0 | ||||||
211 | } | - | ||||||
212 | QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const | - | ||||||
213 | { | - | ||||||
214 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
215 | QList<QPrinter::PaperSize> list; | - | ||||||
216 | const QList<QPageSize> supportedPageSizes = d->m_printDevice.supportedPageSizes(); | - | ||||||
217 | list.reserve(supportedPageSizes.size()); | - | ||||||
218 | for (const QPageSize &pageSize : supportedPageSizes) | - | ||||||
219 | list.append(QPrinter::PaperSize(pageSize.id())); never executed: list.append(QPrinter::PaperSize(pageSize.id())); | 0 | ||||||
220 | return never executed: list;return list; never executed: return list; | 0 | ||||||
221 | } | - | ||||||
222 | QList<QPair<QString, QSizeF> > QPrinterInfo::supportedSizesWithNames() const | - | ||||||
223 | { | - | ||||||
224 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
225 | QList<QPair<QString, QSizeF> > list; | - | ||||||
226 | const QList<QPageSize> supportedPageSizes = d->m_printDevice.supportedPageSizes(); | - | ||||||
227 | list.reserve(supportedPageSizes.size()); | - | ||||||
228 | for (const QPageSize &pageSize : supportedPageSizes) | - | ||||||
229 | list.append(qMakePair(pageSize.name(), pageSize.size(QPageSize::Millimeter))); never executed: list.append(qMakePair(pageSize.name(), pageSize.size(QPageSize::Millimeter))); | 0 | ||||||
230 | return never executed: list;return list; never executed: return list; | 0 | ||||||
231 | } | - | ||||||
232 | QList<int> QPrinterInfo::supportedResolutions() const | - | ||||||
233 | { | - | ||||||
234 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
235 | return never executed: d->m_printDevice.supportedResolutions();return d->m_printDevice.supportedResolutions(); never executed: return d->m_printDevice.supportedResolutions(); | 0 | ||||||
236 | } | - | ||||||
237 | - | |||||||
238 | - | |||||||
239 | - | |||||||
240 | - | |||||||
241 | - | |||||||
242 | - | |||||||
243 | - | |||||||
244 | QPrinter::DuplexMode QPrinterInfo::defaultDuplexMode() const | - | ||||||
245 | { | - | ||||||
246 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
247 | return never executed: QPrinter::DuplexMode(d->m_printDevice.defaultDuplexMode());return QPrinter::DuplexMode(d->m_printDevice.defaultDuplexMode()); never executed: return QPrinter::DuplexMode(d->m_printDevice.defaultDuplexMode()); | 0 | ||||||
248 | } | - | ||||||
249 | - | |||||||
250 | - | |||||||
251 | - | |||||||
252 | - | |||||||
253 | - | |||||||
254 | - | |||||||
255 | - | |||||||
256 | QList<QPrinter::DuplexMode> QPrinterInfo::supportedDuplexModes() const | - | ||||||
257 | { | - | ||||||
258 | const QPrinterInfoPrivate * const d = d_func(); | - | ||||||
259 | QList<QPrinter::DuplexMode> list; | - | ||||||
260 | const QList<QPrint::DuplexMode> supportedDuplexModes = d->m_printDevice.supportedDuplexModes(); | - | ||||||
261 | list.reserve(supportedDuplexModes.size()); | - | ||||||
262 | for (QPrint::DuplexMode mode : supportedDuplexModes) | - | ||||||
263 | list << QPrinter::DuplexMode(mode); never executed: list << QPrinter::DuplexMode(mode); | 0 | ||||||
264 | return never executed: list;return list; never executed: return list; | 0 | ||||||
265 | } | - | ||||||
266 | QStringList QPrinterInfo::availablePrinterNames() | - | ||||||
267 | { | - | ||||||
268 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
269 | if (ps
| 0-134 | ||||||
270 | return executed 134 times by 2 tests: ps->availablePrintDeviceIds();return ps->availablePrintDeviceIds(); Executed by:
executed 134 times by 2 tests: return ps->availablePrintDeviceIds(); Executed by:
| 134 | ||||||
271 | return never executed: QStringList();return QStringList(); never executed: return QStringList(); | 0 | ||||||
272 | } | - | ||||||
273 | QList<QPrinterInfo> QPrinterInfo::availablePrinters() | - | ||||||
274 | { | - | ||||||
275 | QList<QPrinterInfo> list; | - | ||||||
276 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
277 | if (ps
| 0-9 | ||||||
278 | const QStringList availablePrintDeviceIds = ps->availablePrintDeviceIds(); | - | ||||||
279 | list.reserve(availablePrintDeviceIds.size()); | - | ||||||
280 | for (const QString &id : availablePrintDeviceIds) | - | ||||||
281 | list.append(QPrinterInfo(id)); never executed: list.append(QPrinterInfo(id)); | 0 | ||||||
282 | } executed 9 times by 2 tests: end of block Executed by:
| 9 | ||||||
283 | return executed 9 times by 2 tests: list;return list; Executed by:
executed 9 times by 2 tests: return list; Executed by:
| 9 | ||||||
284 | } | - | ||||||
285 | - | |||||||
286 | - | |||||||
287 | - | |||||||
288 | - | |||||||
289 | - | |||||||
290 | - | |||||||
291 | QString QPrinterInfo::defaultPrinterName() | - | ||||||
292 | { | - | ||||||
293 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
294 | if (ps
| 0 | ||||||
295 | return never executed: ps->defaultPrintDeviceId();return ps->defaultPrintDeviceId(); never executed: return ps->defaultPrintDeviceId(); | 0 | ||||||
296 | return never executed: QString();return QString(); never executed: return QString(); | 0 | ||||||
297 | } | - | ||||||
298 | QPrinterInfo QPrinterInfo::defaultPrinter() | - | ||||||
299 | { | - | ||||||
300 | QPlatformPrinterSupport *ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||
301 | if (ps
| 0-135 | ||||||
302 | return executed 135 times by 3 tests: QPrinterInfo(ps->defaultPrintDeviceId());return QPrinterInfo(ps->defaultPrintDeviceId()); Executed by:
executed 135 times by 3 tests: return QPrinterInfo(ps->defaultPrintDeviceId()); Executed by:
| 135 | ||||||
303 | return never executed: QPrinterInfo();return QPrinterInfo(); never executed: return QPrinterInfo(); | 0 | ||||||
304 | } | - | ||||||
305 | QPrinterInfo QPrinterInfo::printerInfo(const QString &printerName) | - | ||||||
306 | { | - | ||||||
307 | return executed 1 time by 1 test: QPrinterInfo(printerName);return QPrinterInfo(printerName); Executed by:
executed 1 time by 1 test: return QPrinterInfo(printerName); Executed by:
| 1 | ||||||
308 | } | - | ||||||
309 | - | |||||||
310 | - | |||||||
311 | QDebug operator<<(QDebug debug, const QPrinterInfo &p) | - | ||||||
312 | { | - | ||||||
313 | QDebugStateSaver saver(debug); | - | ||||||
314 | debug.nospace(); | - | ||||||
315 | debug << "QPrinterInfo("; | - | ||||||
316 | if (p.isNull()
| 0 | ||||||
317 | debug << "null"; never executed: debug << "null"; | 0 | ||||||
318 | else | - | ||||||
319 | p.d_ptr->m_printDevice.format(debug); never executed: p.d_ptr->m_printDevice.format(debug); | 0 | ||||||
320 | debug << ')'; | - | ||||||
321 | return never executed: debug;return debug; never executed: return debug; | 0 | ||||||
322 | } | - | ||||||
323 | - | |||||||
324 | - | |||||||
325 | - | |||||||
Switch to Source code | Preprocessed file |