Poco::FastInfoset

class RestrictedAlphabet

Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/RestrictedAlphabet.h

Description

A RestrictedAlphabet consists of a sequence of single characters, the position of each character is equal to the integer value used to encode it. Example:

RestrictedAlphabet alph("0123456789");
poco_assert (alph.index('1') == 1);
poco_assert (alph.value(1) == '1');

Member Summary

Member Functions: canEncode, data, getBitSize, index, value

Constructors

RestrictedAlphabet

RestrictedAlphabet();

Creates an illegal RestrictedAlphabet. Used for reserved alphabets 3-15.

RestrictedAlphabet

RestrictedAlphabet(
    const std::string & data
);

Creates the RestrictedAlphabet using the given data.

Destructor

~RestrictedAlphabet

~RestrictedAlphabet();

Destroys the RestrictedAlphabet.

Member Functions

canEncode

bool canEncode(
    const std::string & data
);

Tests if we can encode a certain string with the given alphabet.

data inline

const std::string & data() const;

Returns the alphabet's data.

getBitSize inline

int getBitSize() const;

Returns the number of bits required to encode a single character

index inline

Poco::UInt32 index(
    const char & value
) const;

Converts a value to its index, returns string::npos if not found.

value inline

const char & value(
    Poco::UInt32 idx
) const;

Converts a integer vaue to the character it presents.