Tweaked comments for QrSegment.getTotalBits() to express package-private access control in some languages.

pull/39/merge
Project Nayuki 6 years ago
parent 9c670453a8
commit 7fe69730c4

@ -172,9 +172,9 @@ class QrSegment final {
public: const std::vector<bool> &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<QrSegment> &segs, int version);

@ -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";

@ -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

@ -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<QrSegment>, version: int): number {
if (version < QrCode.MIN_VERSION || version > QrCode.MAX_VERSION)
throw "Version number out of range";

Loading…
Cancel
Save