Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions
ByteBufferImpl Class Reference

#include <nsByteBuffer.h>

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

List of all members.

Public Member Functions

 ByteBufferImpl (void)
NS_IMETHOD Init (PRUint32 aBufferSize)
 NS_IMETHOD_ (PRUint32) GetLength(void) const
 NS_IMETHOD_ (PRUint32) GetBufferSize(void) const
 NS_IMETHOD_ (char *) GetBuffer() const
 NS_IMETHOD_ (PRBool) Grow(PRUint32 aNewSize)
 Grow buffer to aNewSize bytes.
 NS_IMETHOD_ (PRInt32) Fill(nsresult *aErrorCode
 Fill the buffer with data from aStream.

Static Public Member Functions

static NS_DECL_ISUPPORTS NS_METHOD Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)

Public Attributes

nsIInputStreamaStream
nsIInputStream PRUint32 aKeep
char * mBuffer
PRUint32 mSpace
PRUint32 mLength

Private Member Functions

 ~ByteBufferImpl ()

Detailed Description

Definition at line 43 of file nsByteBuffer.h.


Constructor & Destructor Documentation

Definition at line 45 of file nsByteBuffer.cpp.

  : mBuffer(NULL), mSpace(0), mLength(0)
{
}

Here is the caller graph for this function:

Definition at line 64 of file nsByteBuffer.cpp.

{
  if (nsnull != mBuffer) {
    delete[] mBuffer;
    mBuffer = nsnull;
  }
  mLength = 0;
}

Member Function Documentation

NS_METHOD ByteBufferImpl::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 74 of file nsByteBuffer.cpp.

{
  if (aOuter)
    return NS_ERROR_NO_AGGREGATION;

  ByteBufferImpl* it = new ByteBufferImpl();
  if (nsnull == it) 
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(it);
  nsresult rv = it->QueryInterface(aIID, (void**)aResult);
  NS_RELEASE(it);
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP ByteBufferImpl::Init ( PRUint32  aBufferSize) [virtual]

Implements nsIByteBuffer.

Definition at line 51 of file nsByteBuffer.cpp.

{
  if (aBufferSize < MIN_BUFFER_SIZE) {
    aBufferSize = MIN_BUFFER_SIZE;
  }
  mSpace = aBufferSize;
  mLength = 0;
  mBuffer = new char[aBufferSize];
  return mBuffer ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
ByteBufferImpl::NS_IMETHOD_ ( PRUint32  ) const [virtual]
Returns:
length of buffer, i.e. how many bytes are currently in it.

Implements nsIByteBuffer.

ByteBufferImpl::NS_IMETHOD_ ( PRUint32  ) const [virtual]
Returns:
length of buffer, i.e. how many bytes are currently in it.

Implements nsIByteBuffer.

ByteBufferImpl::NS_IMETHOD_ ( char *  ) const [virtual]
Returns:
the buffer

Implements nsIByteBuffer.

Grow buffer to aNewSize bytes.

Implements nsIByteBuffer.

Fill the buffer with data from aStream.

Don't grow the buffer, only read until length of buffer equals buffer size.

Reimplemented from nsIByteBuffer.


Member Data Documentation

Reimplemented from nsIByteBuffer.

Definition at line 57 of file nsByteBuffer.h.

Reimplemented from nsIByteBuffer.

Definition at line 57 of file nsByteBuffer.h.

Definition at line 60 of file nsByteBuffer.h.

Definition at line 62 of file nsByteBuffer.h.

Definition at line 61 of file nsByteBuffer.h.


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