From 95e5f14c36c20f0a25ded479b24355cef5f1b5c7 Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Fri, 5 Oct 2018 21:17:52 +0000 Subject: [PATCH] Updated and synchronized QrCode class's top-level documentation comment, in all languages. --- c/qrcodegen.h | 16 ++++++++++++++++ cpp/QrCode.hpp | 16 +++++++++++++--- java/io/nayuki/qrcodegen/QrCode.java | 20 +++++++++++++++++--- javascript/qrcodegen.js | 17 ++++++++++++++--- python/qrcodegen.py | 18 ++++++++++++++---- rust/src/lib.rs | 21 +++++++++++++++++---- typescript/qrcodegen.ts | 17 ++++++++++++++--- 7 files changed, 105 insertions(+), 20 deletions(-) diff --git a/c/qrcodegen.h b/c/qrcodegen.h index bc410f9..f09d887 100644 --- a/c/qrcodegen.h +++ b/c/qrcodegen.h @@ -33,6 +33,22 @@ extern "C" { #endif +/* + * This library creates QR Code symbols, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + * A QR Code structure is an immutable square grid of black and white cells. + * The library provides functions to create a QR Code from text or binary data. + * The library covers the QR Code Model 2 specification, supporting all versions (sizes) + * from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + * + * Ways to create a QR Code object: + * - High level: Take the payload data and call qrcodegen_encodeText() or qrcodegen_encodeBinary(). + * - Low level: Custom-make the list of segments and call + * qrcodegen_encodeSegments() or qrcodegen_encodeSegmentsAdvanced(). + * (Note that all ways require supplying the desired error correction level and various byte buffers.) + */ + + /*---- Enum and struct types----*/ /* diff --git a/cpp/QrCode.hpp b/cpp/QrCode.hpp index 3a644d5..ec59a14 100644 --- a/cpp/QrCode.hpp +++ b/cpp/QrCode.hpp @@ -32,10 +32,20 @@ namespace qrcodegen { /* - * Represents an immutable square grid of black and white cells for a QR Code symbol, and - * provides static functions to create a QR Code from user-supplied textual or binary data. - * This class covers the QR Code Model 2 specification, supporting all versions (sizes) + * A QR Code symbol, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + * Instances of this class represent an immutable square grid of black and white cells. + * The class provides static factory functions to create a QR Code from text or binary data. + * The class covers the QR Code Model 2 specification, supporting all versions (sizes) * from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + * + * Ways to create a QR Code object: + * - High level: Take the payload data and call QrCode::encodeText() or QrCode::encodeBinary(). + * - Mid level: Custom-make the list of segments and call QrCode::encodeSegments(). + * - Low level: Custom-make the array of data codeword bytes (including + * segment headers and final padding, excluding error correction codewords), + * supply the appropriate version number, and call the QrCode() constructor. + * (Note that all ways require supplying the desired error correction level.) */ class QrCode final { diff --git a/java/io/nayuki/qrcodegen/QrCode.java b/java/io/nayuki/qrcodegen/QrCode.java index ca57ebe..3930441 100644 --- a/java/io/nayuki/qrcodegen/QrCode.java +++ b/java/io/nayuki/qrcodegen/QrCode.java @@ -30,10 +30,24 @@ import java.util.Objects; /** - * Represents an immutable square grid of black and white cells for a QR Code symbol, and - * provides static functions to create a QR Code from user-supplied textual or binary data. - *

This class covers the QR Code Model 2 specification, supporting all versions (sizes) + * A QR Code symbol, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + *

Instances of this class represent an immutable square grid of black and white cells. + * The class provides static factory functions to create a QR Code from text or binary data. + * The class covers the QR Code Model 2 specification, supporting all versions (sizes) * from 1 to 40, all 4 error correction levels, and 4 character encoding modes.

+ *

Ways to create a QR Code object:

+ * + *

(Note that all ways require supplying the desired error correction level.)

