Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes
CParserContext Class Reference

MODULE NOTES: gess 4/1/98. More...

#include <CParserContext.h>

Collaboration diagram for CParserContext:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { eTransferBufferSize = 4096 }
enum  eContextType { eCTNone, eCTURL, eCTString, eCTStream }

Public Member Functions

 CParserContext (nsScanner *aScanner, void *aKey=0, eParserCommands aCommand=eViewNormal, nsIRequestObserver *aListener=0, nsIDTD *aDTD=0, eAutoDetectResult aStatus=eUnknownDetect, PRBool aCopyUnused=PR_FALSE)
 Your friendly little constructor.
 CParserContext (const CParserContext &aContext)
 Your friendly little constructor.
 ~CParserContext ()
 Destructor for parser context NOTE: DO NOT destroy the dtd here.
nsresult GetTokenizer (PRInt32 aType, nsIContentSink *aSink, nsITokenizer *&aTokenizer)
void SetMimeType (const nsACString &aMimeType)
 Set's the mimetype for this context rickg 03.18.2000.

Public Attributes

nsCOMPtr< nsIRequestmRequest
nsIDTDmDTD
nsIRequestObservermListener
char * mTransferBuffer
voidmKey
nsITokenizermTokenizer
CParserContextmPrevContext
nsScannermScanner
nsCString mMimeType
nsDTDMode mDTDMode
eParserDocType mDocType
eStreamState mStreamListenerState
eContextType mContextType
eAutoDetectResult mAutoDetectStatus
eParserCommands mParserCommand
PRPackedBool mMultipart
PRPackedBool mCopyUnused
PRUint32 mTransferBufferSize

Detailed Description

MODULE NOTES: gess 4/1/98.

Note that the parser is given FULL access to all data in a parsercontext. Hey, that what it's for!

Definition at line 61 of file CParserContext.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
eTransferBufferSize 

Definition at line 65 of file CParserContext.h.

Enumerator:
eCTNone 
eCTURL 
eCTString 
eCTStream 

Definition at line 66 of file CParserContext.h.


Constructor & Destructor Documentation

CParserContext::CParserContext ( nsScanner aScanner,
void aKey = 0,
eParserCommands  aCommand = eViewNormal,
nsIRequestObserver aListener = 0,
nsIDTD aDTD = 0,
eAutoDetectResult  aStatus = eUnknownDetect,
PRBool  aCopyUnused = PR_FALSE 
)

Your friendly little constructor.

Ok, it's not the friendly, but the only guy using it is the parser. gess7/23/98

Parameters:
aScanner
aKey
aListener

Definition at line 57 of file CParserContext.cpp.

Here is the call graph for this function:

Your friendly little constructor.

Ok, it's not the friendly, but the only guy using it is the parser. gess7/23/98

Parameters:
aScanner
aKey
aListener

Definition at line 95 of file CParserContext.cpp.

Here is the call graph for this function:

Destructor for parser context NOTE: DO NOT destroy the dtd here.

gess7/11/98

Definition at line 128 of file CParserContext.cpp.

                               {

  MOZ_COUNT_DTOR(CParserContext);

  if(mScanner) {
    delete mScanner;
    mScanner=nsnull;
  }

  if(mTransferBuffer)
    delete [] mTransferBuffer;

  NS_IF_RELEASE(mDTD);
  NS_IF_RELEASE(mListener);
  NS_IF_RELEASE(mTokenizer);

  //Remember that it's ok to simply ingore the PrevContext.

}

Member Function Documentation

nsresult CParserContext::GetTokenizer ( PRInt32  aType,
nsIContentSink aSink,
nsITokenizer *&  aTokenizer 
)

Definition at line 173 of file CParserContext.cpp.

                                                        {
  nsresult result = NS_OK;
  
  if(!mTokenizer) {
    if (aType == NS_IPARSER_FLAG_HTML || mParserCommand == eViewSource) {
      nsCOMPtr<nsIHTMLContentSink> theSink = do_QueryInterface(aSink);
      PRUint16 theFlags = 0;

      if (theSink) {
        // XXX This code is repeated both here and in CNavDTD. Can the two
        // callsites be combined?
        PRBool enabled;
        theSink->IsEnabled(eHTMLTag_frameset, &enabled);
        if(enabled) {
          theFlags |= NS_IPARSER_FLAG_FRAMES_ENABLED;
        }
        
        theSink->IsEnabled(eHTMLTag_script, &enabled);
        if(enabled) {
          theFlags |= NS_IPARSER_FLAG_SCRIPT_ENABLED;
        }
      }

      result = NS_NewHTMLTokenizer(&mTokenizer,mDTDMode,mDocType,
                                   mParserCommand,theFlags);
      // Make sure the new tokenizer has all of the necessary information.
      // XXX this might not be necessary.
      if (mTokenizer && mPrevContext) {
        mTokenizer->CopyState(mPrevContext->mTokenizer);
      }
    }
    else if (aType == NS_IPARSER_FLAG_XML)
    {
      result = CallQueryInterface(mDTD, &mTokenizer);
    }
  }
  
  aTokenizer = mTokenizer;
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CParserContext::SetMimeType ( const nsACString &  aMimeType)

Set's the mimetype for this context rickg 03.18.2000.

Definition at line 153 of file CParserContext.cpp.

                                                           {
  mMimeType.Assign(aMimeType);

  mDocType=ePlainText;

  if(mMimeType.EqualsLiteral(kHTMLTextContentType))
    mDocType=eHTML_Strict;
  else if (mMimeType.EqualsLiteral(kXMLTextContentType)          ||
           mMimeType.EqualsLiteral(kXMLApplicationContentType)   ||
           mMimeType.EqualsLiteral(kXHTMLApplicationContentType) ||
           mMimeType.EqualsLiteral(kXULTextContentType)          ||
#ifdef MOZ_SVG
           mMimeType.EqualsLiteral(kSVGTextContentType)          ||
#endif
           mMimeType.EqualsLiteral(kRDFApplicationContentType)   ||
           mMimeType.EqualsLiteral(kRDFTextContentType))
    mDocType=eXML;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 100 of file CParserContext.h.

Definition at line 99 of file CParserContext.h.

Definition at line 104 of file CParserContext.h.

Definition at line 97 of file CParserContext.h.

Definition at line 86 of file CParserContext.h.

Definition at line 95 of file CParserContext.h.

Definition at line 89 of file CParserContext.h.

Definition at line 87 of file CParserContext.h.

Definition at line 94 of file CParserContext.h.

Definition at line 103 of file CParserContext.h.

Definition at line 101 of file CParserContext.h.

Definition at line 91 of file CParserContext.h.

Definition at line 84 of file CParserContext.h.

Definition at line 92 of file CParserContext.h.

Definition at line 98 of file CParserContext.h.

Definition at line 90 of file CParserContext.h.

Definition at line 88 of file CParserContext.h.

Definition at line 105 of file CParserContext.h.


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