feat: Add QR code generation functionality to PrivateBin API library

- Add generate_qr_code() function for creating QR codes from PrivateBin links
- Implement SVG output format for scalable QR code generation
- Add qr_generator.h/cpp with self-contained QR code implementation
- Update CMakeLists.txt to include new QR code source files
- Integrate QR code documentation into README.md
- Update example program to demonstrate QR code generation
- Update CHANGELOG.md with v0.1.1.6 release notes
- Remove separate README_QR_CODE.md file

The implementation provides simplified QR code generation with:
- Position detection patterns for QR code recognition
- Configurable size and border parameters
- No external dependencies
- Comprehensive error handling
- Memory management using existing free_string() function
This commit is contained in:
mbusc
2025-08-28 22:21:00 +02:00
parent 77879e6521
commit f1b791f1f4
8 changed files with 361 additions and 0 deletions

28
include/qr_generator.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef QR_GENERATOR_H
#define QR_GENERATOR_H
#include <vector>
#include <string>
namespace QRGenerator {
/**
* Generates QR code data for a given URL in SVG format
*
* @param url The URL to encode
* @param size The size of the QR code in pixels
* @param border The border size around the QR code in modules
* @return String containing the QR code data in SVG format
*/
std::string generate_qr_code_svg(const std::string& url, int size = 256, int border = 4);
/**
* Generates a simple text-based QR code representation
*
* @param url The URL to encode
* @param width The width of the text representation
* @return String containing the text-based QR code
*/
std::string generate_qr_code_text(const std::string& url, int width = 40);
}
#endif // QR_GENERATOR_H