nsBig5Prober Class Reference

#include <nsBig5Prober.h>

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

Public Member Functions

 nsBig5Prober (void)
virtual ~nsBig5Prober (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
Big5DistributionAnalysis mDistributionAnalyser
char mLastChar [2]

Detailed Description

Definition at line 45 of file nsBig5Prober.h.


Constructor & Destructor Documentation

nsBig5Prober::nsBig5Prober ( void   )  [inline]

Definition at line 46 of file nsBig5Prober.h.

References Big5SMModel, and mCodingSM.

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

Definition at line 48 of file nsBig5Prober.h.

00049 {delete mCodingSM;};


Member Function Documentation

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

Implements nsCharSetProber.

Definition at line 50 of file nsBig5Prober.h.

00051 {return "Big5";};

float nsBig5Prober::GetConfidence ( void   )  [virtual]

Implements nsCharSetProber.

Definition at line 87 of file nsBig5Prober.cpp.

References CharDistributionAnalysis::GetConfidence(), and mDistributionAnalyser.

Referenced by HandleData().

00088 {
00089   float distribCf = mDistributionAnalyser.GetConfidence();
00090 
00091   return (float)distribCf;
00092 }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Implements nsCharSetProber.

Definition at line 51 of file nsBig5Prober.h.

00051 {return "Big5";};

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

Implements nsCharSetProber.

Definition at line 47 of file nsBig5Prober.cpp.

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

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

Here is the call graph for this function:

void nsBig5Prober::Reset ( void   )  [virtual]

Implements nsCharSetProber.

Definition at line 40 of file nsBig5Prober.cpp.

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

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

Here is the call graph for this function:

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

Implements nsCharSetProber.

Definition at line 54 of file nsBig5Prober.h.

00055 {};


Field Documentation

Definition at line 59 of file nsBig5Prober.h.

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

Definition at line 63 of file nsBig5Prober.h.

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

char nsBig5Prober::mLastChar[2] [protected]

Definition at line 64 of file nsBig5Prober.h.

Referenced by HandleData().

Definition at line 60 of file nsBig5Prober.h.

Referenced by HandleData(), and Reset().


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