diff --git a/cpp/QrSegment.hpp b/cpp/QrSegment.hpp index 44c74ab..2e83465 100644 --- a/cpp/QrSegment.hpp +++ b/cpp/QrSegment.hpp @@ -172,9 +172,9 @@ class QrSegment final { public: const std::vector &getData() const; - // Calculates the number of bits needed to encode the given segments at the given version. - // Returns a non-negative number if successful. Otherwise returns -1 if a segment has too - // many characters to fit its length field, or the total bits exceeds INT_MAX. + // (Package-private) Calculates the number of bits needed to encode the given segments at + // the given version. Returns a non-negative number if successful. Otherwise returns -1 if a + // segment has too many characters to fit its length field, or the total bits exceeds INT_MAX. public: static int getTotalBits(const std::vector &segs, int version); diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index f328298..14505be 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -813,8 +813,8 @@ var qrcodegen = new function() { }; - // Calculates and returns the number of bits needed to encode the given segments at the given version. - // The result is infinity if a segment has too many characters to fit its length field. + // (Package-private) Calculates and returns the number of bits needed to encode the given segments at the + // given version. The result is infinity if a segment has too many characters to fit its length field. this.QrSegment.getTotalBits = function(segs, version) { if (version < MIN_VERSION || version > MAX_VERSION) throw "Version number out of range"; diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 8865923..58a6f6e 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -697,11 +697,12 @@ class QrSegment(object): return list(self._bitdata) # Make defensive copy - # Calculates the number of bits needed to encode the given segments at the given version. - # Returns a non-negative number if successful. Otherwise returns None if a segment has - # too many characters to fit its length field. + # Package-private function @staticmethod def get_total_bits(segs, version): + """Calculates the number of bits needed to encode the given segments at + the given version. Returns a non-negative number if successful. Otherwise + returns None if a segment has too many characters to fit its length field.""" if not (QrCode.MIN_VERSION <= version <= QrCode.MAX_VERSION): raise ValueError("Version number out of range") result = 0 diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 108d30e..54c3a2c 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -769,8 +769,8 @@ namespace qrcodegen { } - // Calculates and returns the number of bits needed to encode the given segments at the given version. - // The result is infinity if a segment has too many characters to fit its length field. + // (Package-private) Calculates and returns the number of bits needed to encode the given segments at + // the given version. The result is infinity if a segment has too many characters to fit its length field. public static getTotalBits(segs: Array, version: int): number { if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION) throw "Version number out of range";