XOOPS RMCommon Utilities
2.1.8.91RC
Main Page
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
GenericFixedWidthReader.php
Go to the documentation of this file.
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
//@require 'Swift/CharacterReader.php';
12
20
class
Swift_CharacterReader_GenericFixedWidthReader
21
implements
Swift_CharacterReader
22
{
23
29
private
$_width
;
30
35
public
function
__construct
($width)
36
{
37
$this->_width = $width;
38
}
39
49
public
function
getCharPositions
($string, $startOffset, &$currentMap, &$ignoredChars)
50
{
51
$strlen = strlen($string);
52
// % and / are CPU intensive, so, maybe find a better way
53
$ignored = $strlen%
$this->_width
;
54
$ignoredChars = substr($string, - $ignored);
55
$currentMap =
$this->_width
;
56
return
($strlen - $ignored)/
$this->_width
;
57
58
}
59
64
public
function
getMapType
()
65
{
66
return
self::MAP_TYPE_FIXED_LEN;
67
}
68
78
public
function
validateByteSequence
($bytes, $size)
79
{
80
$needed = $this->_width - $size;
81
return
($needed > -1)
82
? $needed
83
: -1
84
;
85
}
86
91
public
function
getInitialByteSize
()
92
{
93
return
$this->_width
;
94
}
95
96
}
L:
XOOPS_Allure
SVN_XOOPS2
RMC
rmcommon
trunk
rmcommon
class
swift
classes
Swift
CharacterReader
GenericFixedWidthReader.php
Generated on Sun Mar 17 2013 20:41:05 for XOOPS RMCommon Utilities by
1.8.3.1