Prison

scanresult.cpp
1 /*
2  SPDX-FileCopyrightText: 2022 Volker Krause <[email protected]>
3  SPDX-License-Identifier: MIT
4 */
5 
6 #include "scanresult.h"
7 #include "scanresult_p.h"
8 
9 using namespace Prison;
10 
11 ScanResult::ScanResult()
12  : d(new ScanResultPrivate)
13 {
14 }
15 
16 ScanResult::ScanResult(const ScanResult &) = default;
17 ScanResult::~ScanResult() = default;
18 ScanResult &ScanResult::operator=(const ScanResult &) = default;
19 
20 bool ScanResult::operator==(const ScanResult &other) const
21 {
22  return d->content == other.d->content && d->boundingRect == other.d->boundingRect && d->format == other.d->format;
23 }
24 
25 bool ScanResult::hasContent() const
26 {
27  return !d->content.isNull();
28 }
29 
30 QVariant ScanResult::content() const
31 {
32  return d->content;
33 }
34 
35 bool ScanResult::hasText() const
36 {
37  return d->content.userType() == QVariant::String;
38 }
39 
40 QString ScanResult::text() const
41 {
42  return hasText() ? d->content.toString() : QString();
43 }
44 
45 bool ScanResult::hasBinaryData() const
46 {
47  return d->content.userType() == QVariant::ByteArray;
48 }
49 
50 QByteArray ScanResult::binaryData() const
51 {
52  return hasBinaryData() ? d->content.toByteArray() : QByteArray();
53 }
54 
55 Format::BarcodeFormat ScanResult::format() const
56 {
57  return d->format;
58 }
59 
60 QRect ScanResult::boundingRect() const
61 {
62  return d->boundingRect;
63 }
64 
65 #include "moc_scanresult.cpp"
BarcodeFormat
Barcode formats.
Definition: format.h:27
Result of a barcode scan attempt.
Definition: scanresult.h:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Dec 2 2023 04:09:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.