namespace Gma.QrCodeNet.Encoding.DataEncodation;
public abstract class EncoderBase
{
internal EncoderBase()
{
}
protected virtual int GetDataLength(string content) => content.Length;
///
/// Returns the bit representation of input data.
///
internal abstract BitList GetDataBits(string content);
///
/// Returns bit representation of Modevalue.
///
/// See Chapter 8.4 Data encodation, Table 2 — Mode indicators
internal BitList GetModeIndicator()
{
BitList modeIndicatorBits = new()
{
{ 0001 << 2, 4 }
};
return modeIndicatorBits;
}
internal BitList GetCharCountIndicator(int characterCount, int version)
{
BitList characterCountBits = new();
int bitCount = GetBitCountInCharCountIndicator(version);
characterCountBits.Add(characterCount, bitCount);
return characterCountBits;
}
///
/// Defines the length of the Character Count Indicator,
/// which varies according to the mode and the symbol version in use
///
/// Number of bits in Character Count Indicator.
///
/// See Chapter 8.4 Data encodation, Table 3 — Number of bits in Character Count Indicator.
///
protected abstract int GetBitCountInCharCountIndicator(int version);
}