nsEUCTWProber Class Reference

#include <nsEUCTWProber.h>

Inheritance diagram for nsEUCTWProber:
Inheritance graph
[legend]
Collaboration diagram for nsEUCTWProber:
Collaboration graph
[legend]

Public Member Functions

 nsEUCTWProber (void)
virtual ~nsEUCTWProber (void)
nsProbingState HandleData (const char *aBuf, PRUint32 aLen)
const char * GetCharSetName ()
nsProbingState GetState (void)
void Reset (void)
float GetConfidence (void)
void SetOpion ()

Protected Member Functions

void GetDistribution (PRUint32 aCharLen, const char *aStr)

Protected Attributes

nsCodingStateMachinemCodingSM
nsProbingState mState
EUCTWDistributionAnalysis mDistributionAnalyser
char mLastChar [2]

Detailed Description

Definition at line 45 of file nsEUCTWProber.h.


Constructor & Destructor Documentation

nsEUCTWProber::nsEUCTWProber ( void   )  [inline]

Definition at line 47 of file nsEUCTWProber.h.

References EUCTWSMModel, mCodingSM, and Reset().

00047                      {mCodingSM = new nsCodingStateMachine(&EUCTWSMModel);
00048                       Reset();};

Here is the call graph for this function:

virtual nsEUCTWProber::~nsEUCTWProber ( void   )  [inline, virtual]

Definition at line 49 of file nsEUCTWProber.h.

References mCodingSM.

00049 {delete mCodingSM;};


Member Function Documentation

const char* nsEUCTWProber::GetCharSetName (  )  [inline, virtual]

Implements nsCharSetProber.

Definition at line 51 of file nsEUCTWProber.h.

00051 {return "x-euc-tw";};

float nsEUCTWProber::GetConfidence ( void   )  [virtual]

Implements nsCharSetProber.

Definition at line 90 of file nsEUCTWProber.cpp.

References CharDistributionAnalysis::GetConfidence(), and mDistributionAnalyser.

Referenced by HandleData().

00091 {
00092   float distribCf = mDistributionAnalyser.GetConfidence();
00093 
00094   return (float)distribCf;
00095 }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsEUCTWProber::GetDistribution ( PRUint32  aCharLen,
const char *  aStr 
) [protected]
nsProbingState nsEUCTWProber::GetState ( void   )  [inline, virtual]

Implements nsCharSetProber.

Definition at line 52 of file nsEUCTWProber.h.

References mState.

00052 {return mState;};

nsProbingState nsEUCTWProber::HandleData ( const char *  aBuf,
PRUint32  aLen 
) [virtual]

Implements nsCharSetProber.

Definition at line 48 of file nsEUCTWProber.cpp.

References eDetecting, eError, eFoundIt, eItsMe, eNotMe, eStart, GetConfidence(), nsCodingStateMachine::GetCurrentCharLen(), CharDistributionAnalysis::GotEnoughData(), CharDistributionAnalysis::HandleOneChar(), mCodingSM, mDistributionAnalyser, mLastChar, mState, nsCodingStateMachine::NextState(), and SHORTCUT_THRESHOLD.

00049 {
00050   nsSMState codingState;
00051 
00052   for (PRUint32 i = 0; i < aLen; i++)
00053   {
00054     codingState = mCodingSM->NextState(aBuf[i]);
00055     if (codingState == eError)
00056     {
00057       mState = eNotMe;
00058       break;
00059     }
00060     if (codingState == eItsMe)
00061     {
00062       mState = eFoundIt;
00063       break;
00064     }
00065     if (codingState == eStart)
00066     {
00067       PRUint32 charLen = mCodingSM->GetCurrentCharLen();
00068 
00069       if (i == 0)
00070       {
00071         mLastChar[1] = aBuf[0];
00072         mDistributionAnalyser.HandleOneChar(mLastChar, charLen);
00073       }
00074       else
00075         mDistributionAnalyser.HandleOneChar(aBuf+i-1, charLen);
00076     }
00077   }
00078 
00079   mLastChar[0] = aBuf[aLen-1];
00080 
00081   if (mState == eDetecting)
00082     if (mDistributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD)
00083       mState = eFoundIt;
00084 //    else
00085 //      mDistributionAnalyser.HandleData(aBuf, aLen);
00086 
00087   return mState;
00088 }

Here is the call graph for this function:

void nsEUCTWProber::Reset ( void   )  [virtual]

Implements nsCharSetProber.

Definition at line 40 of file nsEUCTWProber.cpp.

References eDetecting, mCodingSM, mDistributionAnalyser, mState, CharDistributionAnalysis::Reset(), and nsCodingStateMachine::Reset().

Referenced by nsEUCTWProber().

00041 {
00042   mCodingSM->Reset(); 
00043   mState = eDetecting;
00044   mDistributionAnalyser.Reset();
00045   //mContextAnalyser.Reset();
00046 }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsEUCTWProber::SetOpion (  )  [inline, virtual]

Implements nsCharSetProber.

Definition at line 55 of file nsEUCTWProber.h.

00055 {};


Field Documentation

Definition at line 60 of file nsEUCTWProber.h.

Referenced by HandleData(), nsEUCTWProber(), Reset(), and ~nsEUCTWProber().

Definition at line 64 of file nsEUCTWProber.h.

Referenced by GetConfidence(), HandleData(), and Reset().

char nsEUCTWProber::mLastChar[2] [protected]

Definition at line 65 of file nsEUCTWProber.h.

Referenced by HandleData().

Definition at line 61 of file nsEUCTWProber.h.

Referenced by GetState(), HandleData(), and Reset().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208