QRencode
QR Code encoder
Loading...
Searching...
No Matches
qrencode.h
Go to the documentation of this file.
1
99#ifndef QRENCODE_H
100#define QRENCODE_H
101
102#if defined(__cplusplus)
103extern "C" {
104#endif
105
120
130
134#define QRSPEC_VERSION_MAX 40
135
139#define MQRSPEC_VERSION_MAX 4
140
141
142/******************************************************************************
143 * Input data (qrinput.c)
144 *****************************************************************************/
145
152typedef struct _QRinput QRinput;
153
161extern QRinput *QRinput_new(void);
162
172extern QRinput *QRinput_new2(int version, QRecLevel level);
173
184extern QRinput *QRinput_newMQR(int version, QRecLevel level);
185
200extern int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data);
201
213extern int QRinput_appendECIheader(QRinput *input, unsigned int ecinum);
214
220extern int QRinput_getVersion(QRinput *input);
221
230extern int QRinput_setVersion(QRinput *input, int version);
231
238
248
258extern int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level);
259
265extern void QRinput_free(QRinput *input);
266
275extern int QRinput_check(QRencodeMode mode, int size, const unsigned char *data);
276
280typedef struct _QRinput_Struct QRinput_Struct;
281
289
295extern void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity);
296
309
315
329
341
345extern int QRinput_setFNC1First(QRinput *input);
346
350extern int QRinput_setFNC1Second(QRinput *input, unsigned char appid);
351
352/******************************************************************************
353 * QRcode output (qrencode.c)
354 *****************************************************************************/
355
375typedef struct {
377 int width;
378 unsigned char *data;
379} QRcode;
380
385typedef struct _QRcode_List {
387 struct _QRcode_List *next;
389
402
426extern QRcode *QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
427
432extern QRcode *QRcode_encodeString8bit(const char *string, int version, QRecLevel level);
433
438extern QRcode *QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
439
444extern QRcode *QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level);
445
458extern QRcode *QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level);
459
464extern QRcode *QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level);
465
470extern void QRcode_free(QRcode *qrcode);
471
479
499extern QRcode_List *QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive);
500
505extern QRcode_List *QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level);
506
520extern QRcode_List *QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level);
521
527extern int QRcode_List_size(QRcode_List *qrlist);
528
533extern void QRcode_List_free(QRcode_List *qrlist);
534
535
536/******************************************************************************
537 * System utilities
538 *****************************************************************************/
539
546extern void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version);
547
553extern char *QRcode_APIVersionString(void);
554
558#ifndef _MSC_VER
559extern void QRcode_clearCache(void) __attribute__ ((deprecated));
560#else
561extern void QRcode_clearCache(void);
562#endif
563
564#if defined(__cplusplus)
565}
566#endif
567
568#endif /* QRENCODE_H */
QRcode_List * QRcode_encodeString8bitStructured(const char *string, int version, QRecLevel level)
Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode.
QRcode * QRcode_encodeInput(QRinput *input)
Create a symbol from the input data.
void QRcode_List_free(QRcode_List *qrlist)
Free the QRcode_List.
QRecLevel QRinput_getErrorCorrectionLevel(QRinput *input)
Get current error correction level.
QRcode_List * QRcode_encodeStringStructured(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
Create structured symbols from the string.
int QRinput_getVersion(QRinput *input)
Get current version.
QRecLevel
Level of error correction.
Definition qrencode.h:124
@ QR_ECLEVEL_Q
Definition qrencode.h:127
@ QR_ECLEVEL_M
Definition qrencode.h:126
@ QR_ECLEVEL_H
highest
Definition qrencode.h:128
@ QR_ECLEVEL_L
lowest
Definition qrencode.h:125
QRinput * QRinput_new(void)
Instantiate an input data object.
void QRcode_APIVersion(int *major_version, int *minor_version, int *micro_version)
Return a string that identifies the library version.
int QRinput_setVersion(QRinput *input, int version)
Set version of the QR code that is to be encoded.
int QRinput_Struct_appendInput(QRinput_Struct *s, QRinput *input)
Append a QRinput object to the set.
void QRinput_free(QRinput *input)
Free the input object.
QRinput_Struct * QRinput_Struct_new(void)
Instantiate a set of input data object.
void QRinput_Struct_setParity(QRinput_Struct *s, unsigned char parity)
Set parity of structured symbols.
QRcode * QRcode_encodeStringMQR(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
Micro QR Code version of QRcode_encodeString().
int QRinput_check(QRencodeMode mode, int size, const unsigned char *data)
Validate the input data.
int QRinput_setFNC1Second(QRinput *input, unsigned char appid)
Set FNC1-2nd position flag and application identifier.
int QRinput_append(QRinput *input, QRencodeMode mode, int size, const unsigned char *data)
Append data to an input object.
int QRinput_setVersionAndErrorCorrectionLevel(QRinput *input, int version, QRecLevel level)
Set version and error correction level of the QR code at once.
QRinput_Struct * QRinput_splitQRinputToStruct(QRinput *input)
Split a QRinput to QRinput_Struct.
int QRinput_Struct_insertStructuredAppendHeaders(QRinput_Struct *s)
Insert structured-append headers to the input structure.
QRcode_List * QRcode_encodeDataStructured(int size, const unsigned char *data, int version, QRecLevel level)
Create structured symbols from byte stream (may include '\0').
struct _QRinput QRinput
Singly linked list to contain input strings.
Definition qrencode.h:152
int QRinput_appendECIheader(QRinput *input, unsigned int ecinum)
Append ECI header.
int QRinput_setFNC1First(QRinput *input)
Set FNC1-1st position flag.
QRencodeMode
Encoding mode.
Definition qrencode.h:109
@ QR_MODE_KANJI
Kanji (shift-jis) mode.
Definition qrencode.h:114
@ QR_MODE_STRUCTURE
Internal use only.
Definition qrencode.h:115
@ QR_MODE_FNC1FIRST
FNC1, first position.
Definition qrencode.h:117
@ QR_MODE_ECI
ECI mode.
Definition qrencode.h:116
@ QR_MODE_FNC1SECOND
FNC1, second position.
Definition qrencode.h:118
@ QR_MODE_AN
Alphabet-numeric mode.
Definition qrencode.h:112
@ QR_MODE_8
8-bit data mode
Definition qrencode.h:113
@ QR_MODE_NUL
Terminator (NUL character). Internal use only.
Definition qrencode.h:110
@ QR_MODE_NUM
Numeric mode.
Definition qrencode.h:111
QRcode * QRcode_encodeString8bitMQR(const char *string, int version, QRecLevel level)
Micro QR Code version of QRcode_encodeString8bit().
QRinput * QRinput_new2(int version, QRecLevel level)
Instantiate an input data object.
char * QRcode_APIVersionString(void)
Return a string that identifies the library version.
QRcode_List * QRcode_encodeInputStructured(QRinput_Struct *s)
Create structured symbols from the input data.
QRinput * QRinput_newMQR(int version, QRecLevel level)
Instantiate an input data object.
void QRinput_Struct_free(QRinput_Struct *s)
Free all of QRinput in the set.
QRcode * QRcode_encodeDataMQR(int size, const unsigned char *data, int version, QRecLevel level)
Micro QR Code version of QRcode_encodeData().
void QRcode_clearCache(void) __attribute__((deprecated))
struct _QRinput_Struct QRinput_Struct
Set of QRinput for structured symbols.
Definition qrencode.h:280
void QRcode_free(QRcode *qrcode)
Free the instance of QRcode class.
QRcode * QRcode_encodeString8bit(const char *string, int version, QRecLevel level)
Same to QRcode_encodeString(), but encode whole data in 8-bit mode.
int QRinput_setErrorCorrectionLevel(QRinput *input, QRecLevel level)
Set error correction level of the QR code that is to be encoded.
QRcode * QRcode_encodeData(int size, const unsigned char *data, int version, QRecLevel level)
Encode byte stream (may include '\0') in 8-bit mode.
int QRcode_List_size(QRcode_List *qrlist)
Return the number of symbols included in a QRcode_List.
QRcode * QRcode_encodeString(const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
Create a symbol from the string.
Singly-linked list of QRcode.
Definition qrencode.h:385
struct _QRcode_List * next
Definition qrencode.h:387
QRcode * code
Definition qrencode.h:386
QRcode class.
Definition qrencode.h:375
int width
width of the symbol
Definition qrencode.h:377
int version
version of the symbol
Definition qrencode.h:376
unsigned char * data
symbol data
Definition qrencode.h:378