1: <?php
2:
3: /*
4: * This file is part of SwiftMailer.
5: * (c) 2004-2009 Chris Corbyn
6: *
7: * For the full copyright and license information, please view the LICENSE
8: * file that was distributed with this source code.
9: */
10:
11: /**
12: * Analyzes characters for a specific character set.
13: * @package Swift
14: * @subpackage Encoder
15: * @author Chris Corbyn
16: * @author Xavier De Cock <xdecock@gmail.com>
17: */
18: interface Swift_CharacterReader
19: {
20: const MAP_TYPE_INVALID = 0x01;
21: const MAP_TYPE_FIXED_LEN = 0x02;
22: const MAP_TYPE_POSITIONS = 0x03;
23:
24: /**
25: * Returns the complete charactermap
26: *
27: * @param string $string
28: * @param int $startOffset
29: * @param array $currentMap
30: * @param mixed $ignoredChars
31: * @return int
32: */
33: public function getCharPositions($string, $startOffset, &$currentMap, &$ignoredChars);
34:
35: /**
36: * Returns mapType
37: * @return int mapType
38: */
39: public function getMapType();
40:
41: /**
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
44: * this method again.
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.
47: * @param int[] $bytes
48: * @return int
49: */
50: public function validateByteSequence($bytes, $size);
51:
52: /**
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.
56: * @return int
57: */
58: public function getInitialByteSize();
59: }
60: