Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes
nsAutoTextBuffer Class Reference

#include <nsTextTransformer.h>

List of all members.

Public Member Functions

 nsAutoTextBuffer ()
 ~nsAutoTextBuffer ()
nsresult GrowBy (PRInt32 aAtLeast, PRBool aCopyToHead=PR_TRUE)
nsresult GrowTo (PRInt32 aNewSize, PRBool aCopyToHead=PR_TRUE)
PRUnicharGetBuffer ()
PRUnicharGetBufferEnd ()
PRInt32 GetBufferLength () const

Public Attributes

PRUnicharmBuffer
PRInt32 mBufferLen
PRUnichar mAutoBuffer [NS_TEXT_TRANSFORMER_AUTO_WORD_BUF_SIZE]

Detailed Description

Definition at line 111 of file nsTextTransformer.h.


Constructor & Destructor Documentation

Definition at line 80 of file nsTextTransformer.cpp.

{
  if (mBuffer && (mBuffer != mAutoBuffer)) {
    delete [] mBuffer;
  }
}

Member Function Documentation

Definition at line 120 of file nsTextTransformer.h.

{ return mBuffer; }

Here is the caller graph for this function:

Definition at line 121 of file nsTextTransformer.h.

{ return mBuffer + mBufferLen; }

Here is the caller graph for this function:

Definition at line 122 of file nsTextTransformer.h.

{ return mBufferLen; }

Here is the caller graph for this function:

nsresult nsAutoTextBuffer::GrowBy ( PRInt32  aAtLeast,
PRBool  aCopyToHead = PR_TRUE 
)

Definition at line 88 of file nsTextTransformer.cpp.

{
  PRInt32 newSize = mBufferLen * 2;
  if (newSize < mBufferLen + aAtLeast) {
    newSize = mBufferLen + aAtLeast + 100;
  }
  return GrowTo(newSize, aCopyToHead);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsAutoTextBuffer::GrowTo ( PRInt32  aNewSize,
PRBool  aCopyToHead = PR_TRUE 
)

Definition at line 98 of file nsTextTransformer.cpp.

{
  if (aNewSize > mBufferLen) {
    PRUnichar* newBuffer = new PRUnichar[aNewSize];
    if (!newBuffer) {
      return NS_ERROR_OUT_OF_MEMORY;
    }
    memcpy(&newBuffer[aCopyToHead ? 0 : mBufferLen],
           mBuffer, sizeof(PRUnichar) * mBufferLen);
    if (mBuffer != mAutoBuffer) {
      delete [] mBuffer;
    }
    mBuffer = newBuffer;
    mBufferLen = aNewSize;
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 126 of file nsTextTransformer.h.

Definition at line 124 of file nsTextTransformer.h.

Definition at line 125 of file nsTextTransformer.h.


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