119 inline const std::vector<uint8_t>&
data()
const;
133 inline const std::vector<uint8_t>&
modules()
const;
151 inline unsigned int version()
const;
171 inline bool isSame(
const QRCodeBase& otherCode,
const bool ignoreModules)
const;
266 data_(std::move(data)),
267 encodingMode_(encodingMode),
268 errorCorrectionCapacity_(errorCorrectionCapacity),
269 modules_(std::move(modules)),
287 return std::string(
data_.begin(),
data_.end());
347 if (
data_.size() != otherCode.
data().size())
351 else if (!std::equal(
data_.begin(),
data_.end(), otherCode.
data().begin()))
373 return isSame(otherCode,
false);
378 return !(*
this == otherCode);
389 return "ALPHANUMERIC";
401 return "STRUCTURED_APPEND";
410 ocean_assert(
false &&
"Never be here!");
411 return "Unknown encoding mode";
431 return "DETECTION_ONLY";
437 ocean_assert(
false &&
"Never be here!");
438 return "Unknown error correction capacity";
465 ocean_assert(
false &&
"Never be here!");
483 ocean_assert(
false &&
"Never be here!");
Base class for QR code implementations.
Definition: QRCodeBase.h:32
static unsigned int getErrorCorrectionCapacityValue(const ErrorCorrectionCapacity errorCorrectionCapacity)
Returns the integer value of an error correction capacity.
Definition: QRCodeBase.h:441
bool operator!=(const QRCodeBase &otherCode) const
Checks for inequality with another QR code.
Definition: QRCodeBase.h:376
QRCodeBase & operator=(const QRCodeBase &otherCode)=default
Copy assignment operator.
QRCodeBase(const QRCodeBase &otherCode)=default
Copy constructor.
QRCodeBase()=default
Creates an invalid QR code instance.
CodeType codeType_
The variant of this QR code.
Definition: QRCodeBase.h:246
std::vector< uint8_t > data_
The plain data.
Definition: QRCodeBase.h:249
ErrorCorrectionCapacity errorCorrectionCapacity_
The error correction capacity that was used to generated this QR code.
Definition: QRCodeBase.h:255
virtual unsigned int modulesPerSide() const =0
Returns the number of modules per side of the QR code.
const std::vector< uint8_t > & modules() const
Returns the modules of this QR code The modules are stored in a vector and will have modulesPerSide()...
Definition: QRCodeBase.h:290
std::vector< uint8_t > modules_
The modules of the QR code that store the data.
Definition: QRCodeBase.h:258
bool operator==(const QRCodeBase &otherCode) const
Checks for equality with another QR code Two QR codes are equal iff they store identical data,...
Definition: QRCodeBase.h:371
CodeType codeType() const
Returns the type or variant of this code.
Definition: QRCodeBase.h:275
static std::string translateEncodingMode(const EncodingMode encodingMode)
Translates an encoding mode enum into a human-readable string.
Definition: QRCodeBase.h:381
virtual ~QRCodeBase()=default
Destructs a QR code instance.
CodeType
Definition of available types of codes.
Definition: QRCodeBase.h:39
@ CT_MICRO
Indicates a Micro QR codes.
Definition: QRCodeBase.h:45
@ CT_STANDARD
Indicates a standard QR codes.
Definition: QRCodeBase.h:43
@ CT_UNDEFINED
Default value of undefined or invalid code types.
Definition: QRCodeBase.h:41
static std::string translateErrorCorrectionCapacity(const ErrorCorrectionCapacity errorCorrectionCapacity)
Translates an error correction capacity enum into a human-readable string.
Definition: QRCodeBase.h:414
virtual std::string versionString() const
Returns the version of the QR code as a string.
Definition: QRCodeBase.h:310
unsigned int version() const
Returns the version of the QR code.
Definition: QRCodeBase.h:305
unsigned int version_
The version of the QR code.
Definition: QRCodeBase.h:261
const std::vector< uint8_t > & data() const
Returns a constant reference to the plain data of the QR code.
Definition: QRCodeBase.h:280
std::string dataString() const
Return the plain data of the QR code as a string, if possible.
Definition: QRCodeBase.h:285
bool isSame(const QRCodeBase &otherCode, const bool ignoreModules) const
Checks if another code is identical to this one.
Definition: QRCodeBase.h:315
EncodingMode
Definition of encoding modes.
Definition: QRCodeBase.h:72
@ EM_ALPHANUMERIC
Mode that supports A-Z, 0-9 and a few others, cf. ALPHANUMERIC_CHARSET
Definition: QRCodeBase.h:76
@ EM_NUMERIC
Mode that supports digits 0-9.
Definition: QRCodeBase.h:74
@ EM_ECI
Mode that allows the output data stream to have interpretations different from that of the default ch...
Definition: QRCodeBase.h:85
@ EM_BYTE
Mode that represents data as a sequence of bytes.
Definition: QRCodeBase.h:78
@ EM_INVALID_ENCODING_MODE
Indicator for an invalid encoding mode.
Definition: QRCodeBase.h:92
@ EM_KANJI
Mode that handles Kanji characters in accordance with the Shift JIS system based on JIS X 0208.
Definition: QRCodeBase.h:83
@ EM_STRUCTURED_APPEND
Structured Append mode is used to split the encodation of the data from a message over a number of QR...
Definition: QRCodeBase.h:87
@ EM_FNC1
Mode that is used for messages containing data formatted either in accordance with the UCC/EAN Applic...
Definition: QRCodeBase.h:89
static std::string translateCodeType(const CodeType codeType)
Translate the code type into a human-readable string.
Definition: QRCodeBase.h:469
ErrorCorrectionCapacity
Enumeration of the levels of error correction The value of the enums correspond to the standard-defin...
Definition: QRCodeBase.h:53
@ ECC_15
Indicates that 15% of the modules reserved error correction.
Definition: QRCodeBase.h:57
@ ECC_30
Indicates that 30% of the modules reserved error correction.
Definition: QRCodeBase.h:61
@ ECC_25
Indicates that 25% of the modules reserved error correction.
Definition: QRCodeBase.h:59
@ ECC_INVALID
Indicator for an invalid error correction capacity.
Definition: QRCodeBase.h:65
@ ECC_07
Indicates that 7% of the modules reserved error correction.
Definition: QRCodeBase.h:55
@ ECC_DETECTION_ONLY
Indicates that the capacity is limited to error detection only (used only by Micro QR Code version M1...
Definition: QRCodeBase.h:63
virtual bool isValid() const =0
Returns whether this is a valid QR code instance.
ErrorCorrectionCapacity errorCorrectionCapacity() const
Returns the error correction capacity of the QR code.
Definition: QRCodeBase.h:300
EncodingMode encodingMode_
The encoding mode that was used to generate this QR code.
Definition: QRCodeBase.h:252
EncodingMode encodingMode() const
Returns the encoding mode of the QR code.
Definition: QRCodeBase.h:295
std::vector< QRCode > QRCodes
Definition of a vector of QR codes.
Definition: QRCode.h:25
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15