Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Enumerations
nsToken.h File Reference
#include "prtypes.h"
#include "nsString.h"
#include "nsError.h"
#include "nsFixedSizeAllocator.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  CToken
 Token objects represent sequences of characters as they are consumed from the input stream (URL). More...


 MODULE NOTES: gess 4/1/98.
 Implement the SizeOf() method; leaf classes derived from CToken must declare this.


enum  eContainerInfo { eWellFormed, eMalformed, eFormUnknown }

Define Documentation

protected:                                                \
  virtual size_t SizeOf() const { return sizeof(*this); } \

Implement the SizeOf() method; leaf classes derived from CToken must declare this.

Definition at line 92 of file nsToken.h.

MODULE NOTES: gess 4/1/98.

This class is defines the basic notion of a token within our system. All other tokens are derived from this one. It offers a few basic interfaces, but the most important is consume(). The consume() method gets called during the tokenization process when an instance of that particular token type gets detected in the input stream.

CToken objects that are allocated from the heap must be allocated using the nsTokenAllocator: the nsTokenAllocator object uses an arena to manage the tokens.

The nsTokenAllocator object's arena implementation requires object size at destruction time to properly recycle the object; therefore, CToken::operator delete() is not public. Instead, heap-allocated tokens should be destroyed using the static Destroy() method, which accepts a token and the arena from which the token was allocated.

Leaf classes (that are actually instantiated from the heap) must implement the SizeOf() method, which Destroy() uses to determine the size of the token in order to properly recycle it.

Definition at line 76 of file nsToken.h.

Enumeration Type Documentation


Definition at line 82 of file nsToken.h.