Peach :: Generators :: unicode :: OverLongUtf8 :: Class OverLongUtf8
[hide private]

Class OverLongUtf8

source code


This generator creates overlong UTF-8 encodings. First output is correct notation, then on each generation we perform a longer encoding of each character until we can do no more.

NOTE: Only supports ascii chars under 127 right now :/

Instance Methods [hide private]
 
__init__(self, group, data)
Base constructor, please call me!
source code
 
next(self)
Next value.
source code
string
getRawValue(self)
Return raw value w/o passing through transformer if set.
source code
 
reset(self)
Called to reset the generator to its initial state.
source code

Inherited from generator.Generator: __iter__, getGroup, getName, getTransformer, getValue, identity, setGroup, setName, setTransformer

Static Methods [hide private]
 
unittest() source code
Class Variables [hide private]
  _data = None
  _size = 1
  _maxSize = 6
  _emptyByte = 0x80
  _start2 = 0xC0
  _start3 = 0xE0
  _start4 = 0xF0
  _start5 = 0xF8
  _start6 = 0xFC
  _firstMask = 0xC0
  _lastMask = 0x80
Method Details [hide private]

__init__(self, group, data)
(Constructor)

source code 

Base constructor, please call me!

Parameters:
  • group (Group) - Group to use
  • data (Generator) - Data to perform UTF-8 encoding on
Overrides: generator.Generator.__init__

next(self)

source code 

Next value. OVERRIDE

From Python docs on next():

The intention of the protocol is that once an iterator's next() method raises StopIteration, it will continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken. (This constraint was added in Python 2.3; in Python 2.2, various iterators are broken according to this rule.)

For Generators, please use the GeneratorCompleted exception instead of StopIteration (its a subclass).

Overrides: generator.Generator.next
(inherited documentation)

getRawValue(self)

source code 

Return raw value w/o passing through transformer if set. OVERRIDE

Returns: string
Data before transformations
Overrides: generator.Generator.getRawValue
(inherited documentation)

reset(self)

source code 

Called to reset the generator to its initial state. OVERRIDE

Overrides: generator.Generator.reset
(inherited documentation)