Classes | Defines | Enumerations

nsToken.h File Reference

#include "prtypes.h"
#include "nsString.h"
#include "nsError.h"
#include "nsFixedSizeAllocator.h"
Include dependency graph for nsToken.h:
This graph shows which files directly or indirectly include this file:

Classes

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

Defines

#define NS_HTMLTOKENS_NOT_AN_ENTITY   NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)
 MODULE NOTES: gess 4/1/98.
#define CTOKEN_IMPL_SIZEOF
 Implement the SizeOf() method; leaf classes derived from CToken must declare this.

Enumerations

enum  eContainerInfo { eWellFormed, eMalformed, eFormUnknown }

Define Documentation

#define CTOKEN_IMPL_SIZEOF
Value:
protected:                                                \
  virtual size_t SizeOf() const { return sizeof(*this); } \
public:

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

#define NS_HTMLTOKENS_NOT_AN_ENTITY   NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)

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.


Enumeration Type Documentation

Enumerator:
eWellFormed 
eMalformed 
eFormUnknown