Single-file header library to parse an International Driver License (IDL).
IDLs are usually encoded in a PDF417 barcode. Reading this barcode is not part of this library.
Before you include the header file in one C or C++ file, you need to define
IDL_PARSER_IMPLEMENTATION
to create the implementation:
#define IDL_PARSER_IMPLEMENTATION
#include "idlparser.h"
Then invoke parse_idl()
with IDL data:
IDL idl;
if (!parse_idl(&idl, data)) {
fprintf(stderr, "error: failed to parse IDL\n");
free_idl(&idl);
}
Now the structure idl
contains the parsed elements of the IDL:
printf("IIN:[%s]\n", idl.iin);
for (unsigned int i = 0; i < idl.count; ++i) {
IDLElement *e = idl.elements + i;
printf("%s:[%s]\n", e->key, e->value);
}
free_idl(&idl);