Back to index

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

#include <nsClassicDetectors.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsClassicDetector (const char *language)
virtual ~nsClassicDetector ()
NS_IMETHOD Init (nsICharsetDetectionObserver *aObserver)
NS_IMETHOD DoIt (const char *aBuf, PRUint32 aLen, PRBool *oDontFeedMe)
NS_IMETHOD Done ()

Private Attributes

nsCOMPtr
< nsICharsetDetectionObserver
mObserver
char mCharset [65]
char mLanguage [32]

Detailed Description

Definition at line 60 of file nsClassicDetectors.h.


Constructor & Destructor Documentation

Definition at line 218 of file nsClassicDetectors.cpp.

Definition at line 224 of file nsClassicDetectors.cpp.

{
}

Member Function Documentation

NS_IMETHODIMP nsClassicDetector::DoIt ( const char *  aBuf,
PRUint32  aLen,
PRBool oDontFeedMe 
) [virtual]

Implements nsICharsetDetector.

Definition at line 240 of file nsClassicDetectors.cpp.

{
  NS_ASSERTION(mObserver != nsnull , "have not init yet");

  if((nsnull == aBuf) || (nsnull == oDontFeedMe))
     return NS_ERROR_ILLEGAL_VALUE;

  if (!PL_strcasecmp("ja", mLanguage) &&
      NS_SUCCEEDED(JA_AutoCharsetDetectBuffer(aBuf, (PRInt32) aLen, mCharset))) {
    mObserver->Notify(mCharset, eBestAnswer);
  }
  else {
    mObserver->Notify("", eNoAnswerMatch);
  }

  *oDontFeedMe = PR_TRUE;

  return NS_OK;
}

Here is the call graph for this function:

Implements nsICharsetDetector.

Definition at line 261 of file nsClassicDetectors.cpp.

{
  NS_ASSERTION(mObserver != nsnull , "have not init yet");
  return NS_OK;
}

Implements nsICharsetDetector.

Definition at line 228 of file nsClassicDetectors.cpp.

{
  NS_ASSERTION(mObserver == nsnull , "Init twice");
  if(nsnull == aObserver)
     return NS_ERROR_ILLEGAL_VALUE;

  mObserver = aObserver;

  return NS_OK;
}

Member Data Documentation

char nsClassicDetector::mCharset[65] [private]

Definition at line 74 of file nsClassicDetectors.h.

char nsClassicDetector::mLanguage[32] [private]

Definition at line 75 of file nsClassicDetectors.h.

Definition at line 73 of file nsClassicDetectors.h.


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