qrencode
4.1.1
About:
libqrencode
is a fast and compact library and command-line utility for encoding data in a QR Code symbol.
Fossies
Dox
:
qrencode-4.1.1.tar.bz2
("unofficial" and yet experimental doxygen-generated source code documentation)
qrinput.h
Go to the documentation of this file.
1
/*
2
* qrencode - QR Code encoder
3
*
4
* Input data chunk class
5
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
6
*
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or any later version.
11
*
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
16
*
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
*/
21
22
#ifndef QRINPUT_H
23
#define QRINPUT_H
24
25
#include "
qrencode.h
"
26
#include "
bitstream.h
"
27
28
int
QRinput_isSplittableMode
(
QRencodeMode
mode);
29
30
/******************************************************************************
31
* Entry of input data
32
*****************************************************************************/
33
typedef
struct
_QRinput_List
QRinput_List
;
34
35
struct
_QRinput_List
{
36
QRencodeMode
mode
;
37
int
size
;
///< Size of data chunk (byte).
38
unsigned
char
*
data
;
///< Data chunk.
39
BitStream
*
bstream
;
40
QRinput_List
*
next
;
41
};
42
43
/******************************************************************************
44
* Input Data
45
*****************************************************************************/
46
struct
_QRinput
{
47
int
version
;
48
QRecLevel
level
;
49
QRinput_List
*
head
;
50
QRinput_List
*
tail
;
51
int
mqr
;
52
int
fnc1
;
53
unsigned
char
appid
;
54
};
55
56
/******************************************************************************
57
* Structured append input data
58
*****************************************************************************/
59
typedef
struct
_QRinput_InputList
QRinput_InputList
;
60
61
struct
_QRinput_InputList
{
62
QRinput
*
input
;
63
QRinput_InputList
*
next
;
64
};
65
66
struct
_QRinput_Struct
{
67
int
size
;
///< number of structured symbols
68
int
parity
;
69
QRinput_InputList
*
head
;
70
QRinput_InputList
*
tail
;
71
};
72
73
/**
74
* Pack all bit streams padding bits into a byte array.
75
* @param input input data.
76
* @return padded merged byte stream
77
*/
78
extern
unsigned
char
*
QRinput_getByteStream
(
QRinput
*input);
79
80
81
extern
int
QRinput_estimateBitsModeNum
(
int
size
);
82
extern
int
QRinput_estimateBitsModeAn
(
int
size
);
83
extern
int
QRinput_estimateBitsMode8
(
int
size
);
84
extern
int
QRinput_estimateBitsModeKanji
(
int
size
);
85
86
extern
QRinput
*
QRinput_dup
(
QRinput
*input);
87
88
extern
const
signed
char
QRinput_anTable
[128];
89
90
/**
91
* Look up the alphabet-numeric convesion table (see JIS X0510:2004, pp.19).
92
* @param __c__ character
93
* @return value
94
*/
95
#define QRinput_lookAnTable(__c__) \
96
((__c__ & 0x80)?-1:QRinput_anTable[(int)__c__])
97
98
/**
99
* Length of a standard mode indicator in bits.
100
*/
101
102
#define MODE_INDICATOR_SIZE 4
103
104
/**
105
* Length of a segment of structured-append header.
106
*/
107
#define STRUCTURE_HEADER_SIZE 20
108
109
/**
110
* Maximum number of symbols in a set of structured-appended symbols.
111
*/
112
#define MAX_STRUCTURED_SYMBOLS 16
113
114
#ifdef WITH_TESTS
115
extern
int
QRinput_mergeBitStream
(
QRinput
*input,
BitStream
*bstream);
116
extern
int
QRinput_getBitStream
(
QRinput
*input,
BitStream
*bstream);
117
extern
int
QRinput_estimateBitStreamSize
(
QRinput
*input,
int
version
);
118
extern
int
QRinput_splitEntry
(
QRinput_List
*entry,
int
bytes);
119
extern
int
QRinput_estimateVersion
(
QRinput
*input);
120
extern
int
QRinput_lengthOfCode
(
QRencodeMode
mode,
int
version
,
int
bits);
121
extern
int
QRinput_insertStructuredAppendHeader
(
QRinput
*input,
int
size
,
int
index,
unsigned
char
parity);
122
#endif
123
124
#endif
/* QRINPUT_H */
bitstream.h
size
static int size
Definition:
qrenc.c:41
version
static int version
Definition:
qrenc.c:40
qrencode.h
QRecLevel
QRecLevel
Level of error correction.
Definition:
qrencode.h:124
QRencodeMode
QRencodeMode
Encoding mode.
Definition:
qrencode.h:109
QRinput_getBitStream
STATIC_IN_RELEASE int QRinput_getBitStream(QRinput *input, BitStream *bstream)
Merge all bit streams in the input data and append padding bits.
Definition:
qrinput.c:1303
QRinput_insertStructuredAppendHeader
STATIC_IN_RELEASE int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int number, unsigned char parity)
Insert a structured-append header to the head of the input data.
Definition:
qrinput.c:248
QRinput_lengthOfCode
STATIC_IN_RELEASE int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits)
Return required length in bytes for specified mode, version and bits.
Definition:
qrinput.c:961
QRinput_estimateBitStreamSize
STATIC_IN_RELEASE int QRinput_estimateBitStreamSize(QRinput *input, int version)
Estimate the length of the encoded bit stream of the data.
Definition:
qrinput.c:917
QRinput_splitEntry
STATIC_IN_RELEASE int QRinput_splitEntry(QRinput_List *entry, int bytes)
Definition:
qrinput.c:1463
QRinput_mergeBitStream
STATIC_IN_RELEASE int QRinput_mergeBitStream(QRinput *input, BitStream *bstream)
Merge all bit streams in the input data.
Definition:
qrinput.c:1277
QRinput_estimateVersion
STATIC_IN_RELEASE int QRinput_estimateVersion(QRinput *input)
Estimate the required version number of the symbol.
Definition:
qrinput.c:936
QRinput_estimateBitsModeNum
int QRinput_estimateBitsModeNum(int size)
Estimate the length of the encoded bit stream of numeric data.
Definition:
qrinput.c:381
QRinput_estimateBitsModeKanji
int QRinput_estimateBitsModeKanji(int size)
Kanji data.
Definition:
qrinput.c:616
QRinput_anTable
const signed char QRinput_anTable[128]
Alphabet-numeric data.
Definition:
qrinput.c:459
QRinput_isSplittableMode
int QRinput_isSplittableMode(QRencodeMode mode)
Utilities.
Definition:
qrinput.c:39
QRinput_getByteStream
unsigned char * QRinput_getByteStream(QRinput *input)
Pack all bit streams padding bits into a byte array.
Definition:
qrinput.c:1326
QRinput_estimateBitsMode8
int QRinput_estimateBitsMode8(int size)
8 bit data
Definition:
qrinput.c:566
QRinput_estimateBitsModeAn
int QRinput_estimateBitsModeAn(int size)
Estimate the length of the encoded bit stream of alphabet-numeric data.
Definition:
qrinput.c:493
QRinput_dup
QRinput * QRinput_dup(QRinput *input)
Definition:
qrinput.c:328
BitStream
Definition:
bitstream.h:25
_QRinput_InputList
Definition:
qrinput.h:61
_QRinput_InputList::next
QRinput_InputList * next
Definition:
qrinput.h:63
_QRinput_InputList::input
QRinput * input
Definition:
qrinput.h:62
_QRinput_List
Definition:
qrinput.h:35
_QRinput_List::size
int size
Size of data chunk (byte).
Definition:
qrinput.h:37
_QRinput_List::next
QRinput_List * next
Definition:
qrinput.h:40
_QRinput_List::mode
QRencodeMode mode
Definition:
qrinput.h:36
_QRinput_List::data
unsigned char * data
Data chunk.
Definition:
qrinput.h:38
_QRinput_List::bstream
BitStream * bstream
Definition:
qrinput.h:39
_QRinput_Struct
Definition:
qrinput.h:66
_QRinput_Struct::head
QRinput_InputList * head
Definition:
qrinput.h:69
_QRinput_Struct::tail
QRinput_InputList * tail
Definition:
qrinput.h:70
_QRinput_Struct::parity
int parity
Definition:
qrinput.h:68
_QRinput_Struct::size
int size
number of structured symbols
Definition:
qrinput.h:67
_QRinput
Input Data.
Definition:
qrinput.h:46
_QRinput::fnc1
int fnc1
Definition:
qrinput.h:52
_QRinput::mqr
int mqr
Definition:
qrinput.h:51
_QRinput::head
QRinput_List * head
Definition:
qrinput.h:49
_QRinput::version
int version
Definition:
qrinput.h:47
_QRinput::level
QRecLevel level
Definition:
qrinput.h:48
_QRinput::tail
QRinput_List * tail
Definition:
qrinput.h:50
_QRinput::appid
unsigned char appid
Definition:
qrinput.h:53
qrinput.h
Generated by
1.9.3