Back to index

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

#include <nsCyrillicDetector.h>

Inheritance diagram for nsCyrillicDetector:
Inheritance graph

List of all members.

Public Member Functions

 nsCyrillicDetector (PRUint8 aItems, const PRUint8 **aCyrillicClass, const char **aCharsets)
virtual ~nsCyrillicDetector ()
virtual void HandleData (const char *aBuf, PRUint32 aLen)
virtual void DataEnd ()

Protected Member Functions

virtual void Report (const char *aCharset)=0

Protected Attributes

PRBool mDone

Private Attributes

PRUint8 mItems
const PRUint8 ** mCyrillicClass
const char ** mCharsets

Detailed Description

Definition at line 89 of file nsCyrillicDetector.h.

Constructor & Destructor Documentation

nsCyrillicDetector::nsCyrillicDetector ( PRUint8  aItems,
const PRUint8 **  aCyrillicClass,
const char **  aCharsets 
) [inline]

Definition at line 92 of file nsCyrillicDetector.h.

      mItems = aItems;
      mCyrillicClass = aCyrillicClass;
      mCharsets = aCharsets;
      for(PRUintn i=0;i<mItems;i++)
        mProb[i] = mLastCls[i] =0;
      mDone = PR_FALSE;
virtual nsCyrillicDetector::~nsCyrillicDetector ( ) [inline, virtual]

Definition at line 102 of file nsCyrillicDetector.h.


Member Function Documentation

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:

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

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:

virtual void nsCyrillicDetector::Report ( const char *  aCharset) [protected, pure virtual]

Implemented in nsCyrXPCOMStringDetector, and nsCyrXPCOMDetector.

Here is the caller graph for this function:

Member Data Documentation

Definition at line 112 of file nsCyrillicDetector.h.

Definition at line 111 of file nsCyrillicDetector.h.

Definition at line 107 of file nsCyrillicDetector.h.

Definition at line 110 of file nsCyrillicDetector.h.

Definition at line 114 of file nsCyrillicDetector.h.

Definition at line 113 of file nsCyrillicDetector.h.

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