4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
12 * Analyzes characters for a specific character set.
15 * @author Chris Corbyn
16 * @author Xavier De Cock <xdecock@gmail.com>
18 interface Swift_CharacterReader
20 const MAP_TYPE_INVALID
= 0x01;
21 const MAP_TYPE_FIXED_LEN
= 0x02;
22 const MAP_TYPE_POSITIONS
= 0x03;
25 * Returns the complete charactermap
27 * @param string $string
28 * @param int $startOffset
29 * @param array $currentMap
30 * @param mixed $ignoredChars
33 public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);
39 public function getMapType();
42 * Returns an integer which specifies how many more bytes to read.
43 * A positive integer indicates the number of more bytes to fetch before invoking
45 * A value of zero means this is already a valid character.
46 * A value of -1 means this cannot possibly be a valid character.
50 public function validateByteSequence($bytes, $size);
53 * Returns the number of bytes which should be read to start each character.
54 * For fixed width character sets this should be the number of
55 * octets-per-character. For multibyte character sets this will probably be 1.
58 public function getInitialByteSize();