qprinterinfo.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9