TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Classes | Macros | Typedefs | Enumerations | Functions
qrencode.h File Reference
#include "global.h"

Go to the source code of this file.

Classes

struct  QRcode
 QRcode class. More...
 
struct  _QRcode_List
 Singly-linked list of QRcode. More...
 

Macros

#define QRSPEC_VERSION_MAX   40
 Maximum version (size) of QR-code symbol. More...
 
#define MQRSPEC_VERSION_MAX   4
 Maximum version (size) of QR-code symbol. More...
 

Typedefs

typedef struct _QRinput QRinput
 Singly linked list to contain input strings. More...
 
typedef struct _QRinput_Struct QRinput_Struct
 Set of QRinput for structured symbols. More...
 
typedef struct _QRcode_List QRcode_List
 Singly-linked list of QRcode. More...
 

Enumerations

enum  QRencodeMode {
  QR_MODE_NUL = -1, QR_MODE_NUM = 0, QR_MODE_AN, QR_MODE_8,
  QR_MODE_KANJI, QR_MODE_STRUCTURE, QR_MODE_ECI, QR_MODE_FNC1FIRST,
  QR_MODE_FNC1SECOND
}
 Encoding mode. More...
 
enum  QRecLevel { QR_ECLEVEL_L = 0, QR_ECLEVEL_M, QR_ECLEVEL_Q, QR_ECLEVEL_H }
 Level of error correction. More...
 

Functions

EXTRAS_EXPORT QRinputQRinput_new (void)
 Instantiate an input data object. More...
 
EXTRAS_EXPORT QRinputQRinput_new2 (int version, QRecLevel level)
 Instantiate an input data object. More...
 
EXTRAS_EXPORT QRinputQRinput_newMQR (int version, QRecLevel level)
 Instantiate an input data object. More...
 
EXTRAS_EXPORT int QRinput_append (QRinput *input, QRencodeMode mode, int size, const unsigned char *data)
 Append data to an input object. More...
 
EXTRAS_EXPORT int QRinput_appendECIheader (QRinput *input, unsigned int ecinum)
 Append ECI header. More...
 
EXTRAS_EXPORT int QRinput_getVersion (QRinput *input)
 Get current version. More...
 
EXTRAS_EXPORT int QRinput_setVersion (QRinput *input, int version)
 Set version of the QR code that is to be encoded. More...
 
EXTRAS_EXPORT QRecLevel QRinput_getErrorCorrectionLevel (QRinput *input)
 Get current error correction level. More...
 
EXTRAS_EXPORT int QRinput_setErrorCorrectionLevel (QRinput *input, QRecLevel level)
 Set error correction level of the QR code that is to be encoded. More...
 
EXTRAS_EXPORT int QRinput_setVersionAndErrorCorrectionLevel (QRinput *input, int version, QRecLevel level)
 Set version and error correction level of the QR code at once. More...
 
EXTRAS_EXPORT void QRinput_free (QRinput *input)
 Free the input object. More...
 
EXTRAS_EXPORT int QRinput_check (QRencodeMode mode, int size, const unsigned char *data)
 Validate the input data. More...
 
EXTRAS_EXPORT QRinput_StructQRinput_Struct_new (void)
 Instantiate a set of input data object. More...
 
EXTRAS_EXPORT void QRinput_Struct_setParity (QRinput_Struct *s, unsigned char parity)
 Set parity of structured symbols. More...
 
EXTRAS_EXPORT int QRinput_Struct_appendInput (QRinput_Struct *s, QRinput *input)
 Append a QRinput object to the set. More...
 
EXTRAS_EXPORT void QRinput_Struct_free (QRinput_Struct *s)
 Free all of QRinput in the set. More...
 
EXTRAS_EXPORT QRinput_StructQRinput_splitQRinputToStruct (QRinput *input)
 Split a QRinput to QRinput_Struct. More...
 
EXTRAS_EXPORT int QRinput_Struct_insertStructuredAppendHeaders (QRinput_Struct *s)
 Insert structured-append headers to the input structure. More...
 
