Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsRUStringProbDetector Class Reference

#include <nsCyrillicDetector.h>

Inheritance diagram for nsRUStringProbDetector:
Inheritance graph
Collaboration diagram for nsRUStringProbDetector:
Collaboration graph

List of all members.

Public Member Functions

 nsRUStringProbDetector ()
NS_IMETHOD DoIt (const char *aBuf, PRUint32 aLen, const char **oCharset, nsDetectionConfident &oConf)
virtual void HandleData (const char *aBuf, PRUint32 aLen)
virtual void DataEnd ()

Protected Member Functions

virtual void Report (const char *aCharset)

Protected Attributes

PRBool mDone

Detailed Description

Definition at line 164 of file nsCyrillicDetector.h.

Constructor & Destructor Documentation

Definition at line 167 of file nsCyrillicDetector.h.

Member Function Documentation

void nsCyrillicDetector::DataEnd ( void  ) [virtual, inherited]

Definition at line 79 of file nsCyrillicDetector.cpp.

   PRUint32 max=0;
   PRUint8  maxIdx=0;
   PRUint8 j;
   for(j=0;j<mItems;j++) {
      if(mProb[j] > max)
           max = mProb[j];
           maxIdx= j;

   if( 0 == max ) // if we didn't get any 8 bits data 

#ifdef DEBUG
      printf("Charset %s->\t%d\n", mCharsets[j], mProb[j]);
   mDone = PR_TRUE;

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsCyrXPCOMStringDetector::DoIt ( const char *  aBuf,
PRUint32  aLen,
const char **  oCharset,
nsDetectionConfident oConf 
) [virtual, inherited]

Implements nsIStringCharsetDetector.

Definition at line 180 of file nsCyrillicDetector.cpp.

   mResult = nsnull;
   mDone = PR_FALSE;
   this->HandleData(aBuf, aLen); 
   oConf = eBestAnswer;
   return NS_OK;

Here is the call graph for this function:

void nsCyrillicDetector::HandleData ( const char *  aBuf,
PRUint32  aLen 
) [virtual, inherited]

Definition at line 53 of file nsCyrillicDetector.cpp.

   PRUint8 cls;
   const char* b;
   PRUint32 i;
   for(i=0, b=aBuf;i<aLen;i++,b++)
     for(PRUintn j=0;j<mItems;j++)
        if( 0x80 & *b)
           cls = mCyrillicClass[j][(*b) & 0x7F];
           cls = 0;
        NS_ASSERTION( cls <= 32 , "illegal character class");
        mProb[j] += gCyrillicProb[mLastCls[j]][cls];
        mLastCls[j] = cls;
   // We now only based on the first block we receive

Here is the caller graph for this function:

void nsCyrXPCOMStringDetector::Report ( const char *  aCharset) [protected, virtual, inherited]

Implements nsCyrillicDetector.

Definition at line 174 of file nsCyrillicDetector.cpp.

   mResult = aCharset;

Member Data Documentation

PRBool nsCyrillicDetector::mDone [protected, inherited]

Definition at line 107 of file nsCyrillicDetector.h.

The documentation for this class was generated from the following file: