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

#include <DOM_Output.hpp>

Inheritance diagram for MemFormatTarget:
Collaboration diagram for MemFormatTarget:

Public Member Functions

 MemFormatTarget ()
 
virtual ~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. More...
 
UINT8dumpMem (UINT32 *size, OUTPUT_FORMAT a_outputFormat)
 Returns a Copy of the XML-chars. More...
 

Private Attributes

CAQueuem_pQueue
 
UINT8m_Buff
 
UINT32 m_aktIndex
 

Detailed Description

Definition at line 35 of file DOM_Output.hpp.

Constructor & Destructor Documentation

◆ MemFormatTarget()

MemFormatTarget::MemFormatTarget ( )
inline

Definition at line 39 of file DOM_Output.hpp.

40  {
41  m_pQueue=new CAQueue();
43  m_aktIndex=0;
44  }
#define MEM_FORMART_TARGET_SPACE
Definition: DOM_Output.hpp:37
unsigned char UINT8
Definition: basetypedefs.h:135
This is a simple FIFO-Queue.
Definition: CAQueue.hpp:50
CAQueue * m_pQueue
Definition: DOM_Output.hpp:144

References m_aktIndex, m_Buff, m_pQueue, and MEM_FORMART_TARGET_SPACE.

◆ ~MemFormatTarget()

virtual MemFormatTarget::~MemFormatTarget ( )
inlinevirtual

Definition at line 46 of file DOM_Output.hpp.

47  {
48  delete m_pQueue;
49  m_pQueue = NULL;
50  delete[] m_Buff;
51  m_Buff = NULL;
52  }

References m_Buff, and m_pQueue.

Member Function Documentation

◆ dumpMem() [1/2]

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.

110  {
111  if(size==NULL)
112  return NULL;
114  return NULL;
115  m_aktIndex=0;
116  *size=m_pQueue->getSize();
117  if (OF_NULL_TERMINATED == a_outputFormat)
118  {
119  *size += 1;
120  }
121  else if (OF_NEWLINE == a_outputFormat)
122  {
123  *size += 2;
124  }
125  UINT8* tmp=new UINT8[*size];
126  if(m_pQueue->peek(tmp,size)!=E_SUCCESS)
127  {
128  delete[] tmp;
129  tmp = NULL;
130  }
131  if (OF_NULL_TERMINATED == a_outputFormat)
132  {
133  tmp[*size] =0;
134  }
135  else if (OF_NEWLINE == a_outputFormat)
136  {
137  tmp[*size] = '\n';
138  tmp[*size+1] = 0;
139  }
140  return tmp;
141  }
@ OF_NULL_TERMINATED
Definition: DOM_Output.hpp:33
@ OF_NEWLINE
Definition: DOM_Output.hpp:33
SINT32 add(const void *buff, UINT32 size)
Adds data to the Queue.
Definition: CAQueue.cpp:76
SINT32 peek(UINT8 *pbuff, UINT32 *psize)
Peeks data from the Queue.
Definition: CAQueue.cpp:258
UINT32 getSize()
Returns the size of stored data in byte.
Definition: CAQueue.hpp:101
const SINT32 E_SUCCESS
Definition: errorcodes.hpp:2

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

Here is the call graph for this function:

◆ dumpMem() [2/2]

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.

90  {
91  if(buff==NULL||size==NULL)
92  return E_UNKNOWN;
94  return E_UNKNOWN;
95  m_aktIndex=0;
96  if(*size<m_pQueue->getSize())
97  return E_SPACE;
98  if(m_pQueue->peek(buff,size)!=E_SUCCESS)
99  return E_UNKNOWN;
100  return E_SUCCESS;
101  }
#define E_SPACE
Definition: errorcodes.hpp:7
#define E_UNKNOWN
Definition: errorcodes.hpp:3

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeChars()

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

Definition at line 55 of file DOM_Output.hpp.

59  {
60  const XMLByte* write=toWrite;
61  UINT32 c=count;
62  while(c>0)
63  {
65  if(space>=c)
66  {
67  memcpy(m_Buff+m_aktIndex,write,c);
68  m_aktIndex+=c;
69  return;
70  }
71  else
72  {
73  memcpy(m_Buff+m_aktIndex,write,space);
74  write+=space;
75  c-=space;
77  m_aktIndex=0;
78  }
79  }
80  }
unsigned int UINT32
Definition: basetypedefs.h:131

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

Here is the call graph for this function:

Member Data Documentation

◆ m_aktIndex

UINT32 MemFormatTarget::m_aktIndex
private

Definition at line 146 of file DOM_Output.hpp.

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

◆ m_Buff

UINT8* MemFormatTarget::m_Buff
private

Definition at line 145 of file DOM_Output.hpp.

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

◆ m_pQueue

CAQueue* MemFormatTarget::m_pQueue
private

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: