Back to index

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

#include <nsDTDUtils.h>

List of all members.

Public Member Functions

 nsTokenAllocator ()
 gess7/25/98
virtual ~nsTokenAllocator ()
 Destructor for the token factory gess7/25/98.
virtual CTokenCreateTokenOfType (eHTMLTokenTypes aType, eHTMLTags aTag, const nsAString &aString)
 Let's get this code ready to be reused by all the contexts.
virtual CTokenCreateTokenOfType (eHTMLTokenTypes aType, eHTMLTags aTag)
 Let's get this code ready to be reused by all the contexts.
nsFixedSizeAllocator & GetArenaPool ()

Protected Attributes

nsFixedSizeAllocator mArenaPool

Detailed Description

Definition at line 244 of file nsDTDUtils.h.


Constructor & Destructor Documentation

gess7/25/98

Parameters:

Definition at line 779 of file nsDTDUtils.cpp.

                                   {

  MOZ_COUNT_CTOR(nsTokenAllocator);

  mArenaPool.Init("TokenPool", kTokenBuckets, kNumTokenBuckets, kInitialTokenPoolSize);

#ifdef NS_DEBUG
  int i=0;
  for(i=0;i<eToken_last-1;++i) {
    mTotals[i]=0;
  }
#endif

}

Destructor for the token factory gess7/25/98.

Definition at line 798 of file nsDTDUtils.cpp.


Member Function Documentation

CToken * nsTokenAllocator::CreateTokenOfType ( eHTMLTokenTypes  aType,
eHTMLTags  aTag,
const nsAString &  aString 
) [virtual]

Let's get this code ready to be reused by all the contexts.

rickg 12June2000

Parameters:
aType-- tells you the type of token to create
aTag-- tells you the type of tag to init with this token
aString-- gives a default string value for the token
Returns:
ptr to new token (or 0).

Definition at line 826 of file nsDTDUtils.cpp.

                                                                                                          {

  CToken* result=0;

#ifdef  NS_DEBUG
    mTotals[aType-1]++;
#endif
  switch(aType){
    case eToken_start:            result=new(mArenaPool) CStartToken(aString, aTag); break;
    case eToken_end:              result=new(mArenaPool) CEndToken(aString, aTag); break;
    case eToken_comment:          result=new(mArenaPool) CCommentToken(aString); break;
    case eToken_entity:           result=new(mArenaPool) CEntityToken(aString); break;
    case eToken_whitespace:       result=new(mArenaPool) CWhitespaceToken(aString); break;
    case eToken_newline:          result=new(mArenaPool) CNewlineToken(); break;
    case eToken_text:             result=new(mArenaPool) CTextToken(aString); break;
    case eToken_attribute:        result=new(mArenaPool) CAttributeToken(aString); break;
    case eToken_instruction:      result=new(mArenaPool) CInstructionToken(aString); break;
    case eToken_cdatasection:     result=new(mArenaPool) CCDATASectionToken(aString); break;
    case eToken_doctypeDecl:      result=new(mArenaPool) CDoctypeDeclToken(aString); break;
    case eToken_markupDecl:       result=new(mArenaPool) CMarkupDeclToken(aString); break;
      default:
        NS_ASSERTION(PR_FALSE, "nsDTDUtils::CreateTokenOfType: illegal token type"); 
        break;
  }

  return result;
}

Here is the caller graph for this function:

Let's get this code ready to be reused by all the contexts.

rickg 12June2000

Parameters:
aType-- tells you the type of token to create
aTag-- tells you the type of tag to init with this token
Returns:
ptr to new token (or 0).

Definition at line 863 of file nsDTDUtils.cpp.

                                                                                {

  CToken* result=0;

#ifdef  NS_DEBUG
    mTotals[aType-1]++;
#endif
  switch(aType){
    case eToken_start:            result=new(mArenaPool) CStartToken(aTag); break;
    case eToken_end:              result=new(mArenaPool) CEndToken(aTag); break;
    case eToken_comment:          result=new(mArenaPool) CCommentToken(); break;
    case eToken_attribute:        result=new(mArenaPool) CAttributeToken(); break;
    case eToken_entity:           result=new(mArenaPool) CEntityToken(); break;
    case eToken_whitespace:       result=new(mArenaPool) CWhitespaceToken(); break;
    case eToken_newline:          result=new(mArenaPool) CNewlineToken(); break;
    case eToken_text:             result=new(mArenaPool) CTextToken(); break;
    case eToken_instruction:      result=new(mArenaPool) CInstructionToken(); break;
    case eToken_cdatasection:     result=new(mArenaPool) CCDATASectionToken(aTag); break;
    case eToken_doctypeDecl:      result=new(mArenaPool) CDoctypeDeclToken(aTag); break;
    case eToken_markupDecl:       result=new(mArenaPool) CMarkupDeclToken(); break;
    default:
      NS_ASSERTION(PR_FALSE, "nsDTDUtils::CreateTokenOfType: illegal token type"); 
      break;
   }

  return result;
}
nsFixedSizeAllocator& nsTokenAllocator::GetArenaPool ( ) [inline]

Definition at line 252 of file nsDTDUtils.h.

{ return mArenaPool; }

Here is the caller graph for this function:


Member Data Documentation

nsFixedSizeAllocator nsTokenAllocator::mArenaPool [protected]

Definition at line 255 of file nsDTDUtils.h.


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