8
9
10
11
12
13
14
15
16
17
18
19
20
21
23#include "fxbarcode/datamatrix/BC_EdifactEncoder.h"
27#include "fxbarcode/datamatrix/BC_Encoder.h"
28#include "fxbarcode/datamatrix/BC_EncoderContext.h"
29#include "fxbarcode/datamatrix/BC_HighLevelEncoder.h"
30#include "fxbarcode/datamatrix/BC_SymbolInfo.h"
35 size_t len = sb.GetLength();
40 wchar_t c2 = len >= 2 ? sb[1] : 0;
41 wchar_t c3 = len >= 3 ? sb[2] : 0;
42 wchar_t c4 = len >= 4 ? sb[3] : 0;
43 int32_t v = (c1 << 18) + (c2 << 12) + (c3 << 6) + c4;
44 constexpr size_t kBuflen = 3;
46 cw[0] =
static_cast<
wchar_t>((v >> 16) & 255);
47 cw[1] =
static_cast<
wchar_t>((v >> 8) & 255);
48 cw[2] =
static_cast<
wchar_t>(v & 255);
55 size_t count = buffer.GetLength();
66 context->m_symbolInfo->data_capacity() - context->getCodewordCount();
67 int32_t remaining = context->getRemainingCharacters();
68 if (remaining == 0 && available <= 2)
72 int32_t restChars = count - 1;
73 WideString encoded = EncodeToEdifactCodewords(buffer);
74 if (encoded.IsEmpty())
78 bool restInAscii = endOfSymbolReached && restChars <= 2;
84 context->m_symbolInfo->data_capacity() - context->getCodewordCount();
88 encoded.GetLength()
)) {
96 context->m_pos -= restChars;
104bool AppendEncodedChar(
wchar_t c,
WideString* sb) {
105 if (c >=
' ' && c <=
'?') {
110 if (c >=
'@' && c <=
'^') {
132 if (!AppendEncodedChar(c, &buffer))
136 size_t count = buffer.GetLength();
138 WideString encoded = EncodeToEdifactCodewords(buffer);
139 if (encoded.IsEmpty())
145 CBC_HighLevelEncoder::LookAheadTest(context->m_msg, context->m_pos,
153 buffer
+= static_cast<
wchar_t>(31);
154 return HandleEOD(context, buffer);
~CBC_EdifactEncoder() override
CBC_HighLevelEncoder::Encoding GetEncodingMode() override
bool Encode(CBC_EncoderContext *context) override
void writeCodewords(const WideString &codewords)
void SignalEncoderChange(CBC_HighLevelEncoder::Encoding encoding)
WideString & operator+=(wchar_t ch)
fxcrt::WideStringView WideStringView
fxcrt::WideString WideString