Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends
CTextToken Class Reference

Text tokens contain the normalized form of html text. More...

#include <nsHTMLTokens.h>

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

List of all members.

Public Types

enum  eTokenOrigin { eSource, eResidualStyle }

Public Member Functions

 CTextToken ()
 CTextToken (const nsAString &aString)
virtual nsresult Consume (PRUnichar aChar, nsScanner &aScanner, PRInt32 aMode)
 Causes token to consume data from given scanner.
virtual PRInt32 GetTokenType (void)
 Getter which retrieves type of token gess5/11/98.
virtual PRInt32 GetTextLength (void)
virtual void CopyTo (nsAString &aStr)
virtual const nsSubstringGetStringValue (void)
 Retrieve string value of the token gess5/11/98.
virtual void Bind (nsScanner *aScanner, nsScannerIterator &aStart, nsScannerIterator &aEnd)
virtual void Bind (const nsAString &aStr)
nsresult ConsumeCharacterData (PRBool aConservativeConsume, PRBool aIgnoreComments, nsScanner &aScanner, const nsAString &aEndTagName, PRInt32 aFlag, PRBool &aFlushTokens)
nsresult ConsumeParsedCharacterData (PRBool aDiscardFirstNewline, PRBool aConservativeConsume, nsScanner &aScanner, const nsAString &aEndTagName, PRInt32 aFlag, PRBool &aFound)
virtual eContainerInfo GetContainerInfo (void) const
virtual void SetContainerInfo (eContainerInfo aInfo)
void AddRef ()
 Make a note on number of times you have been referenced harishd 08/02/00.
void Release (nsFixedSizeAllocator &aArenaPool)
 Free yourself if no one is holding you.
virtual void GetSource (nsString &anOutputString)
 Get string of full contents, suitable for debug dump.
virtual void AppendSourceTo (nsAString &anOutputString)
 harishd 03/23/00
void SetTypeID (PRInt32 aValue)
 Sets the ordinal value of this token (not currently used) gess5/11/98.
virtual PRInt32 GetTypeID (void)
 Getter which retrieves the current ordinal value for this token gess5/11/98.
virtual PRInt16 GetAttributeCount (void)
 Getter which retrieves the current attribute count for this token gess5/11/98.
virtual PRBool IsWellFormed (void) const
 For tokens who care, this can tell us whether the token is well formed or not.
virtual PRBool IsEmpty (void)
virtual void SetEmpty (PRBool aValue)
 If aValue is TRUE then the token represents a short-hand tag.
PRInt32 GetNewlineCount ()
void SetNewlineCount (PRInt32 aCount)
PRInt32 GetLineNumber ()
void SetLineNumber (PRInt32 aLineNumber)
void SetInError (PRBool aInError)
PRBool IsInError ()
void SetAttributeCount (PRInt16 aValue)
virtual void SelfTest (void)
 perform self test.

Static Public Member Functions

static void Destroy (CToken *aToken, nsFixedSizeAllocator &aArenaPool)
 Destroy a token.
static int GetTokenCount ()

Protected Member Functions

virtual size_t SizeOf () const =0
 Returns the size of the token object.

Static Protected Member Functions

static voidoperator new (size_t aSize, nsFixedSizeAllocator &anArena) CPP_THROW_NEW
 harishd 08/01/00
static void operator delete (void *, size_t)
 Hide operator delete; clients should use Destroy() instead.

Protected Attributes

nsScannerSubstring mTextValue
PRInt32 mTypeID
PRInt32 mUseCount
PRInt32 mNewlineCount
PRUint32 mLineNumber: 31
PRUint32 mInError: 1
PRInt16 mAttrCount

Friends

class nsTokenAllocator

Detailed Description

Text tokens contain the normalized form of html text.

These tokens are guaranteed not to contain entities, start or end tags, or newlines.

gess 3/25/98

Definition at line 279 of file nsHTMLTokens.h.


Member Enumeration Documentation

enum CToken::eTokenOrigin [inherited]
Enumerator:
eSource 
eResidualStyle 

Definition at line 109 of file nsToken.h.


Constructor & Destructor Documentation

Definition at line 531 of file nsHTMLTokens.cpp.

                       : CHTMLToken(eHTMLTag_text) {
}
CTextToken::CTextToken ( const nsAString &  aString)

Definition at line 542 of file nsHTMLTokens.cpp.

                                             : CHTMLToken(eHTMLTag_text) {
  mTextValue.Rebind(aName);
}

Here is the call graph for this function:


Member Function Documentation

void CToken::AddRef ( void  ) [inline, inherited]

Make a note on number of times you have been referenced harishd 08/02/00.

Definition at line 154 of file nsToken.h.

{ ++mUseCount; }
void CToken::AppendSourceTo ( nsAString &  anOutputString) [virtual, inherited]

harishd 03/23/00

harishd 3/23/00

Returns:
reference to string containing string value

Reimplemented in CAttributeToken, CEntityToken, CCommentToken, CEndToken, and CStartToken.

Definition at line 130 of file nsToken.cpp.

                                                     {
  anOutputString.Append(GetStringValue());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CTextToken::Bind ( nsScanner aScanner,
nsScannerIterator aStart,
nsScannerIterator aEnd 
) [virtual]

Definition at line 1000 of file nsHTMLTokens.cpp.

{
  aScanner->BindSubstring(mTextValue, aStart, aEnd);
}

Here is the call graph for this function:

void CTextToken::Bind ( const nsAString &  aStr) [virtual]

Definition at line 1005 of file nsHTMLTokens.cpp.

{
  mTextValue.Rebind(aStr);
}

Here is the call graph for this function:

nsresult CTextToken::Consume ( PRUnichar  aChar,
nsScanner aScanner,
PRInt32  aMode 
) [virtual]

Causes token to consume data from given scanner.

Virtual method used to tell this toke to consume his valid chars.

Note that behavior varies wildly between CToken subclasses. gess5/11/98

Parameters:
aChar-- most recent char consumed
aScanner-- input source where token should get data
Returns:
error code (0 means ok)

gess 3/25/98

Parameters:
aChar-- first char in sequence
aScanner-- object to retrieve data from
Returns:
int error code

Reimplemented from CToken.

Definition at line 569 of file nsHTMLTokens.cpp.

                                                                               {
  static const PRUnichar theTerminalsChars[] = 
    { PRUnichar('\n'), PRUnichar('\r'), PRUnichar('&'), PRUnichar('<'),
      PRUnichar(0) };
  static const nsReadEndCondition theEndCondition(theTerminalsChars);
  nsresult  result=NS_OK;
  PRBool    done=PR_FALSE;
  nsScannerIterator origin, start, end;
  
  // Start scanning after the first character, because we know it to
  // be part of this text token (we wouldn't have come here if it weren't)
  aScanner.CurrentPosition(origin);
  start = origin;
  aScanner.EndReading(end);

  NS_ASSERTION(start != end, "Calling CTextToken::Consume when already at the "
                             "end of a document is a bad idea.");

  aScanner.SetPosition(++start);

  while((NS_OK==result) && (!done)) {
    result=aScanner.ReadUntil(start, end, theEndCondition, PR_FALSE);
    if(NS_OK==result) {
      result=aScanner.Peek(aChar);

      if (NS_OK == result && (kCR == aChar || kNewLine == aChar)) {
        switch (aChar) {
          case kCR:
          {
            // It's a carriage return. See if this is part of a CR-LF pair (in
            // which case we need to treat it as one newline). If we're at the
            // edge of a packet, then leave the CR on the scanner, since it
            // could still be part of a CR-LF pair. Otherwise, it isn't.
            PRUnichar theNextChar;
            result = aScanner.Peek(theNextChar, 1);

            if (result == kEOF && aScanner.IsIncremental()) {
              break;
            }

            if (NS_SUCCEEDED(result)) {
              // Actually get the carriage return.
              aScanner.GetChar(aChar);
            }

            if (kLF == theNextChar) {
              // If the "\r" is followed by a "\n", don't replace it and let
              // it be ignored by the layout system.
              end.advance(2);
              aScanner.GetChar(theNextChar);
            }
            else {
              // If it is standalone, replace the "\r" with a "\n" so that it
              // will be considered by the layout system.
              aScanner.ReplaceCharacter(end, kLF);
              ++end;
            }
            ++mNewlineCount;
            break;
          }
          case kLF:
            aScanner.GetChar(aChar);
            ++end;
            ++mNewlineCount;
            break;
        } //switch
      }
      else done=PR_TRUE;
    }
  }

  // Note: This function is only called from nsHTMLTokenizer::ConsumeText. If
  // we return an error result from the final buffer, then it is responsible
  // for turning it into an NS_OK result.
  aScanner.BindSubstring(mTextValue, origin, end);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult CTextToken::ConsumeCharacterData ( PRBool  aConservativeConsume,
PRBool  aIgnoreComments,
nsScanner aScanner,
const nsAString &  aEndTagName,
PRInt32  aFlag,
PRBool aFlushTokens 
)

Definition at line 663 of file nsHTMLTokens.cpp.

                                                                {
  nsresult      result=NS_OK;
  nsScannerIterator theStartOffset, theCurrOffset, theTermStrPos, theStartCommentPos, theAltTermStrPos, endPos;
  PRBool        done=PR_FALSE;
  PRBool        theLastIteration=PR_FALSE;

  aScanner.CurrentPosition(theStartOffset);
  theCurrOffset = theStartOffset;
  aScanner.EndReading(endPos);
  theTermStrPos = theStartCommentPos = theAltTermStrPos = endPos;

  // ALGORITHM: *** The performance is based on correctness of the document ***
  // 1. Look for a '<' character.  This could be
  //    a) Start of a comment (<!--), b) Start of the terminal string, or c) a start of a tag.
  //    We are interested in a) and b). c) is ignored because in CDATA we don't care for tags.
  //    NOTE: Technically speaking in CDATA we should ignore the comments too!! But for compatibility
  //          we don't.
  // 2. Having the offset, for '<', search for the terminal string from there on and record its offset.
  // 3. From the same '<' offset also search for start of a comment '<!--'. If found search for
  //    end comment '-->' between the terminal string and '<!--'.  If you did not find the end
  //    comment, then we have a malformed document, i.e., this section has a prematured terminal string
  //    Ex. <SCRIPT><!-- document.write('</SCRIPT>') //--> </SCRIPT>. But record terminal string's
  //    offset if this is the first premature terminal string, and update the current offset to the terminal 
  //    string (prematured) offset and goto step 1.
  // 4. Amen...If you found a terminal string and '-->'. Otherwise goto step 1.
  // 5. If the end of the document is reached and if we still don't have the condition in step 4. then
  //    assume that the prematured terminal string is the actual terminal string and goto step 1. This
  //    will be our last iteration. If there is no premature terminal string and we're being
  //    conservative in our consumption (aConservativeConsume), then don't consume anything
  //    from the scanner. Otherwise, we consume all the way until the end (for <xmp>).

  NS_NAMED_LITERAL_STRING(ltslash, "</");
  const nsString theTerminalString = ltslash + aEndTagName;

  PRUint32 termStrLen=theTerminalString.Length();
  while((result == NS_OK) && !done) {
    PRBool found = PR_FALSE;
    nsScannerIterator gtOffset,ltOffset = theCurrOffset;
    while (FindCharInReadable(PRUnichar(kLessThan), ltOffset, endPos) &&
           ((PRUint32)ltOffset.size_forward() >= termStrLen ||
            Distance(ltOffset, endPos) >= termStrLen)) {
      // Make a copy of the (presumed) end tag and
      // do a case-insensitive comparison

      nsScannerIterator start(ltOffset), end(ltOffset);
      end.advance(termStrLen);

      if (CaseInsensitiveFindInReadable(theTerminalString,start,end) && 
          (end == endPos || (*end == '>'  || *end == ' '  || 
                             *end == '\t' || *end == '\n' || 
                             *end == '\r'))) {
        gtOffset = end;
        // Note that aIgnoreComments is only not set for <script>. We don't
        // want to execute scripts that aren't in the form of: <script\s.*>
        if ((end == endPos && aIgnoreComments) || 
            FindCharInReadable(PRUnichar(kGreaterThan), gtOffset, endPos)) {
          found = PR_TRUE;
          theTermStrPos = start;
        }
        break;
      }
      ltOffset.advance(1);
    }
     
    if (found && theTermStrPos != endPos) {
      if(!(aFlag & NS_IPARSER_FLAG_STRICT_MODE) &&
         !theLastIteration && !aIgnoreComments) {
        nsScannerIterator endComment(ltOffset);
        endComment.advance(5);
         
        if ((theStartCommentPos == endPos) &&
            FindInReadable(NS_LITERAL_STRING("<!--"), theCurrOffset, endComment)) {
          theStartCommentPos = theCurrOffset;
        }
         
        if (theStartCommentPos != endPos) {
          // Search for --> between <!-- and </TERMINALSTRING>.
          theCurrOffset = theStartCommentPos;
          nsScannerIterator terminal(theTermStrPos);
          if (!RFindInReadable(NS_LITERAL_STRING("-->"),
                               theCurrOffset, terminal)) {
            // If you're here it means that we have a bogus terminal string.
            // Even though it is bogus, the position of the terminal string
            // could be helpful in case we hit the rock bottom.
            if (theAltTermStrPos == endPos) {
              // But we only want to remember the first bogus terminal string.
              theAltTermStrPos = theTermStrPos;
            }
    
            // We did not find '-->' so keep searching for terminal string.
            theCurrOffset = theTermStrPos;
            theCurrOffset.advance(termStrLen);
            continue;
          }
        }
      }

      aScanner.BindSubstring(mTextValue, theStartOffset, theTermStrPos);
      aScanner.SetPosition(ltOffset);
      
      // We found </SCRIPT> or </STYLE>...permit flushing -> Ref: Bug 22485
      aFlushTokens=PR_TRUE;
      done = PR_TRUE;
    }
    else {
      // We end up here if:
      // a) when the buffer runs out ot data.
      // b) when the terminal string is not found.
      if(!aScanner.IsIncremental()) {
        if(theAltTermStrPos != endPos && aConservativeConsume) {
          // If you're here it means..we hit the rock bottom and therefore switch to plan B.
          theCurrOffset = theAltTermStrPos;
          theLastIteration = PR_TRUE;
        }
        else if (!aConservativeConsume) {
          done = PR_TRUE; // Do this to fix Bug. 35456
          result = kFakeEndTag;
          aScanner.BindSubstring(mTextValue, theStartOffset, endPos);
          aScanner.SetPosition(endPos);
        }
        else {
          done = PR_TRUE;
          result = kFakeEndTag;
          // We need to bind our value to a non-empty string.
          aScanner.BindSubstring(mTextValue, theStartOffset, theStartOffset);
        }
      }
      else {
        result=kEOF;
      }
    }
  }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult CTextToken::ConsumeParsedCharacterData ( PRBool  aDiscardFirstNewline,
PRBool  aConservativeConsume,
nsScanner aScanner,
const nsAString &  aEndTagName,
PRInt32  aFlag,
PRBool aFound 
)

Definition at line 817 of file nsHTMLTokens.cpp.

{
  // This function is fairly straightforward except if there is no terminating
  // string. If there is, we simply loop through all of the entities, reducing
  // them as necessary and skipping over non-terminal strings starting with <.
  // If there is *no* terminal string, then we examine aConservativeConsume.
  // If we want to be conservative, we backtrack to the first place in the
  // document that looked like the end of PCDATA (i.e., the first tag). This
  // is for compatibility and so we don't regress bug 42945. If we are not
  // conservative, then we consume everything, all the way up to the end of
  // the document.

  static const PRUnichar terminalChars[] = {
    PRUnichar('\r'), PRUnichar('\n'), PRUnichar('&'), PRUnichar('<'),
    PRUnichar(0)
  };
  static const nsReadEndCondition theEndCondition(terminalChars);

  nsScannerIterator currPos, endPos, altEndPos;
  PRUint32 truncPos = 0;
  aScanner.CurrentPosition(currPos);
  aScanner.EndReading(endPos);

  altEndPos = endPos;

  nsScannerSharedSubstring theContent;
  PRUnichar ch = 0;

  NS_NAMED_LITERAL_STRING(commentStart, "<!--");
  NS_NAMED_LITERAL_STRING(ltslash, "</");
  const nsString theTerminalString = ltslash + aEndTagName;
  PRUint32 termStrLen = theTerminalString.Length();
  PRUint32 commentStartLen = commentStart.Length();

  nsresult result = NS_OK;

  // Note that if we're already at the end of the document, the ConsumeUntil
  // will fail, and we'll do the right thing.
  do {
    result = ConsumeUntil(theContent, mNewlineCount, aScanner, 
                          theEndCondition, PR_TRUE, aFlag);

    if (aDiscardFirstNewline && 
        (NS_SUCCEEDED(result) || !aScanner.IsIncremental()) &&
        !(aFlag & NS_IPARSER_FLAG_VIEW_SOURCE)) {
      // Check if the very first character is a newline, and if so discard it.
      // Note that we don't want to discard it in view source!
      // Also note that this has to happen here (as opposed to before the
      // ConsumeUntil) because we have to expand any entities.
      // XXX It would be nice to be able to do this without calling
      // writable()!
      const nsSubstring &firstChunk = theContent.str();
      if (!firstChunk.IsEmpty()) {
        PRUint32 where = 0;
        PRUnichar newline = firstChunk.First();

        if (newline == kCR || newline == kNewLine) {
          ++where;

          if (firstChunk.Length() > 1) {
            if (newline == kCR && firstChunk.CharAt(1) == kNewLine) {
              // Handle \r\n = 1 newline.
              ++where;
            }
            // Note: \n\r = 2 newlines.
          }
        }

        if (where != 0) {
          theContent.writable() = Substring(firstChunk, where);
        }
      }
    }
    aDiscardFirstNewline = PR_FALSE;

    if (NS_FAILED(result)) {
      if (kEOF == result && !aScanner.IsIncremental()) {
        aFound = PR_TRUE; // this is as good as it gets.
        result = kFakeEndTag;

        if (aConservativeConsume && altEndPos != endPos) {
          // We ran out of room looking for a </title>. Go back to the first
          // place that looked like a tag and use that as our stopping point.
          theContent.writable().Truncate(truncPos);
          aScanner.SetPosition(altEndPos, PR_FALSE, PR_TRUE);
        }
        // else we take everything we consumed.
        mTextValue.Rebind(theContent.str());
      }
      else {
        aFound = PR_FALSE;
      }

      return result;
    }

    aScanner.CurrentPosition(currPos);
    aScanner.GetChar(ch); // this character must be '&' or '<'

    if (ch == kLessThan && altEndPos == endPos) {
      // Keep this position in case we need it for later.
      altEndPos = currPos;
      truncPos = theContent.str().Length();
    }

    if (Distance(currPos, endPos) >= termStrLen) {
      nsScannerIterator start(currPos), end(currPos);
      end.advance(termStrLen);

      if (CaseInsensitiveFindInReadable(theTerminalString,start,end)) {
        if (end != endPos && (*end == '>'  || *end == ' '  || 
                              *end == '\t' || *end == '\n' || 
                              *end == '\r')) {
          aFound = PR_TRUE;
          mTextValue.Rebind(theContent.str());

          // Note: This SetPosition() is actually going backwards from the
          // scanner's mCurrentPosition (so we pass aReverse == PR_TRUE). This
          // is because we call GetChar() above after we get the current
          // position.
          aScanner.SetPosition(currPos, PR_FALSE, PR_TRUE);
          break;
        }
      }
    }
    // IE only consumes <!-- --> as comments in PCDATA.
    if (Distance(currPos, endPos) >= commentStartLen) {
      nsScannerIterator start(currPos), end(currPos);
      end.advance(commentStartLen);

      if (CaseInsensitiveFindInReadable(commentStart,start,end)) {
        CCommentToken consumer; // stack allocated.

        // CCommentToken expects us to be on the '-'
        aScanner.SetPosition(currPos.advance(2));

        // In quirks mode we consume too many things as comments, so pretend
        // that we're not by modifying aFlag.
        result = consumer.Consume(*currPos, aScanner, 
         (aFlag & ~NS_IPARSER_FLAG_QUIRKS_MODE) | NS_IPARSER_FLAG_STRICT_MODE);
        if (kEOF == result) {
          return kEOF; // this can only happen if we're really out of space.
        }
        else if (kNotAComment == result) {
          // Fall through and consume this as text.
          aScanner.CurrentPosition(currPos);
          aScanner.SetPosition(currPos.advance(1));
        }
        else {
          consumer.AppendSourceTo(theContent.writable());
          mNewlineCount += consumer.GetNewlineCount();
          continue;
        }
      }
    }

    result = kEOF;
    // We did not find the terminal string yet so
    // include the character that stopped consumption.
    theContent.writable().Append(ch);
  } while (currPos != endPos);

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void CTextToken::CopyTo ( nsAString &  aStr) [virtual]

Definition at line 987 of file nsHTMLTokens.cpp.

Here is the call graph for this function:

static void CToken::Destroy ( CToken aToken,
nsFixedSizeAllocator &  aArenaPool 
) [inline, static, inherited]

Destroy a token.

Definition at line 143 of file nsToken.h.

    {
      size_t sz = aToken->SizeOf();
      aToken->~CToken();
      aArenaPool.Free(aToken, sz);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

PRInt16 CToken::GetAttributeCount ( void  ) [virtual, inherited]

Getter which retrieves the current attribute count for this token gess5/11/98.

Retrieves copy of attr count for this token.

Returns:
current attribute count

gess 3/25/98

Returns:
int containing attribute count

Definition at line 151 of file nsToken.cpp.

                                      {
  return mAttrCount;
}

Here is the caller graph for this function:

virtual eContainerInfo CHTMLToken::GetContainerInfo ( void  ) const [inline, virtual, inherited]

Reimplemented in CStartToken.

Definition at line 115 of file nsHTMLTokens.h.

{return eFormUnknown;}

Here is the caller graph for this function:

PRInt32 CToken::GetLineNumber ( void  ) [inline, inherited]

Definition at line 257 of file nsToken.h.

    { 
      return mLineNumber;
    }

Here is the caller graph for this function:

PRInt32 CToken::GetNewlineCount ( ) [inline, inherited]

Definition at line 247 of file nsToken.h.

    { 
      return mNewlineCount; 
    }

Here is the caller graph for this function:

void CToken::GetSource ( nsString anOutputString) [virtual, inherited]

Get string of full contents, suitable for debug dump.

It should look exactly like the input source. gess5/11/98

Returns:
reference to string containing string value

Reimplemented in CAttributeToken, CEntityToken, CEndToken, and CStartToken.

Definition at line 122 of file nsToken.cpp.

                                               {
  anOutputString.Assign(GetStringValue());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Retrieve string value of the token gess5/11/98.

Returns:
reference to string containing string value

Implements CToken.

Reimplemented in CIndirectTextToken.

Definition at line 995 of file nsHTMLTokens.cpp.

{
  return mTextValue.AsString();
}

Here is the call graph for this function:

Definition at line 557 of file nsHTMLTokens.cpp.

                                      {
  return mTextValue.Length();
}

Here is the call graph for this function:

Here is the caller graph for this function:

int CToken::GetTokenCount ( ) [static, inherited]

Definition at line 49 of file nsToken.cpp.

Getter which retrieves type of token gess5/11/98.

Retrieve type of token.

Returns:
int containing token type

This class returns -1, but subclasses return something more meaningful.

gess 3/25/98

Returns:
int value containing token type.

Reimplemented from CToken.

Definition at line 553 of file nsHTMLTokens.cpp.

                                     {
  return eToken_text;
}
PRInt32 CToken::GetTypeID ( void  ) [virtual, inherited]

Getter which retrieves the current ordinal value for this token gess5/11/98.

Retrieves copy of internal ordinal value.

Returns:
current ordinal value

This method is deprecated, and will soon be going away.

gess 3/25/98

Returns:
int containing ordinal value

Reimplemented in CEndToken, and CStartToken.

Definition at line 141 of file nsToken.cpp.

                              {
  return mTypeID;
}

Here is the caller graph for this function:

virtual PRBool CToken::IsEmpty ( void  ) [inline, virtual, inherited]

Reimplemented in CStartToken.

Definition at line 240 of file nsToken.h.

{ return PR_FALSE; }
PRBool CToken::IsInError ( ) [inline, inherited]

Definition at line 272 of file nsToken.h.

    {
      return mInError;
    }

Here is the caller graph for this function:

virtual PRBool CToken::IsWellFormed ( void  ) const [inline, virtual, inherited]

For tokens who care, this can tell us whether the token is well formed or not.

gess 8/30/00

Returns:
PR_FALSE; subclasses MUST override if they care.

Reimplemented in CStartToken.

Definition at line 238 of file nsToken.h.

{return PR_FALSE;}

Here is the caller graph for this function:

static void CToken::operator delete ( void ,
size_t   
) [inline, static, protected, inherited]

Hide operator delete; clients should use Destroy() instead.

Definition at line 131 of file nsToken.h.

{}
static void* CToken::operator new ( size_t  aSize,
nsFixedSizeAllocator &  anArena 
) [inline, static, protected, inherited]

harishd 08/01/00

Parameters:
aSize-
aArena- Allocate memory from this pool.

Definition at line 123 of file nsToken.h.

    {
      return anArena.Alloc(aSize);
    }
void CToken::Release ( nsFixedSizeAllocator &  aArenaPool) [inline, inherited]

Free yourself if no one is holding you.

harishd 08/02/00

Definition at line 160 of file nsToken.h.

                                                   {
      if(--mUseCount==0)
        Destroy(this, aArenaPool);
    }

Here is the call graph for this function:

void CToken::SelfTest ( void  ) [virtual, inherited]

perform self test.

gess 3/25/98

gess5/11/98

Definition at line 172 of file nsToken.cpp.

                          {
#ifdef _DEBUG
#endif
}
void CToken::SetAttributeCount ( PRInt16  aValue) [inline, inherited]

Definition at line 277 of file nsToken.h.

Here is the caller graph for this function:

virtual void CHTMLToken::SetContainerInfo ( eContainerInfo  aInfo) [inline, virtual, inherited]

Reimplemented in CStartToken.

Definition at line 116 of file nsHTMLTokens.h.

{ }

Here is the caller graph for this function:

virtual void CToken::SetEmpty ( PRBool  aValue) [inline, virtual, inherited]

If aValue is TRUE then the token represents a short-hand tag.

Reimplemented in CStartToken.

Definition at line 245 of file nsToken.h.

{ return ; }

Here is the call graph for this function:

Here is the caller graph for this function:

void CToken::SetInError ( PRBool  aInError) [inline, inherited]

Definition at line 267 of file nsToken.h.

    {
      mInError = aInError;
    }

Here is the caller graph for this function:

void CToken::SetLineNumber ( PRInt32  aLineNumber) [inline, inherited]

Definition at line 262 of file nsToken.h.

    { 
      mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber;
    }
void CToken::SetNewlineCount ( PRInt32  aCount) [inline, inherited]

Definition at line 252 of file nsToken.h.

Here is the caller graph for this function:

void CToken::SetTypeID ( PRInt32  aValue) [inline, inherited]

Sets the ordinal value of this token (not currently used) gess5/11/98.

Parameters:
valueis the new ord value for this token

Definition at line 196 of file nsToken.h.

                                   {
      mTypeID = aValue;
    }

Here is the caller graph for this function:

virtual size_t CToken::SizeOf ( ) const [protected, pure virtual, inherited]

Returns the size of the token object.

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsTokenAllocator [friend, inherited]

Definition at line 115 of file nsToken.h.


Member Data Documentation

PRInt16 CToken::mAttrCount [protected, inherited]

Definition at line 300 of file nsToken.h.

PRUint32 CToken::mInError [protected, inherited]

Definition at line 299 of file nsToken.h.

PRUint32 CToken::mLineNumber [protected, inherited]

Definition at line 298 of file nsToken.h.

PRInt32 CToken::mNewlineCount [protected, inherited]

Definition at line 297 of file nsToken.h.

Definition at line 309 of file nsHTMLTokens.h.

PRInt32 CToken::mTypeID [protected, inherited]

Definition at line 295 of file nsToken.h.

PRInt32 CToken::mUseCount [protected, inherited]

Definition at line 296 of file nsToken.h.


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