mirror of
https://gitee.com/openharmony/third_party_qrcodegen
synced 2025-02-11 11:57:25 +00:00
Added/tweaked comments and blank lines in demo programs of all language versions except JavaScript.
This commit is contained in:
parent
8fe7878e1e
commit
6a71e09f72
@ -40,7 +40,6 @@ static void doMaskDemo(void);
|
||||
static void printQr(const uint8_t qrcode[]);
|
||||
|
||||
|
||||
|
||||
// The main application program.
|
||||
int main(void) {
|
||||
doBasicDemo();
|
||||
@ -51,6 +50,9 @@ int main(void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Demo suite ----*/
|
||||
|
||||
// Creates a single QR Code, then prints it to the console.
|
||||
static void doBasicDemo(void) {
|
||||
const char *text = "Hello, world!"; // User-supplied text
|
||||
@ -115,6 +117,7 @@ static void doVarietyDemo(void) {
|
||||
}
|
||||
|
||||
|
||||
// Creates QR Codes with manually specified segments for better compactness.
|
||||
static void doSegmentDemo(void) {
|
||||
{ // Illustration "silver"
|
||||
const char *silver0 = "THE SQUARE ROOT OF 2 IS 1.";
|
||||
@ -290,6 +293,9 @@ static void doMaskDemo(void) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Utilities ----*/
|
||||
|
||||
// Prints the given QR Code to the console.
|
||||
static void printQr(const uint8_t qrcode[]) {
|
||||
int size = qrcodegen_getSize(qrcode);
|
||||
|
@ -46,7 +46,6 @@ static void doMaskDemo();
|
||||
static void printQr(const QrCode &qr);
|
||||
|
||||
|
||||
|
||||
// The main application program.
|
||||
int main() {
|
||||
doBasicDemo();
|
||||
@ -57,6 +56,9 @@ int main() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Demo suite ----*/
|
||||
|
||||
// Creates a single QR Code, then prints it to the console.
|
||||
static void doBasicDemo() {
|
||||
const char *text = "Hello, world!"; // User-supplied text
|
||||
@ -181,6 +183,9 @@ static void doMaskDemo() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Utilities ----*/
|
||||
|
||||
// Prints the given QR Code to the console.
|
||||
static void printQr(const QrCode &qr) {
|
||||
int border = 4;
|
||||
|
@ -49,6 +49,9 @@ public final class QrCodeGeneratorDemo {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Demo suite ----*/
|
||||
|
||||
// Creates a single QR Code, then writes it to a PNG file and an SVG file.
|
||||
private static void doBasicDemo() throws IOException {
|
||||
String text = "Hello, world!"; // User-supplied Unicode text
|
||||
@ -176,6 +179,9 @@ public final class QrCodeGeneratorDemo {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Utilities ----*/
|
||||
|
||||
// Helper function to reduce code duplication.
|
||||
private static void writePng(BufferedImage img, String filepath) throws IOException {
|
||||
ImageIO.write(img, "png", new File(filepath));
|
||||
|
@ -28,8 +28,6 @@ from __future__ import print_function
|
||||
import qrcodegen
|
||||
|
||||
|
||||
# ---- Main program ----
|
||||
|
||||
def main():
|
||||
"""The main application program."""
|
||||
do_basic_demo()
|
||||
@ -38,6 +36,9 @@ def main():
|
||||
do_mask_demo()
|
||||
|
||||
|
||||
|
||||
# ---- Demo suite ----
|
||||
|
||||
def do_basic_demo():
|
||||
"""Creates a single QR Code, then prints it to the console."""
|
||||
text = u"Hello, world!" # User-supplied Unicode text
|
||||
|
@ -39,6 +39,9 @@ fn main() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Demo suite ----*/
|
||||
|
||||
// Creates a single QR Code, then prints it to the console.
|
||||
fn do_basic_demo() {
|
||||
let text: &'static str = "Hello, world!"; // User-supplied Unicode text
|
||||
@ -155,6 +158,7 @@ fn do_mask_demo() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---- Utilities ----*/
|
||||
|
||||
// Prints the given QrCode object to the console.
|
||||
|
Loading…
x
Reference in New Issue
Block a user