User/jselbie/cppdefaultconstructor ()

* added default constructor

* isValid checks for gt zero instead of ne 0
pull/177/head
John Selbie 2 years ago committed by GitHub
parent 90c26f8bf8
commit 1ae4379491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -359,6 +359,18 @@ QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int msk)
}
QrCode::QrCode() :
version(MIN_VERSION),
size(0),
mask(0),
errorCorrectionLevel(Ecc::LOW) {
}
bool QrCode::isValid() const {
return size > 0;
}
int QrCode::getVersion() const {
return version;
}

@ -333,9 +333,20 @@ class QrCode final {
*/
public: QrCode(int ver, Ecc ecl, const std::vector<std::uint8_t> &dataCodewords, int msk);
/*
* Default constructor for an uninitialized (empty) QrCode. Useful for when a
* QrCode instance is needed prior to being assigned to. Subsequent calls
* to isValid will return false until a copy assignment is made.
*/
public: QrCode();
/*---- Public instance methods ----*/
/*
* returns false if constructed with the default constructor and not updated with a valid
* assignment
*/
public: bool isValid() const;
/*
* Returns this QR Code's version, in the range [1, 40].

Loading…
Cancel
Save