Back to index

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

#include <nsEudoraCompose.h>

List of all members.

Public Member Functions

 SimpleBufferTonyRCopiedOnce ()
 ~SimpleBufferTonyRCopiedOnce ()
PRBool Allocate (PRInt32 sz)
PRBool Grow (PRInt32 newSize)
PRBool ReAllocate (PRInt32 newSize)
PRBool Write (PRInt32 offset, const char *pData, PRInt32 len, PRInt32 *pWritten)
PRBool Write (const char *pData, PRInt32 len)
PRBool SpecialMemCpy (PRInt32 offset, const char *pData, PRInt32 len, PRInt32 *pWritten)

Public Attributes

PRBool m_convertCRs
char * m_pBuffer
PRInt32 m_bytesInBuf
PRInt32 m_size
PRInt32 m_growBy
PRInt32 m_writeOffset

Detailed Description

Definition at line 72 of file nsEudoraCompose.h.


Constructor & Destructor Documentation

Definition at line 74 of file nsEudoraCompose.h.

Definition at line 76 of file nsEudoraCompose.h.

{ if (m_pBuffer) delete [] m_pBuffer;}

Member Function Documentation

Definition at line 78 of file nsEudoraCompose.h.

                                    { 
              if (m_pBuffer) delete [] m_pBuffer; 
              m_pBuffer = new char[sz]; 
              if (m_pBuffer) { m_size = sz; return( PR_TRUE); }
              else { m_size = 0; return( PR_FALSE);}
       }

Here is the caller graph for this function:

Definition at line 85 of file nsEudoraCompose.h.

{ if (newSize > m_size) return( ReAllocate( newSize)); else return( PR_TRUE);}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 86 of file nsEudoraCompose.h.

                                           {
              if (newSize <= m_size) return( PR_TRUE);
              char *pOldBuffer = m_pBuffer;
              PRInt32       oldSize = m_size;
              m_pBuffer = nsnull;
              while (m_size < newSize) m_size += m_growBy;
              if (Allocate( m_size)) {
                     if (pOldBuffer) { memcpy( m_pBuffer, pOldBuffer, oldSize); delete [] pOldBuffer;}
                     return( PR_TRUE);
              }
              else { m_pBuffer = pOldBuffer; m_size = oldSize; return( PR_FALSE);}
       }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool SimpleBufferTonyRCopiedOnce::SpecialMemCpy ( PRInt32  offset,
const char *  pData,
PRInt32  len,
PRInt32 pWritten 
)

Definition at line 802 of file nsEudoraCompose.cpp.

{
       // Arg!!!!!  Mozilla can't handle plain CRs in any mail messages.  Particularly a 
       // problem with Eudora since it doesn't give a rats a**
       *pWritten = len;
       PRInt32       sz = offset + len;
       if (offset) {
              if ((m_pBuffer[offset - 1] == 0x0D) && (*pData != 0x0A)) {
                     sz++;
                     if (!Grow( sz)) return( PR_FALSE);
                     m_pBuffer[offset] = 0x0A;
                     offset++;
                     (*pWritten)++;
              }
       }
       while (len > 0) {
              if ((*pData == 0x0D) && (*(pData + 1) != 0x0A)) {
                     sz++;
                     if (!Grow( sz)) return( PR_FALSE);
                     m_pBuffer[offset] = 0x0D;
                     offset++;
                     m_pBuffer[offset] = 0x0A;                                                    
                     (*pWritten)++;
              }
              else {
                     m_pBuffer[offset] = *pData;
              }
              offset++;
              pData++;
              len--;
       }
       
       return( PR_TRUE);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool SimpleBufferTonyRCopiedOnce::Write ( PRInt32  offset,
const char *  pData,
PRInt32  len,
PRInt32 pWritten 
) [inline]

Definition at line 99 of file nsEudoraCompose.h.

                                                                                        {
              *pWritten = len;
              if (!len) return( PR_TRUE);
              if (!Grow( offset + len)) return( PR_FALSE);
              if (m_convertCRs)
                     return( SpecialMemCpy( offset, pData, len, pWritten));
              memcpy( m_pBuffer + offset, pData, len);
              return( PR_TRUE);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool SimpleBufferTonyRCopiedOnce::Write ( const char *  pData,
PRInt32  len 
) [inline]

Definition at line 109 of file nsEudoraCompose.h.

                                                     { 
              PRInt32 written;
              if (Write( m_writeOffset, pData, len, &written)) { m_writeOffset += written; return( PR_TRUE);}
              else return( PR_FALSE);
       }

Here is the call graph for this function:


Member Data Documentation

Definition at line 119 of file nsEudoraCompose.h.

Definition at line 117 of file nsEudoraCompose.h.

Definition at line 121 of file nsEudoraCompose.h.

Definition at line 118 of file nsEudoraCompose.h.

Definition at line 120 of file nsEudoraCompose.h.

Definition at line 122 of file nsEudoraCompose.h.


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