Aligned main comments in demo programs.

This commit is contained in:
Project Nayuki 2018-10-04 19:08:23 +00:00
parent dd47ef10c7
commit 0cded0ba36
5 changed files with 8 additions and 8 deletions

View File

@ -55,7 +55,7 @@ int main(void) {
// Creates a single QR Code, then prints it to the console. // Creates a single QR Code, then prints it to the console.
static void doBasicDemo(void) { static void doBasicDemo(void) {
const char *text = "Hello, world!"; // User-supplied text const char *text = "Hello, world!"; // User-supplied text
enum qrcodegen_Ecc errCorLvl = qrcodegen_Ecc_LOW; // Error correction level enum qrcodegen_Ecc errCorLvl = qrcodegen_Ecc_LOW; // Error correction level
// Make and print the QR Code symbol // Make and print the QR Code symbol

View File

@ -61,7 +61,7 @@ int main() {
// Creates a single QR Code, then prints it to the console. // Creates a single QR Code, then prints it to the console.
static void doBasicDemo() { static void doBasicDemo() {
const char *text = "Hello, world!"; // User-supplied text const char *text = "Hello, world!"; // User-supplied text
const QrCode::Ecc errCorLvl = QrCode::Ecc::LOW; // Error correction level const QrCode::Ecc errCorLvl = QrCode::Ecc::LOW; // Error correction level
// Make and print the QR Code symbol // Make and print the QR Code symbol

View File

@ -57,11 +57,11 @@ public final class QrCodeGeneratorDemo {
QrCode qr = QrCode.encodeText(text, errCorLvl); // Make the QR Code symbol QrCode qr = QrCode.encodeText(text, errCorLvl); // Make the QR Code symbol
BufferedImage img = qr.toImage(10, 4); // Convert to bitmap image BufferedImage img = qr.toImage(10, 4); // Convert to bitmap image
File imgFile = new File("hello-world-QR.png"); // File path for output File imgFile = new File("hello-world-QR.png"); // File path for output
ImageIO.write(img, "png", imgFile); // Write image to file ImageIO.write(img, "png", imgFile); // Write image to file
String svg = qr.toSvgString(4); // Convert to SVG XML code String svg = qr.toSvgString(4); // Convert to SVG XML code
Files.write(new File("hello-world-QR.svg").toPath(), Files.write(new File("hello-world-QR.svg").toPath(),
svg.getBytes(StandardCharsets.UTF_8)); svg.getBytes(StandardCharsets.UTF_8));
} }

View File

@ -41,7 +41,7 @@ def main():
def do_basic_demo(): def do_basic_demo():
"""Creates a single QR Code, then prints it to the console.""" """Creates a single QR Code, then prints it to the console."""
text = u"Hello, world!" # User-supplied Unicode text text = u"Hello, world!" # User-supplied Unicode text
errcorlvl = QrCode.Ecc.LOW # Error correction level errcorlvl = QrCode.Ecc.LOW # Error correction level
# Make and print the QR Code symbol # Make and print the QR Code symbol

View File

@ -47,7 +47,7 @@ fn main() {
// Creates a single QR Code, then prints it to the console. // Creates a single QR Code, then prints it to the console.
fn do_basic_demo() { fn do_basic_demo() {
let text: &'static str = "Hello, world!"; // User-supplied Unicode text let text: &'static str = "Hello, world!"; // User-supplied Unicode text
let errcorlvl: QrCodeEcc = QrCodeEcc::Low; // Error correction level let errcorlvl: QrCodeEcc = QrCodeEcc::Low; // Error correction level
// Make and print the QR Code symbol // Make and print the QR Code symbol