EXTRAS_EXPORT int QRinput_setFNC1First (QRinput *input)
 Set FNC1-1st position flag. More...
 
EXTRAS_EXPORT int QRinput_setFNC1Second (QRinput *input, unsigned char appid)
 Set FNC1-2nd position flag and application identifier. More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeInput (QRinput *input)
 Create a symbol from the input data. More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeString (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
 Create a symbol from the string. More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeString8bit (const char *string, int version, QRecLevel level)
 Same to QRcode_encodeString(), but encode whole data in 8-bit mode. More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeStringMQR (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
 Micro QR Code version of QRcode_encodeString(). More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeString8bitMQR (const char *string, int version, QRecLevel level)
 Micro QR Code version of QRcode_encodeString8bit(). More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeData (int size, const unsigned char *data, int version, QRecLevel level)
 Encode byte stream (may include '\0') in 8-bit mode. More...
 
EXTRAS_EXPORT QRcodeQRcode_encodeDataMQR (int size, const unsigned char *data, int version, QRecLevel level)
 Micro QR Code version of QRcode_encodeData(). More...
 
EXTRAS_EXPORT void QRcode_free (QRcode *qrcode)
 Free the instance of QRcode class. More...
 
EXTRAS_EXPORT QRcode_ListQRcode_encodeInputStructured (QRinput_Struct *s)
 Create structured symbols from the input data. More...
 
EXTRAS_EXPORT QRcode_ListQRcode_encodeStringStructured (const char *string, int version, QRecLevel level, QRencodeMode hint, int casesensitive)
 Create structured symbols from the string. More...
 
EXTRAS_EXPORT QRcode_ListQRcode_encodeString8bitStructured (const char *string, int version, QRecLevel level)
 Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode. More...
 
EXTRAS_EXPORT QRcode_ListQRcode_encodeDataStructured (int size, const unsigned char *data, int version, QRecLevel level)
 Create structured symbols from byte stream (may include '\0'). More...
 
EXTRAS_EXPORT int QRcode_List_size (QRcode_List *qrlist)
 Return the number of symbols included in a QRcode_List. More...
 
EXTRAS_EXPORT void QRcode_List_free (QRcode_List *qrlist)
 Free the QRcode_List. More...
 
EXTRAS_EXPORT void QRcode_APIVersion (int *major_version, int *minor_version, int *micro_version)
 Return a string that identifies the library version. More...
 
EXTRAS_EXPORT char * QRcode_APIVersionString (void)
 Return a string that identifies the library version. More...
 
EXTRAS_EXPORT void QRcode_clearCache (void) __attribute__((deprecated))
 

Macro Definition Documentation

#define MQRSPEC_VERSION_MAX   4
#define QRSPEC_VERSION_MAX   40

Typedef Documentation

typedef struct _QRcode_List QRcode_List

Singly-linked list of QRcode.

Used to represent a structured symbols. A list is terminated with NULL.

typedef struct _QRinput QRinput

Singly linked list to contain input strings.

An instance of this class contains its version and error correction level too. It is required to set them by QRinput_setVersion() and QRinput_setErrorCorrectionLevel(), or use QRinput_new2() to instantiate an object.

Definition at line 154 of file qrencode.h.

Set of QRinput for structured symbols.

Definition at line 282 of file qrencode.h.

Enumeration Type Documentation

enum QRecLevel

Level of error correction.

Enumerator
QR_ECLEVEL_L 

lowest

QR_ECLEVEL_M 
QR_ECLEVEL_Q 
QR_ECLEVEL_H 

highest

Definition at line 126 of file qrencode.h.

Encoding mode.

Enumerator
QR_MODE_NUL 

Terminator (NUL character). Internal use only.

QR_MODE_NUM 

Numeric mode.

QR_MODE_AN 

Alphabet-numeric mode.

QR_MODE_8 

8-bit data mode

QR_MODE_KANJI 

Kanji (shift-jis) mode.

QR_MODE_STRUCTURE 

Internal use only.

QR_MODE_ECI 

ECI mode.

QR_MODE_FNC1FIRST 

FNC1, first position.

QR_MODE_FNC1SECOND 

FNC1, second position.

Definition at line 111 of file qrencode.h.

Function Documentation

EXTRAS_EXPORT void QRcode_APIVersion ( int major_version,
int minor_version,
int micro_version 
)

Return a string that identifies the library version.

Parameters
major_versionmajor version number
minor_versionminor version number
micro_versionmicro version number

Definition at line 915 of file qrencode.c.

References MAJOR_VERSION, MICRO_VERSION, and MINOR_VERSION.

EXTRAS_EXPORT char* QRcode_APIVersionString ( void  )

Return a string that identifies the library version.

Returns
a string identifies the library version. The string is held by the library. Do NOT free it.

Definition at line 928 of file qrencode.c.

References VERSION.

EXTRAS_EXPORT void QRcode_clearCache ( void  )
Deprecated:

Definition at line 933 of file qrencode.c.

EXTRAS_EXPORT QRcode* QRcode_encodeData ( int  size,
const unsigned char *  data,
int  version,
QRecLevel  level 
)

Encode byte stream (may include '\0') in 8-bit mode.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
sizesize of the input data.
datainput data.
versionversion of the symbol. If 0, the library chooses the minimum version for the given input data.
levelerror correction level.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory for input objects.
ERANGEinput data is too large.

Definition at line 696 of file qrencode.c.

References QRcode_encodeDataReal().

EXTRAS_EXPORT QRcode* QRcode_encodeDataMQR ( int  size,
const unsigned char *  data,
int  version,
QRecLevel  level 
)

Micro QR Code version of QRcode_encodeData().

Warning
This function is THREAD UNSAFE when pthread is disabled.

Definition at line 710 of file qrencode.c.

References MQRSPEC_VERSION_MAX, and QRcode_encodeDataReal().

EXTRAS_EXPORT QRcode_List* QRcode_encodeDataStructured ( int  size,
const unsigned char *  data,
int  version,
QRecLevel  level 
)

Create structured symbols from byte stream (may include '\0').

Wholde data are encoded in 8-bit mode.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
sizesize of the input data.
datainput dat.
versionversion of the symbol.
levelerror correction level.
Returns
a singly-linked list of QRcode. On error, NULL is returned, and errno is set to indicate the error. See Exceptions for the details.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory for input objects.

Definition at line 890 of file qrencode.c.

References QR_MODE_NUL, and QRcode_encodeDataStructuredReal().

Referenced by QRcode_encodeString8bitStructured().

EXTRAS_EXPORT QRcode* QRcode_encodeInput ( QRinput input)

Create a symbol from the input data.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
inputinput data.
Returns
an instance of QRcode class. The version of the result QRcode may be larger than the designated version. On error, NULL is returned, and errno is set to indicate the error. See Exceptions for the details.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory for input objects.

Definition at line 605 of file qrencode.c.

References _QRinput::mqr, QRcode_encodeMask(), and QRcode_encodeMaskMQR().

Referenced by QRcode_encodeDataReal(), QRcode_encodeInputStructured(), and QRcode_encodeStringReal().

EXTRAS_EXPORT QRcode_List* QRcode_encodeInputStructured ( QRinput_Struct s)

Create structured symbols from the input data.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
sinput data, structured.
Returns
a singly-linked list of QRcode.

Definition at line 808 of file qrencode.c.

References _QRcode_List::code, _QRinput_Struct::head, _QRinput_InputList::input, _QRinput_InputList::next, _QRcode_List::next, QRcode_encodeInput(), QRcode_List_free(), and QRcode_List_newEntry().

Referenced by QRcode_encodeInputToStructured().

EXTRAS_EXPORT QRcode* QRcode_encodeString ( const char *  string,
int  version,
QRecLevel  level,
QRencodeMode  hint,
int  casesensitive 
)

Create a symbol from the string.

The library automatically parses the input string and encodes in a QR Code symbol.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
stringinput string. It must be NUL terminated.
versionversion of the symbol. If 0, the library chooses the minimum version for the given input data.
levelerror correction level.
hinttell the library how Japanese Kanji characters should be encoded. If QR_MODE_KANJI is given, the library assumes that the given string contains Shift-JIS characters and encodes them in Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical characters will be encoded as is. If you want to embed UTF-8 string, choose this. Other mode will cause EINVAL error.
casesensitivecase-sensitive(1) or not(0).
Returns
an instance of QRcode class. The version of the result QRcode may be larger than the designated version. On error, NULL is returned, and errno is set to indicate the error. See Exceptions for the details.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory for input objects.
ERANGEinput data is too large.

Definition at line 647 of file qrencode.c.

References QRcode_encodeStringReal().

Referenced by QRCodeQWidget::paintEvent().

EXTRAS_EXPORT QRcode* QRcode_encodeString8bit ( const char *  string,
int  version,
QRecLevel  level 
)

Same to QRcode_encodeString(), but encode whole data in 8-bit mode.

Warning
This function is THREAD UNSAFE when pthread is disabled.

Definition at line 701 of file qrencode.c.

References QRcode_encodeDataReal().

EXTRAS_EXPORT QRcode* QRcode_encodeString8bitMQR ( const char *  string,
int  version,
QRecLevel  level 
)

Micro QR Code version of QRcode_encodeString8bit().

Warning
This function is THREAD UNSAFE when pthread is disabled.

Definition at line 725 of file qrencode.c.

References MQRSPEC_VERSION_MAX, and QRcode_encodeDataReal().

EXTRAS_EXPORT QRcode_List* QRcode_encodeString8bitStructured ( const char *  string,
int  version,
QRecLevel  level 
)

Same to QRcode_encodeStringStructured(), but encode whole data in 8-bit mode.

Warning
This function is THREAD UNSAFE when pthread is disabled.

Definition at line 894 of file qrencode.c.

References QRcode_encodeDataStructured().

EXTRAS_EXPORT QRcode* QRcode_encodeStringMQR ( const char *  string,
int  version,
QRecLevel  level,
QRencodeMode  hint,
int  casesensitive 
)

Micro QR Code version of QRcode_encodeString().

Warning
This function is THREAD UNSAFE when pthread is disabled.

Definition at line 652 of file qrencode.c.

References MQRSPEC_VERSION_MAX, and QRcode_encodeStringReal().

EXTRAS_EXPORT QRcode_List* QRcode_encodeStringStructured ( const char *  string,
int  version,
QRecLevel  level,
QRencodeMode  hint,
int  casesensitive 
)

Create structured symbols from the string.

The library automatically parses the input string and encodes in a QR Code symbol.

Warning
This function is THREAD UNSAFE when pthread is disabled.
Parameters
stringinput string. It must be NUL terminated.
versionversion of the symbol.
levelerror correction level.
hinttell the library how Japanese Kanji characters should be encoded. If QR_MODE_KANJI is given, the library assumes that the given string contains Shift-JIS characters and encodes them in Kanji-mode. If QR_MODE_8 is given, all of non-alphanumerical characters will be encoded as is. If you want to embed UTF-8 string, choose this. Other mode will cause EINVAL error.
casesensitivecase-sensitive(1) or not(0).
Returns
a singly-linked list of QRcode. On error, NULL is returned, and errno is set to indicate the error. See Exceptions for the details.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory for input objects.

Definition at line 902 of file qrencode.c.

References QRcode_encodeDataStructuredReal().

EXTRAS_EXPORT void QRcode_free ( QRcode qrcode)

Free the instance of QRcode class.

Parameters
qrcodean instance of QRcode class.

Definition at line 421 of file qrencode.c.

References QRcode::data, and free().

Referenced by QRCodeQWidget::paintEvent(), and QRcode_List_freeEntry().

EXTRAS_EXPORT void QRcode_List_free ( QRcode_List qrlist)

Free the QRcode_List.

Parameters
qrlista head entry of a QRcode_List.

Definition at line 770 of file qrencode.c.

References _QRcode_List::next, and QRcode_List_freeEntry().

Referenced by QRcode_encodeInputStructured().

EXTRAS_EXPORT int QRcode_List_size ( QRcode_List qrlist)

Return the number of symbols included in a QRcode_List.

Parameters
qrlista head entry of a QRcode_List.
Returns
number of symbols in the list.

Definition at line 781 of file qrencode.c.

References _QRcode_List::next.

EXTRAS_EXPORT int QRinput_append ( QRinput input,
QRencodeMode  mode,
int  size,
const unsigned char *  data 
)

Append data to an input object.

The data is copied and appended to the input object.

Parameters
inputinput object.
modeencoding mode.
sizesize of data (byte).
dataa pointer to the memory area of the input data.
Return values
0success.
-1an error occurred and errno is set to indeicate the error. See Execptions for the details.
Exceptions
ENOMEMunable to allocate memory.
EINVALinput data is invalid.

Definition at line 221 of file qrinput.c.

References QRinput_appendEntry(), and QRinput_List_newEntry().

Referenced by QRcode_encodeDataReal(), QRcode_encodeDataStructuredReal(), QRinput_appendECIheader(), Split_eat8(), Split_eatAn(), Split_eatKanji(), and Split_eatNum().

EXTRAS_EXPORT int QRinput_appendECIheader ( QRinput input,
unsigned int  ecinum 
)

Append ECI header.

Parameters
inputinput object.
ecinumECI indicator number (0 - 999999)
Return values
0success.
-1an error occurred and errno is set to indeicate the error. See Execptions for the details.
Exceptions
ENOMEMunable to allocate memory.
EINVALinput data is invalid.

Definition at line 274 of file qrinput.c.

References QR_MODE_ECI, and QRinput_append().

EXTRAS_EXPORT int QRinput_check ( QRencodeMode  mode,
int  size,
const unsigned char *  data 
)

Validate the input data.

Parameters
modeencoding mode.
sizesize of data (byte).
dataa pointer to the memory area of the input data.
Return values
0success.
-1invalid arguments.

Definition at line 817 of file qrinput.c.

References QR_MODE_8, QR_MODE_AN, QR_MODE_ECI, QR_MODE_FNC1FIRST, QR_MODE_FNC1SECOND, QR_MODE_KANJI, QR_MODE_NUL, QR_MODE_NUM, QR_MODE_STRUCTURE, QRinput_checkModeAn(), QRinput_checkModeFNC1Second(), QRinput_checkModeKanji(), and QRinput_checkModeNum().

Referenced by QRinput_List_newEntry().

EXTRAS_EXPORT void QRinput_free ( QRinput input)

Free the input object.

All of data chunks in the input object are freed too.

Parameters
inputinput object.

Definition at line 292 of file qrinput.c.

References free(), _QRinput::head, _QRinput_List::next, and QRinput_List_freeEntry().

Referenced by QRcode_encodeDataReal(), QRcode_encodeDataStructuredReal(), QRcode_encodeStringReal(), QRinput_dup(), QRinput_InputList_freeEntry(), and QRinput_splitQRinputToStruct().

EXTRAS_EXPORT QRecLevel QRinput_getErrorCorrectionLevel ( QRinput input)

Get current error correction level.

Parameters
inputinput object.
Returns
Current error correcntion level.

Definition at line 172 of file qrinput.c.

References _QRinput::level.

EXTRAS_EXPORT int QRinput_getVersion ( QRinput input)

Get current version.

Parameters
inputinput object.
Returns
current version.

Definition at line 155 of file qrinput.c.

References _QRinput::version.

Referenced by QRinput_convertData().

EXTRAS_EXPORT QRinput* QRinput_new ( void  )

Instantiate an input data object.

The version is set to 0 (auto-select) and the error correction level is set to QR_ECLEVEL_L.

Returns
an input object (initialized). On error, NULL is returned and errno is set to indicate the error.
Exceptions
ENOMEMunable to allocate memory.

Definition at line 109 of file qrinput.c.

References QR_ECLEVEL_L, and QRinput_new2().

EXTRAS_EXPORT QRinput* QRinput_new2 ( int  version,
QRecLevel  level 
)

Instantiate an input data object.

Parameters
versionversion number.
levelError correction level.
Returns
an input object (initialized). On error, NULL is returned and errno is set to indicate the error.
Exceptions
ENOMEMunable to allocate memory for input objects.
EINVALinvalid arguments.

Definition at line 114 of file qrinput.c.

References _QRinput::fnc1, _QRinput::head, _QRinput::level, malloc(), _QRinput::mqr, QR_ECLEVEL_H, QRSPEC_VERSION_MAX, _QRinput::tail, and _QRinput::version.

Referenced by QRcode_encodeDataReal(), QRcode_encodeDataStructuredReal(), QRcode_encodeStringReal(), QRinput_dup(), QRinput_new(), QRinput_newMQR(), and QRinput_splitQRinputToStruct().

EXTRAS_EXPORT QRinput* QRinput_newMQR ( int  version,
QRecLevel  level 
)

Instantiate an input data object.

Object's Micro QR Code flag is set. Unlike with full-sized QR Code, version number must be specified (>0).

Parameters
versionversion number (1–4).
levelError correction level.
Returns
an input object (initialized). On error, NULL is returned and errno is set to indicate the error.
Exceptions
ENOMEMunable to allocate memory for input objects.
EINVALinvalid arguments.

Definition at line 136 of file qrinput.c.

References _QRinput::mqr, MQRspec_getECCLength(), MQRSPEC_VERSION_MAX, and QRinput_new2().

Referenced by QRcode_encodeDataReal(), QRcode_encodeStringReal(), and QRinput_dup().

EXTRAS_EXPORT int QRinput_setErrorCorrectionLevel ( QRinput input,
QRecLevel  level 
)

Set error correction level of the QR code that is to be encoded.

This function cannot be applied to Micro QR Code.

Parameters
inputinput object.
levelError correction level.
Return values
0success.
-1invalid argument.

Definition at line 177 of file qrinput.c.

References _QRinput::level, _QRinput::mqr, and QR_ECLEVEL_H.

EXTRAS_EXPORT int QRinput_setFNC1First ( QRinput input)

Set FNC1-1st position flag.

Definition at line 1616 of file qrinput.c.

References _QRinput::fnc1, and _QRinput::mqr.

EXTRAS_EXPORT int QRinput_setFNC1Second ( QRinput input,
unsigned char  appid 
)

Set FNC1-2nd position flag and application identifier.

Definition at line 1627 of file qrinput.c.

References _QRinput::appid, _QRinput::fnc1, and _QRinput::mqr.

EXTRAS_EXPORT int QRinput_setVersion ( QRinput input,
int  version 
)

Set version of the QR code that is to be encoded.

This function cannot be applied to Micro QR Code.

Parameters
inputinput object.
versionversion number (0 = auto)
Return values
0success.
-1invalid argument.

Definition at line 160 of file qrinput.c.

References _QRinput::mqr, QRSPEC_VERSION_MAX, and _QRinput::version.

Referenced by QRinput_convertData().

EXTRAS_EXPORT int QRinput_setVersionAndErrorCorrectionLevel ( QRinput input,
int  version,
QRecLevel  level 
)

Set version and error correction level of the QR code at once.

This function is recommened for Micro QR Code.

Parameters
inputinput object.
versionversion number (0 = auto)
levelError correction level.
Return values
0success.
-1invalid argument.

Definition at line 189 of file qrinput.c.

References _QRinput::level, _QRinput::mqr, MQRspec_getECCLength(), MQRSPEC_VERSION_MAX, QR_ECLEVEL_H, QRSPEC_VERSION_MAX, and _QRinput::version.

EXTRAS_EXPORT QRinput_Struct* QRinput_splitQRinputToStruct ( QRinput input)

Split a QRinput to QRinput_Struct.

It calculates a parity, set it, then insert structured-append headers. QRinput created by QRinput_newMQR() will be rejected.

Parameters
inputinput object. Version number and error correction level must be set.
Returns
a set of input data. On error, NULL is returned, and errno is set to indicate the error. See Exceptions for the details.
Exceptions
ERANGEinput data is too large.
EINVALinvalid input data.
ENOMEMunable to allocate memory.

Definition at line 1483 of file qrinput.c.

References BitStream_free(), BitStream_new(), BitStream_reset, _QRinput::head, _QRinput::level, MAX_STRUCTURED_SYMBOLS, _QRinput_List::mode, _QRinput::mqr, _QRinput_List::next, QRinput_calcParity(), QRinput_dup(), QRinput_encodeBitStream(), QRinput_estimateBitStreamSizeOfEntry(), QRinput_free(), QRinput_lengthOfCode(), QRinput_new2(), QRinput_splitEntry(), QRinput_Struct_appendInput(), QRinput_Struct_free(), QRinput_Struct_insertStructuredAppendHeaders(), QRinput_Struct_new(), QRinput_Struct_setParity(), QRspec_getDataLength(), _QRinput_Struct::size, STRUCTURE_HEADER_SIZE, _QRinput::tail, and _QRinput::version.

Referenced by QRcode_encodeInputToStructured().

EXTRAS_EXPORT int QRinput_Struct_appendInput ( QRinput_Struct s,
QRinput input 
)

Append a QRinput object to the set.

QRinput created by QRinput_newMQR() will be rejected.

Warning
never append the same QRinput object twice or more.
Parameters
sstructured input object.
inputan input object.
Return values
>0number of input objects in the structure.
-1an error occurred. See Exceptions for the details.
Exceptions
ENOMEMunable to allocate memory.
EINVALinvalid arguments.

Definition at line 1391 of file qrinput.c.

References _QRinput_Struct::head, _QRinput::mqr, _QRinput_InputList::next, QRinput_InputList_newEntry(), _QRinput_Struct::size, and _QRinput_Struct::tail.

Referenced by QRinput_splitQRinputToStruct().

EXTRAS_EXPORT void QRinput_Struct_free ( QRinput_Struct s)

Free all of QRinput in the set.

Parameters
sa structured input object.

Definition at line 1415 of file qrinput.c.

References free(), _QRinput_Struct::head, _QRinput_InputList::next, and QRinput_InputList_freeEntry().

Referenced by QRcode_encodeInputToStructured(), and QRinput_splitQRinputToStruct().

EXTRAS_EXPORT int QRinput_Struct_insertStructuredAppendHeaders ( QRinput_Struct s)

Insert structured-append headers to the input structure.

It calculates a parity and set it if the parity is not set yet.

Parameters
sinput structure
Return values
0success.
-1an error occurred and errno is set to indeicate the error. See Execptions for the details.
Exceptions
EINVALinvalid input object.
ENOMEMunable to allocate memory.

Definition at line 1588 of file qrinput.c.

References _QRinput_Struct::head, _QRinput_InputList::input, _QRinput_InputList::next, _QRinput_Struct::parity, QRinput_insertStructuredAppendHeader(), QRinput_Struct_calcParity(), and _QRinput_Struct::size.

Referenced by QRinput_splitQRinputToStruct().

EXTRAS_EXPORT QRinput_Struct* QRinput_Struct_new ( void  )

Instantiate a set of input data object.

Returns
an instance of QRinput_Struct. On error, NULL is returned and errno is set to indicate the error.
Exceptions
ENOMEMunable to allocate memory.

Definition at line 1371 of file qrinput.c.

References _QRinput_Struct::head, malloc(), _QRinput_Struct::parity, _QRinput_Struct::size, and _QRinput_Struct::tail.

Referenced by QRinput_splitQRinputToStruct().

EXTRAS_EXPORT void QRinput_Struct_setParity ( QRinput_Struct s,
unsigned char  parity 
)

Set parity of structured symbols.

Parameters
sstructured input object.
parityparity of s.

Definition at line 1386 of file qrinput.c.

References int(), and _QRinput_Struct::parity.

Referenced by QRinput_splitQRinputToStruct(), and QRinput_Struct_calcParity().