Back to index

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

#include <nsDetectionAdaptor.h>

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

List of all members.

Public Member Functions

 nsDetectionAdaptor (void)
virtual ~nsDetectionAdaptor (void)
NS_IMETHOD Init (nsIWebShellServices *aWebShellSvc, nsICharsetDetector *aDetector, nsIDocument *aDocument, nsIParser *aParser, const char *aCharset, const char *aCommand=nsnull)
NS_IMETHOD RawBuffer (const char *buffer, PRUint32 *buffer_length)
NS_IMETHOD Finish ()
NS_IMETHOD WillAddToken (CToken &token)
NS_IMETHOD ProcessTokens (void)

Private Attributes

nsCOMPtr< nsICharsetDetectormDetector
PRBool mDontFeedToDetector
nsCOMPtr< nsMyObservermObserver

Detailed Description

Definition at line 98 of file nsDetectionAdaptor.h.


Constructor & Destructor Documentation

Definition at line 112 of file nsDetectionAdaptor.cpp.

Definition at line 117 of file nsDetectionAdaptor.cpp.

{
}

Member Function Documentation

Implements nsIParserFilter.

Definition at line 163 of file nsDetectionAdaptor.cpp.

{
    if((mDontFeedToDetector) || (!mDetector))
       return NS_OK;
    nsresult rv = NS_OK;
    rv = mDetector->Done();

    return NS_OK;
}
NS_IMETHODIMP nsDetectionAdaptor::Init ( nsIWebShellServices aWebShellSvc,
nsICharsetDetector aDetector,
nsIDocument aDocument,
nsIParser aParser,
const char *  aCharset,
const char *  aCommand = nsnull 
) [virtual]

Implements nsICharsetDetectionAdaptor.

Definition at line 125 of file nsDetectionAdaptor.cpp.

{
  if((nsnull != aWebShellSvc) && (nsnull != aDetector) && (nsnull != aCharset))
  {
    nsresult rv = NS_OK;
    mObserver = new nsMyObserver();
    if(!mObserver)
       return NS_ERROR_OUT_OF_MEMORY;

    rv = mObserver->Init(aWebShellSvc, aDocument, aParser, aCharset, aCommand);
    if(NS_SUCCEEDED(rv)) {
      rv = aDetector->Init(mObserver.get());
      if(NS_SUCCEEDED(rv)) {
        mDetector = aDetector;
        mDontFeedToDetector = PR_FALSE;
        return NS_OK;
      }
    }
  }
  return NS_ERROR_ILLEGAL_VALUE;
}

Implements nsIParserFilter.

Definition at line 123 of file nsDetectionAdaptor.h.

{return NS_OK;};
NS_IMETHODIMP nsDetectionAdaptor::RawBuffer ( const char *  buffer,
PRUint32 buffer_length 
) [virtual]

Implements nsIParserFilter.

Definition at line 151 of file nsDetectionAdaptor.cpp.

{
    if((mDontFeedToDetector) || (!mDetector))
       return NS_OK;
    nsresult rv = NS_OK;
    rv = mDetector->DoIt((const char*)buffer, *buffer_length, &mDontFeedToDetector);
    if(mObserver) 
       mObserver->SetNotifyByReload(PR_TRUE);

    return NS_OK;
}
NS_IMETHOD nsDetectionAdaptor::WillAddToken ( CToken token) [inline, virtual]

Implements nsIParserFilter.

Definition at line 122 of file nsDetectionAdaptor.h.

{ return NS_OK; };

Member Data Documentation

Definition at line 123 of file nsDetectionAdaptor.h.

Definition at line 127 of file nsDetectionAdaptor.h.

Definition at line 128 of file nsDetectionAdaptor.h.


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