Aligned main comments in demo programs.

pull/39/merge
Project Nayuki 6 years ago
parent dd47ef10c7
commit 0cded0ba36

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

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

@ -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));
} }

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

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

Loading…
Cancel
Save