Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
nsNativeStringDetector Class Reference
Inheritance diagram for nsNativeStringDetector:
Inheritance graph
Collaboration diagram for nsNativeStringDetector:
Collaboration graph

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsNativeStringDetector (PRUint32 aCodePage)
virtual ~nsNativeStringDetector ()
NS_IMETHOD DoIt (const char *aBuf, PRUint32 aLen, const char **oCharset, nsDetectionConfident &oConfident)

Protected Attributes

PRUint32 mCodePage
IMultiLanguage * mMultiLanguage
char mCharset [65]

Detailed Description

Definition at line 198 of file nsNativeDetectors.cpp.

Constructor & Destructor Documentation

Definition at line 218 of file nsNativeDetectors.cpp.

Definition at line 225 of file nsNativeDetectors.cpp.

  if (NULL != mMultiLanguage)

Member Function Documentation

NS_IMETHODIMP nsNativeStringDetector::DoIt ( const char *  aBuf,
PRUint32  aLen,
const char **  oCharset,
nsDetectionConfident oConfident 
) [virtual]

Implements nsIStringCharsetDetector.

Definition at line 233 of file nsNativeDetectors.cpp.

       HRESULT hr = S_OK;

  oConfident = eNoAnswerMatch;
  *oCharset = "";

  if (NULL == mMultiLanguage) {
    hr = CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, 
                          IID_IMultiLanguage, (LPVOID *)&mMultiLanguage);

  if (SUCCEEDED(hr)) {
    IMLangConvertCharset *aMLangConvertCharset;
    DWORD dwProperty = 0;
    hr = mMultiLanguage->CreateConvertCharset(mCodePage, 1200, dwProperty, &aMLangConvertCharset);
    if (SUCCEEDED(hr)) {
      UINT theSize = (UINT) aLen;
      nsDetectionConfident aConfidence;

      hr = DetectCharsetUsingMLang(mMultiLanguage, aMLangConvertCharset, 
                                   mCharset, aConfidence, (BYTE *) aBuf, &theSize);
      if (SUCCEEDED(hr)) {
        *oCharset = mCharset;
        oConfident = aConfidence;



Here is the call graph for this function:

Member Data Documentation

char nsNativeStringDetector::mCharset[65] [protected]

Definition at line 212 of file nsNativeDetectors.cpp.

Definition at line 210 of file nsNativeDetectors.cpp.

IMultiLanguage* nsNativeStringDetector::mMultiLanguage [protected]

Definition at line 211 of file nsNativeDetectors.cpp.

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