nsScannerBufferList Class Reference

#include <nsScannerString.h>

Inheritance diagram for nsScannerBufferList:

Inheritance graph
[legend]
Collaboration diagram for nsScannerBufferList:

Collaboration graph
[legend]

List of all members.


Detailed Description

This class maintains a list of heap-allocated Buffer objects. The buffers are maintained in a circular linked list. Each buffer has a usage count that is decremented by the owning nsScannerSubstring.

The buffer list itself is reference counted. This allows the buffer list to be shared by multiple nsScannerSubstring objects. The reference counting is not threadsafe, which is not at all a requirement.

When a nsScannerSubstring releases its reference to a buffer list, it decrements the usage count of the first buffer in the buffer list that it was referencing. It informs the buffer list that it can discard buffers starting at that prefix. The buffer list will do so if the usage count of that buffer is 0 and if it is the first buffer in the list. It will continue to prune buffers starting from the front of the buffer list until it finds a buffer that has a usage count that is non-zero.

Public Member Functions

 nsScannerBufferList (Buffer *buf)
void AddRef ()
void Release ()
void Append (Buffer *buf)
void InsertAfter (Buffer *buf, Buffer *prev)
void SplitBuffer (const Position &)
void DiscardUnreferencedPrefix (Buffer *)
BufferHead ()
const BufferHead () const
BufferTail ()
const BufferTail () const

Static Public Member Functions

static BufferAllocBufferFromString (const nsAString &)
 nsScannerBufferList
static BufferAllocBuffer (PRUint32 capacity)

Friends

class nsScannerSubstring

Classes

class  Buffer
 Buffer objects are directly followed by a data segment. More...
class  Position
 Position objects serve as lightweight pointers into a buffer list. More...


Constructor & Destructor Documentation

nsScannerBufferList::nsScannerBufferList ( Buffer buf  )  [inline]


Member Function Documentation

nsScannerBufferList::Buffer * nsScannerBufferList::AllocBufferFromString ( const nsAString aString  )  [static]

nsScannerBufferList::Buffer * nsScannerBufferList::AllocBuffer ( PRUint32  capacity  )  [static]

void nsScannerBufferList::AddRef ( void   )  [inline]

void nsScannerBufferList::Release ( void   )  [inline]

void nsScannerBufferList::Append ( Buffer buf  )  [inline]

void nsScannerBufferList::InsertAfter ( Buffer buf,
Buffer prev 
) [inline]

void nsScannerBufferList::SplitBuffer ( const Position pos  ) 

void nsScannerBufferList::DiscardUnreferencedPrefix ( Buffer aBuf  ) 

Buffer* nsScannerBufferList::Head (  )  [inline]

const Buffer* nsScannerBufferList::Head (  )  const [inline]

Buffer* nsScannerBufferList::Tail (  )  [inline]

const Buffer* nsScannerBufferList::Tail (  )  const [inline]


Friends And Related Function Documentation

friend class nsScannerSubstring [friend]


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

Generated Mozilla by doxygen 1.5.6