Documentation

Swift_CharacterReader_Utf8Reader
in package
implements Swift_CharacterReader

Analyzes UTF-8 characters.

Tags
author

Chris Corbyn

author

Xavier De Cock xdecock@gmail.com

Interfaces, Classes and Traits

Swift_CharacterReader
Analyzes characters for a specific character set.

Table of Contents

$length_map  : mixed
Pre-computed for optimization
$s_length_map  : mixed
getCharPositions()  : int
Returns the complete character map.
getInitialByteSize()  : int
Returns the number of bytes which should be read to start each character.
getMapType()  : int
Returns mapType.
validateByteSequence()  : int
Returns an integer which specifies how many more bytes to read.

Properties

$length_map

Pre-computed for optimization

private static mixed $length_map = [ // N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, ]

$s_length_map

private static mixed $s_length_map = ["" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, " " => 1, " " => 1, " " => 1, " " => 1, " " => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, "" => 1, " " => 1, "!" => 1, """ => 1, "#" => 1, "$" => 1, "%" => 1, "&" => 1, "'" => 1, "(" => 1, ")" => 1, "*" => 1, "+" => 1, "," => 1, "-" => 1, "." => 1, "/" => 1, "0" => 1, "1" => 1, "2" => 1, "3" => 1, "4" => 1, "5" => 1, "6" => 1, "7" => 1, "8" => 1, "9" => 1, ":" => 1, ";" => 1, "<" => 1, "=" => 1, ">" => 1, "?" => 1, "@" => 1, "A" => 1, "B" => 1, "C" => 1, "D" => 1, "E" => 1, "F" => 1, "G" => 1, "H" => 1, "I" => 1, "J" => 1, "K" => 1, "L" => 1, "M" => 1, "N" => 1, "O" => 1, "P" => 1, "Q" => 1, "R" => 1, "S" => 1, "T" => 1, "U" => 1, "V" => 1, "W" => 1, "X" => 1, "Y" => 1, "Z" => 1, "[" => 1, "\" => 1, "]" => 1, "^" => 1, "_" => 1, "`" => 1, "a" => 1, "b" => 1, "c" => 1, "d" => 1, "e" => 1, "f" => 1, "g" => 1, "h" => 1, "i" => 1, "j" => 1, "k" => 1, "l" => 1, "m" => 1, "n" => 1, "o" => 1, "p" => 1, "q" => 1, "r" => 1, "s" => 1, "t" => 1, "u" => 1, "v" => 1, "w" => 1, "x" => 1, "y" => 1, "z" => 1, "{" => 1, "|" => 1, "}" => 1, "~" => 1, "" => 1, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 0, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 2, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 3, "�" => 4, "�" => 4, "�" => 4, "�" => 4, "�" => 4, "�" => 4, "�" => 4, "�" => 4, "�" => 5, "�" => 5, "�" => 5, "�" => 5, "�" => 6, "�" => 6, "�" => 0, "�" => 0]

Methods

getCharPositions()

Returns the complete character map.

public getCharPositions(string $string, int $startOffset, array<string|int, mixed> &$currentMap, mixed &$ignoredChars) : int
Parameters
$string : string
$startOffset : int
$currentMap : array<string|int, mixed>
$ignoredChars : mixed
Return values
int

getInitialByteSize()

Returns the number of bytes which should be read to start each character.

public getInitialByteSize() : int
Return values
int

getMapType()

Returns mapType.

public getMapType() : int
Return values
int

mapType

validateByteSequence()

Returns an integer which specifies how many more bytes to read.

public validateByteSequence(string $bytes, int $size) : int

A positive integer indicates the number of more bytes to fetch before invoking this method again. A value of zero means this is already a valid character. A value of -1 means this cannot possibly be a valid character.

Parameters
$bytes : string
$size : int
Return values
int

Search results