*/ public final class QrCode { diff --git a/javascript/qrcodegen.js b/javascript/qrcodegen.js index d395c21..2925f04 100644 --- a/javascript/qrcodegen.js +++ b/javascript/qrcodegen.js @@ -60,10 +60,21 @@ var qrcodegen = new function() { /*---- QR Code symbol class ----*/ /* - * A class that represents an immutable square grid of black and white cells for a QR Code symbol, - * and provides static functions to create a QR Code from user-supplied textual or binary data. - * This class covers the QR Code Model 2 specification, supporting all versions (sizes) + * A class that represents a QR Code symbol, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + * Instances of this class represent an immutable square grid of black and white cells. + * The class provides static factory functions to create a QR Code from text or binary data. + * The class covers the QR Code Model 2 specification, supporting all versions (sizes) * from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + * + * Ways to create a QR Code object: + * - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary(). + * - Mid level: Custom-make the list of segments and call QrCode.encodeSegments(). + * - Low level: Custom-make the array of data codeword bytes (including + * segment headers and final padding, excluding error correction codewords), + * supply the appropriate version number, and call the QrCode() constructor. + * (Note that all ways require supplying the desired error correction level.) + * * This constructor creates a new QR Code with the given version number, error correction level, binary data array, * and mask number. mask = -1 is for automatic choice, or 0 to 7 for fixed choice. This is a cumbersome low-level constructor * that should not be invoked directly by the user. To go one level up, see the QrCode.encodeSegments() function. diff --git a/python/qrcodegen.py b/python/qrcodegen.py index 377c352..2d08082 100644 --- a/python/qrcodegen.py +++ b/python/qrcodegen.py @@ -61,10 +61,20 @@ This module "qrcodegen", public members: # ---- QR Code symbol class ---- class QrCode(object): - """Represents an immutable square grid of black and white cells for a QR Code symbol, and - provides static functions to create a QR Code from user-supplied textual or binary data. - This class covers the QR Code Model 2 specification, supporting all versions (sizes) - from 1 to 40, all 4 error correction levels, and 4 character encoding modes.""" + """A QR Code symbol, which is a type of two-dimension barcode. + Invented by Denso Wave and described in the ISO/IEC 18004 standard. + Instances of this class represent an immutable square grid of black and white cells. + The class provides static factory functions to create a QR Code from text or binary data. + The class covers the QR Code Model 2 specification, supporting all versions (sizes) + from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + + Ways to create a QR Code object: + - High level: Take the payload data and call QrCode.encode_text() or QrCode.encode_binary(). + - Mid level: Custom-make the list of segments and call QrCode.encode_segments(). + - Low level: Custom-make the array of data codeword bytes (including + segment headers and final padding, excluding error correction codewords), + supply the appropriate version number, and call the QrCode() constructor. + (Note that all ways require supplying the desired error correction level.)""" # ---- Static factory functions (high level) ---- diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 4100d37..31a3b24 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -24,10 +24,23 @@ /*---- QrCode functionality ----*/ -// Represents an immutable square grid of black and white cells for a QR Code symbol, and -// provides static functions to create a QR Code from user-supplied textual or binary data. -// This struct and impl cover the QR Code Model 2 specification, supporting all versions -// (sizes) from 1 to 40, all 4 error correction levels, and 4 character encoding modes. +/* + * A QR Code symbol, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + * Instances of this struct represent an immutable square grid of black and white cells. + * The impl provides static factory functions to create a QR Code from text or binary data. + * The struct and impl cover the QR Code Model 2 specification, supporting all versions + * (sizes) from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + * + * Ways to create a QR Code object: + * - High level: Take the payload data and call QrCode::encode_text() or QrCode::encode_binary(). + * - Mid level: Custom-make the list of segments and call + * QrCode.encode_segments() or QrCode.encode_segments_advanced(). + * - Low level: Custom-make the array of data codeword bytes (including segment + * headers and final padding, excluding error correction codewords), supply the + * appropriate version number, and call the QrCode::encode_codewords() constructor. + * (Note that all ways require supplying the desired error correction level.) + */ #[derive(Clone)] pub struct QrCode { diff --git a/typescript/qrcodegen.ts b/typescript/qrcodegen.ts index 928ca89..f326ecb 100644 --- a/typescript/qrcodegen.ts +++ b/typescript/qrcodegen.ts @@ -34,10 +34,21 @@ namespace qrcodegen { /*---- QR Code symbol class ----*/ /* - * Represents an immutable square grid of black and white cells for a QR Code symbol, and - * provides static functions to create a QR Code from user-supplied textual or binary data. - * This class covers the QR Code Model 2 specification, supporting all versions (sizes) + * A QR Code symbol, which is a type of two-dimension barcode. + * Invented by Denso Wave and described in the ISO/IEC 18004 standard. + * Instances of this class represent an immutable square grid of black and white cells. + * The class provides static factory functions to create a QR Code from text or binary data. + * The class covers the QR Code Model 2 specification, supporting all versions (sizes) * from 1 to 40, all 4 error correction levels, and 4 character encoding modes. + * + * Ways to create a QR Code object: + * - High level: Take the payload data and call QrCode.encodeText() or QrCode.encodeBinary(). + * - Mid level: Custom-make the list of segments and call QrCode.encodeSegments(). + * - Low level: Custom-make the array of data codeword bytes (including + * segment headers and final padding, excluding error correction codewords), + * supply the appropriate version number, and call the QrCode() constructor. + * (Note that all ways require supplying the desired error correction level.) + * * This constructor creates a new QR Code with the given version number, error correction level, binary data array, * and mask number. mask = -1 is for automatic choice, or 0 to 7 for fixed choice. This is a cumbersome low-level constructor * that should not be invoked directly by the user. To go one level up, see the QrCode.encodeSegments() function.