Updated C++ header code to be stricter by prepending std:: prefix for C standard library types.

This commit is contained in:
Project Nayuki 2017-05-05 20:55:32 +00:00
parent 48e0bc00b2
commit 33af4e376e
3 changed files with 15 additions and 15 deletions

View File

@ -37,7 +37,7 @@ class BitBuffer final {
/*---- Fields ----*/ /*---- Fields ----*/
private: std::vector<uint8_t> data; private: std::vector<std::uint8_t> data;
private: int bitLength; private: int bitLength;
@ -56,12 +56,12 @@ class BitBuffer final {
// Returns a copy of all bytes, padding up to the nearest byte. // Returns a copy of all bytes, padding up to the nearest byte.
public: std::vector<uint8_t> getBytes() const; public: std::vector<std::uint8_t> getBytes() const;
// Appends the given number of bits of the given value to this sequence. // Appends the given number of bits of the given value to this sequence.
// If 0 <= len <= 31, then this requires 0 <= val < 2^len. // If 0 <= len <= 31, then this requires 0 <= val < 2^len.
public: void appendBits(uint32_t val, int len); public: void appendBits(std::uint32_t val, int len);
// Appends the data of the given segment to this bit buffer. // Appends the data of the given segment to this bit buffer.

View File

@ -75,7 +75,7 @@ class QrCode final {
* bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. * bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
* The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version. * The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
*/ */
public: static QrCode encodeBinary(const std::vector<uint8_t> &data, const Ecc &ecl); public: static QrCode encodeBinary(const std::vector<std::uint8_t> &data, const Ecc &ecl);
/* /*
@ -122,7 +122,7 @@ class QrCode final {
* and mask number. This is a cumbersome low-level constructor that should not be invoked directly by the user. * and mask number. This is a cumbersome low-level constructor that should not be invoked directly by the user.
* To go one level up, see the encodeSegments() function. * To go one level up, see the encodeSegments() function.
*/ */
public: QrCode(int ver, const Ecc &ecl, const std::vector<uint8_t> &dataCodewords, int mask); public: QrCode(int ver, const Ecc &ecl, const std::vector<std::uint8_t> &dataCodewords, int mask);
/* /*
@ -187,12 +187,12 @@ class QrCode final {
// Returns a new byte string representing the given data with the appropriate error correction // Returns a new byte string representing the given data with the appropriate error correction
// codewords appended to it, based on this object's version and error correction level. // codewords appended to it, based on this object's version and error correction level.
private: std::vector<uint8_t> appendErrorCorrection(const std::vector<uint8_t> &data) const; private: std::vector<std::uint8_t> appendErrorCorrection(const std::vector<std::uint8_t> &data) const;
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire // Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
// data area of this QR Code symbol. Function modules need to be marked off before this is called. // data area of this QR Code symbol. Function modules need to be marked off before this is called.
private: void drawCodewords(const std::vector<uint8_t> &data); private: void drawCodewords(const std::vector<std::uint8_t> &data);
// XORs the data modules in this QR Code with the given mask pattern. Due to XOR's mathematical // XORs the data modules in this QR Code with the given mask pattern. Due to XOR's mathematical
@ -242,8 +242,8 @@ class QrCode final {
private: static const int PENALTY_N3; private: static const int PENALTY_N3;
private: static const int PENALTY_N4; private: static const int PENALTY_N4;
private: static const int8_t ECC_CODEWORDS_PER_BLOCK[4][41]; private: static const std::int8_t ECC_CODEWORDS_PER_BLOCK[4][41];
private: static const int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41]; private: static const std::int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41];
@ -260,7 +260,7 @@ class QrCode final {
// Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which // Coefficients of the divisor polynomial, stored from highest to lowest power, excluding the leading term which
// is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. // is always 1. For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
private: std::vector<uint8_t> coefficients; private: std::vector<std::uint8_t> coefficients;
/*-- Constructor --*/ /*-- Constructor --*/
@ -278,14 +278,14 @@ class QrCode final {
* Computes and returns the Reed-Solomon error correction codewords for the given sequence of data codewords. * Computes and returns the Reed-Solomon error correction codewords for the given sequence of data codewords.
* The returned object is always a new byte array. This method does not alter this object's state (because it is immutable). * The returned object is always a new byte array. This method does not alter this object's state (because it is immutable).
*/ */
public: std::vector<uint8_t> getRemainder(const std::vector<uint8_t> &data) const; public: std::vector<std::uint8_t> getRemainder(const std::vector<std::uint8_t> &data) const;
/*-- Static function --*/ /*-- Static function --*/
// Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result // Returns the product of the two given field elements modulo GF(2^8/0x11D). The arguments and result
// are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8. // are unsigned 8-bit integers. This could be implemented as a lookup table of 256*256 entries of uint8.
private: static uint8_t multiply(uint8_t x, uint8_t y); private: static std::uint8_t multiply(std::uint8_t x, std::uint8_t y);
}; };

View File

@ -83,7 +83,7 @@ class QrSegment final {
/* /*
* Returns a segment representing the given binary data encoded in byte mode. * Returns a segment representing the given binary data encoded in byte mode.
*/ */
public: static QrSegment makeBytes(const std::vector<uint8_t> &data); public: static QrSegment makeBytes(const std::vector<std::uint8_t> &data);
/* /*
@ -130,7 +130,7 @@ class QrSegment final {
public: const int numChars; public: const int numChars;
/* The bits of this segment packed into a byte array in big endian. */ /* The bits of this segment packed into a byte array in big endian. */
public: const std::vector<uint8_t> data; public: const std::vector<std::uint8_t> data;
/* The length of this segment's encoded data, measured in bits. Satisfies ceil(bitLength / 8) = data.size(). */ /* The length of this segment's encoded data, measured in bits. Satisfies ceil(bitLength / 8) = data.size(). */
public: const int bitLength; public: const int bitLength;
@ -141,7 +141,7 @@ class QrSegment final {
/* /*
* Creates a new QR Code data segment with the given parameters and data. * Creates a new QR Code data segment with the given parameters and data.
*/ */
public: QrSegment(const Mode &md, int numCh, const std::vector<uint8_t> &b, int bitLen); public: QrSegment(const Mode &md, int numCh, const std::vector<std::uint8_t> &b, int bitLen);
// Package-private helper function. // Package-private helper function.