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
29
30/******************************************************************************
31 * Entry of input data
32 *****************************************************************************/
34
37 int size; ///< Size of data chunk (byte).
38 unsigned char *data; ///< Data chunk.
41};
42
43/******************************************************************************
44 * Input Data
45 *****************************************************************************/
46struct _QRinput {
51 int mqr;
52 int fnc1;
53 unsigned char appid;
54};
55
56/******************************************************************************
57 * Structured append input data
58 *****************************************************************************/
60
64};
65
67 int size; ///< number of structured symbols
68 int parity;
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 */
78extern unsigned char *QRinput_getByteStream(QRinput *input);
79
80
81extern int QRinput_estimateBitsModeNum(int size);
82extern int QRinput_estimateBitsModeAn(int size);
83extern int QRinput_estimateBitsMode8(int size);
85
86extern QRinput *QRinput_dup(QRinput *input);
87
88extern 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
115extern int QRinput_mergeBitStream(QRinput *input, BitStream *bstream);
116extern int QRinput_getBitStream(QRinput *input, BitStream *bstream);
117extern int QRinput_estimateBitStreamSize(QRinput *input, int version);
118extern int QRinput_splitEntry(QRinput_List *entry, int bytes);
119extern int QRinput_estimateVersion(QRinput *input);
120extern int QRinput_lengthOfCode(QRencodeMode mode, int version, int bits);
121extern int QRinput_insertStructuredAppendHeader(QRinput *input, int size, int index, unsigned char parity);
122#endif
123
124#endif /* QRINPUT_H */
static int size
Definition: qrenc.c:41
static int version
Definition: qrenc.c:40
QRecLevel
Level of error correction.
Definition: qrencode.h:124
QRencodeMode
Encoding mode.
Definition: qrencode.h:109
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
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
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
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
STATIC_IN_RELEASE int QRinput_splitEntry(QRinput_List *entry, int bytes)
Definition: qrinput.c:1463
STATIC_IN_RELEASE int QRinput_mergeBitStream(QRinput *input, BitStream *bstream)
Merge all bit streams in the input data.
Definition: qrinput.c:1277
STATIC_IN_RELEASE int QRinput_estimateVersion(QRinput *input)
Estimate the required version number of the symbol.
Definition: qrinput.c:936
int QRinput_estimateBitsModeNum(int size)
Estimate the length of the encoded bit stream of numeric data.
Definition: qrinput.c:381
int QRinput_estimateBitsModeKanji(int size)
Kanji data.
Definition: qrinput.c:616
const signed char QRinput_anTable[128]
Alphabet-numeric data.
Definition: qrinput.c:459
int QRinput_isSplittableMode(QRencodeMode mode)
Utilities.
Definition: qrinput.c:39
unsigned char * QRinput_getByteStream(QRinput *input)
Pack all bit streams padding bits into a byte array.
Definition: qrinput.c:1326
int QRinput_estimateBitsMode8(int size)
8 bit data
Definition: qrinput.c:566
int QRinput_estimateBitsModeAn(int size)
Estimate the length of the encoded bit stream of alphabet-numeric data.
Definition: qrinput.c:493
QRinput * QRinput_dup(QRinput *input)
Definition: qrinput.c:328
QRinput_InputList * next
Definition: qrinput.h:63
QRinput * input
Definition: qrinput.h:62
int size
Size of data chunk (byte).
Definition: qrinput.h:37
QRinput_List * next
Definition: qrinput.h:40
QRencodeMode mode
Definition: qrinput.h:36
unsigned char * data
Data chunk.
Definition: qrinput.h:38
BitStream * bstream
Definition: qrinput.h:39
QRinput_InputList * head
Definition: qrinput.h:69
QRinput_InputList * tail
Definition: qrinput.h:70
int size
number of structured symbols
Definition: qrinput.h:67
Input Data.
Definition: qrinput.h:46
int fnc1
Definition: qrinput.h:52
int mqr
Definition: qrinput.h:51
QRinput_List * head
Definition: qrinput.h:49
int version
Definition: qrinput.h:47
QRecLevel level
Definition: qrinput.h:48
QRinput_List * tail
Definition: qrinput.h:50
unsigned char appid
Definition: qrinput.h:53