JS8Call-Improved master
Loading...
Searching...
No Matches
JSC Class Reference

Static compressor/lookup helper for JS8Call. More...

#include <JSC.h>

Collaboration diagram for JSC:

Static Public Member Functions

static Codeword codeword (quint32 index, bool separate, quint32 bytesize, quint32 s, quint32 c)
 Build a codeword for the given parameters.
static QList< CodewordPaircompress (QString text)
 Compress text into a sequence of codewords.
static QString decompress (Codeword const &bits)
 Decompress a codeword bit-vector into a QString.
static bool exists (QString w, quint32 *pIndex)
 Test whether a word exists in the dictionary.
static quint32 lookup (QString w, bool *ok)
 Lookup a word and return its dictionary index.
static quint32 lookup (char const *b, bool *ok)
 Lookup a C-string and return its dictionary index.

Static Public Attributes

static const quint32 size = 262144
static const Tuple map [262144]
static const Tuple list [262144]
static const quint32 prefixSize = 103
static const Tuple prefix [103]

Detailed Description

Static compressor/lookup helper for JS8Call.

This class provides compression and decompression helpers and static lookup tables. Most methods are static and operate on QStrings or plain C strings to locate indexes in the compressed dictionary.

Member Function Documentation

◆ codeword()

Codeword JSC::codeword ( quint32 index,
bool separate,
quint32 bytesize,
quint32 s,
quint32 c )
static

Build a codeword for the given parameters.

Generates a codeword for the given index and parameters.

Parameters
indexIndex into the dictionary.
separateWhether the codeword is separated by a delimiter.
bytesizeByte-size of the codeword container.
sAdditional parameter used by the encoding.
cAdditional parameter used by the encoding.
Returns
A Codeword bit vector representing the encoded entry.
Parameters
index
separate
bytesize
s
c
Returns
Codeword
Here is the caller graph for this function:

◆ compress()

QList< CodewordPair > JSC::compress ( QString text)
static

Compress text into a sequence of codewords.

Compresses the given text into a list of codeword pairs.

Parameters
textInput text to compress.
Returns
A list of CodewordPair entries representing the compressed data.
Parameters
text
Returns
QList<CodewordPair>
Here is the call graph for this function:

◆ decompress()

QString JSC::decompress ( Codeword const & bitvec)
static

Decompress a codeword bit-vector into a QString.

Decompresses the given bit vector into a string.

Parameters
bitsBit vector representing compressed data.
Returns
The decompressed string.
Parameters
bitvec
Returns
QString

◆ exists()

bool JSC::exists ( QString w,
quint32 * pIndex )
static

Test whether a word exists in the dictionary.

Checks if the given word exists in the compression map.

Parameters
wWord to test.
pIndexOptional out-parameter receiving the dictionary index.
Returns
true if the word exists.
Parameters
w
pIndex
Returns
true
false
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lookup() [1/2]

quint32 JSC::lookup ( char const * b,
bool * ok )
static

Lookup a C-string and return its dictionary index.

Looks up the index of the given C-style string in the compression map.

Parameters
bNull-terminated C string to lookup.
okOptional out-parameter set to true on success.
Returns
The dictionary index for the string.
Parameters
b
ok
Returns
quint32

◆ lookup() [2/2]

quint32 JSC::lookup ( QString w,
bool * ok )
static

Lookup a word and return its dictionary index.

Looks up the index of the given word in the compression map.

Parameters
wWord to lookup.
okOptional out-parameter set to true on success.
Returns
The dictionary index for the word.
Parameters
w
ok
Returns
quint32
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ list

const Tuple JSC::list
static

Secondary mapping table.

◆ map

const Tuple JSC::map
static

Primary mapping table.

◆ prefix

const Tuple JSC::prefix
static

Prefix lookup table.

◆ prefixSize

const quint32 JSC::prefixSize = 103
static

Number of prefix entries.

◆ size

const quint32 JSC::size = 262144
static

Size of static lookup arrays.


The documentation for this class was generated from the following files: