blob: a7e25fdb579cd4e6a6fcea03b359165b1a81ef32 [file] [log] [blame]
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
#define FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_
#include <vector>
#include "core/fxcrt/widestring.h"
#define ASCII_ENCODATION 0
#define C40_ENCODATION 1
#define TEXT_ENCODATION 2
#define X12_ENCODATION 3
#define EDIFACT_ENCODATION 4
#define BASE256_ENCODATION 5
class CBC_HighLevelEncoder {
public:
CBC_HighLevelEncoder() = delete;
~CBC_HighLevelEncoder() = delete;
// Returns an empty string on failure.
static WideString EncodeHighLevel(const WideString& msg,
bool bAllowRectangular);
static int32_t lookAheadTest(const WideString& msg,
int32_t startpos,
int32_t currentMode);
static bool isExtendedASCII(wchar_t ch);
static int32_t determineConsecutiveDigitCount(WideString msg,
int32_t startpos);
static const wchar_t LATCH_TO_C40 = 230;
static const wchar_t LATCH_TO_BASE256 = 231;
static const wchar_t UPPER_SHIFT = 235;
static const wchar_t LATCH_TO_ANSIX12 = 238;
static const wchar_t LATCH_TO_TEXT = 239;
static const wchar_t LATCH_TO_EDIFACT = 240;
static const wchar_t C40_UNLATCH = 254;
static const wchar_t X12_UNLATCH = 254;
};
#endif // FXBARCODE_DATAMATRIX_BC_HIGHLEVELENCODER_H_