### Home Classes Methods

### In Files

- lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb

### Parent

Object

### Methods

- ::new
- #get_coding_state_machine
- #get_current_charlen
- #next_state
- #reset

### Files

- CHANGES
- LICENSE
- NOTES
- README
- Rakefile
- MANIFEST
- Makefile
- depend
- Makefile
- COPYING
- README

### Class/Module Index

Quicksearch

- TMail
- TMail::Address
- TMail::AddressGroup
- TMail::AddressHeader
- TMail::Attachment
- TMail::ContentDispositionHeader
- TMail::ContentTransferEncodingHeader
- TMail::ContentTypeHeader
- TMail::DateTimeHeader
- TMail::EncryptedHeader
- TMail::FilePort
- TMail::HeaderField
- TMail::KeywordsHeader
- TMail::Mail
- TMail::MailFlags
- TMail::Maildir
- TMail::MaildirLoader
- TMail::MaildirPort
- TMail::MboxLoader
- TMail::MessageIdHeader
- TMail::MhLoader
- TMail::MhMailbox
- TMail::MhPort
- TMail::MimeVersionHeader
- TMail::Parser
- TMail::Port
- TMail::ReceivedHeader
- TMail::ReferencesHeader
- TMail::ReturnPathHeader
- TMail::SingleAddressHeader
- TMail::StringPort
- TMail::StructuredHeader
- TMail::SyntaxError
- TMail::TMailScanner
- TMail::TextUtils
- TMail::UNIXMbox
- TMail::UnstructuredHeader
- CharDet
- CharDet::Big5DistributionAnalysis
- CharDet::Big5Prober
- CharDet::CharDistributionAnalysis
- CharDet::CharSetGroupProber
- CharDet::CharSetProber
- CharDet::CodingStateMachine
- CharDet::EUCJPContextAnalysis
- CharDet::EUCJPDistributionAnalysis
- CharDet::EUCJPProber
- CharDet::EUCKRDistributionAnalysis
- CharDet::EUCKRProber
- CharDet::EUCTWDistributionAnalysis
- CharDet::EUCTWProber
- CharDet::EscCharSetProber
- CharDet::GB2312DistributionAnalysis
- CharDet::GB2312Prober
- CharDet::HebrewProber
- CharDet::JapaneseContextAnalysis
- CharDet::Latin1Prober
- CharDet::MBCSGroupProber
- CharDet::MultiByteCharSetProber
- CharDet::SBCSGroupProber
- CharDet::SJISContextAnalysis
- CharDet::SJISDistributionAnalysis
- CharDet::SJISProber
- CharDet::SingleByteCharSetProber
- CharDet::UTF8Prober
- CharDet::UniversalDetector

No matching classes.

# CharDet::CodingStateMachine

### Public Class Methods

new(sm) click to toggle source

    # File lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb, line 31
    def initialize(sm)
      @_mModel = sm
      @_mCurrentBytePos = 0
      @_mCurrentCharLen = 0
      reset()
    end

### Public Instance Methods

get_coding_state_machine() click to toggle source

    # File lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb, line 60
    def get_coding_state_machine
      return @_mModel['name']
    end

get_current_charlen() click to toggle source

    # File lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb, line 56
    def get_current_charlen
      return @_mCurrentCharLen
    end

next_state(c) click to toggle source

    # File lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb, line 42
    def next_state(c)
      # for each byte we get its class
      # if it is first byte, we also get byte length
      byteCls = @_mModel['classTable'][c[0]]
      if @_mCurrentState == EStart
        @_mCurrentBytePos = 0
        @_mCurrentCharLen = @_mModel['charLenTable'][byteCls]
      end
      # from byte's class and stateTable, we get its next state
      @_mCurrentState = @_mModel['stateTable'][@_mCurrentState * @_mModel['classFactor'] + byteCls]
      @_mCurrentBytePos += 1
      return @_mCurrentState
    end

reset() click to toggle source

    # File lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb, line 38
    def reset
      @_mCurrentState = EStart
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.