Mixe for Privacy and Anonymity in the Internet
Public Member Functions | Private Attributes
MemFormatTarget Class Reference

#include <DOM_Output.hpp>

Collaboration diagram for MemFormatTarget:
[legend]

List of all members.

Public Member Functions

 MemFormatTarget ()
 ~MemFormatTarget ()
virtual void writeChars (const XMLByte *const toWrite, const unsigned int count, XMLFormatter *const )
SINT32 dumpMem (UINT8 *buff, UINT32 *size)
 Copys the XML-chars into buff.
UINT8dumpMem (UINT32 *size, OUTPUT_FORMAT a_outputFormat)
 Returns a Copy of the XML-chars.

Private Attributes

CAQueuem_pQueue
UINT8m_Buff
UINT32 m_aktIndex

Detailed Description

Definition at line 35 of file DOM_Output.hpp.


Constructor & Destructor Documentation

Definition at line 46 of file DOM_Output.hpp.

References m_Buff, and m_pQueue.

        {
          delete m_pQueue;
          m_pQueue = NULL;
          delete[] m_Buff;
          m_Buff = NULL;
        }

Member Function Documentation

SINT32 MemFormatTarget::dumpMem ( UINT8 buff,
UINT32 size 
) [inline]

Copys the XML-chars into buff.

Parameters:
buffbuffer in which to copy the XML-chars
sizecontains the size of buff, on return contains the number of XML-CHars copied
Returns:
E_SUCCESS, if successful
E_SPACE, if buff is to small
E_UNKNOWN, if an error occurs

Definition at line 89 of file DOM_Output.hpp.

References CAQueue::add(), E_SPACE, E_SUCCESS, E_UNKNOWN, m_aktIndex, m_Buff, m_pQueue, and CAQueue::peek().

Referenced by DOM_Output::dumpToMem(), and DOM_Output::makeCanonical().

        {
          if(buff==NULL||size==NULL)
            return E_UNKNOWN;
          if(m_aktIndex>0&&m_pQueue->add(m_Buff,m_aktIndex)!=E_SUCCESS)
            return E_UNKNOWN;
          m_aktIndex=0;
          if(*size<m_pQueue->getSize())
            return E_SPACE;
          if(m_pQueue->peek(buff,size)!=E_SUCCESS)
            return E_UNKNOWN;
          return E_SUCCESS;
        }

Here is the call graph for this function:

UINT8* MemFormatTarget::dumpMem ( UINT32 size,
OUTPUT_FORMAT  a_outputFormat 
) [inline]

Returns a Copy of the XML-chars.

Parameters:
sizeon return contains the number of XML-Chars copied
a_outputFormatdefines an output format for the generated character array
Returns:
a pointer to a newls allocated buff, which must be delete[] by the caller
NULL if an error occurs

Definition at line 109 of file DOM_Output.hpp.

References CAQueue::add(), E_SUCCESS, CAQueue::getSize(), m_aktIndex, m_Buff, m_pQueue, OF_NEWLINE, OF_NULL_TERMINATED, and CAQueue::peek().

        {
          if(size==NULL)
            return NULL;
          if(m_aktIndex>0&&m_pQueue->add(m_Buff,m_aktIndex)!=E_SUCCESS)
            return NULL;
          m_aktIndex=0;
          *size=m_pQueue->getSize();
          if (OF_NULL_TERMINATED == a_outputFormat)
          {
            *size += 1;
          }
          else if (OF_NEWLINE == a_outputFormat)
          {
            *size += 2;
          }
          UINT8* tmp=new UINT8[*size];
          if(m_pQueue->peek(tmp,size)!=E_SUCCESS)
            {
              delete[] tmp;
              tmp = NULL;
            }
          if (OF_NULL_TERMINATED == a_outputFormat)
          {
            tmp[*size] = NULL;
          }
          else if (OF_NEWLINE == a_outputFormat)
          {
            tmp[*size+1] = NULL;
            tmp[*size] = '\n';
          }
          return tmp;
        }

Here is the call graph for this function:

virtual void MemFormatTarget::writeChars ( const XMLByte *const  toWrite,
const unsigned int  count,
XMLFormatter *  const 
) [inline, virtual]

Definition at line 55 of file DOM_Output.hpp.

References CAQueue::add(), m_aktIndex, m_Buff, m_pQueue, and MEM_FORMART_TARGET_SPACE.

        {
          const XMLByte* write=toWrite;
          UINT32 c=count;
          while(c>0)
            {
              UINT32 space=MEM_FORMART_TARGET_SPACE-m_aktIndex;
              if(space>=c)
                {
                  memcpy(m_Buff+m_aktIndex,write,c);
                  m_aktIndex+=c;
                  return;
                }
              else
                {
                  memcpy(m_Buff+m_aktIndex,write,space);
                  write+=space;
                  c-=space;
                  m_pQueue->add(m_Buff,MEM_FORMART_TARGET_SPACE);
                  m_aktIndex=0;
                }
            }
        }

Here is the call graph for this function:


Member Data Documentation

Definition at line 146 of file DOM_Output.hpp.

Referenced by dumpMem(), MemFormatTarget(), and writeChars().

Definition at line 145 of file DOM_Output.hpp.

Referenced by dumpMem(), MemFormatTarget(), writeChars(), and ~MemFormatTarget().

Definition at line 144 of file DOM_Output.hpp.

Referenced by dumpMem(), MemFormatTarget(), writeChars(), and ~MemFormatTarget().


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