#include <string>
#include <iostream>
#include <vector>
#include <qrinvoice/model/qr_invoice.hpp>
#include <qrinvoice/model/validation.hpp>
// ...
const qrinvoice::model::qr_invoice qr_invoice = // create using qr_invoice::builder;
// now set some invalid data
// creditor must be set, this will result in a validation error
qr_invoice.get_creditor_info().get_creditor().get_address().set_name("");
// set an unsupported QR Type
qr_invoice.get_header().set_qr_type("foo");
const qrinvoice::model::validation::validation_result vr = qrinvoice::model::validation::validate(qr_invoice);
if(vr.has_errors()) {
const std::string &validation_error_summary = vr.get_validation_error_summary();
std::cout << validation_error_summary << std::endl;
// access each validation error on its own
const std::vector<qrinvoice::model::validation::validation_result::validation_error> &errors = vr.get_errors();
// ...
}