a QR code generator for the command line
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
865 B

#pragma once
#include <vector>
#include <string>
#include <qrcodegen.hpp>
#include "util.hpp"
#include "Renderer.hpp"
namespace massivedynamic {
enum class Format {
CONSOLE,
SVG,
PNG,
JPG,
BMP,
END
};
constexpr size_t FormatLength = static_cast<size_t>(Format::END);
class QR {
private:
std::string outputFile;
std::vector<bool> pixels;
qrcodegen::QrCode qr;
size_t size;
public:
QR(const std::string& data, std::string outputFile, size_t size, qrcodegen::QrCode::Ecc type);
QR(const QR&&) = delete;
QR(QR&) = delete;
~QR() = default;
QR& operator=(const QR&) = delete;
void render(Format format);
template<typename T>
void renderTyped() {
T renderer = T(this->pixels, this->qr.getSize(), this->size);
renderer.render(this->outputFile);
}
};
}