|
Mixe for Privacy and Anonymity in the Internet
|
#include <DOM_Output.hpp>
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. | |
| UINT8 * | dumpMem (UINT32 *size, OUTPUT_FORMAT a_outputFormat) |
| Returns a Copy of the XML-chars. | |
Private Attributes | |
| CAQueue * | m_pQueue |
| UINT8 * | m_Buff |
| UINT32 | m_aktIndex |
Definition at line 35 of file DOM_Output.hpp.
| MemFormatTarget::MemFormatTarget | ( | ) | [inline] |
Definition at line 39 of file DOM_Output.hpp.
References m_aktIndex, m_Buff, m_pQueue, and MEM_FORMART_TARGET_SPACE.
{
m_pQueue=new CAQueue();
m_Buff=new UINT8[MEM_FORMART_TARGET_SPACE];
m_aktIndex=0;
}
| MemFormatTarget::~MemFormatTarget | ( | ) | [inline] |
| SINT32 MemFormatTarget::dumpMem | ( | UINT8 * | buff, |
| UINT32 * | size | ||
| ) | [inline] |
Copys the XML-chars into buff.
| buff | buffer in which to copy the XML-chars |
| size | contains the size of buff, on return contains the number of XML-CHars copied |
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;
}
| UINT8* MemFormatTarget::dumpMem | ( | UINT32 * | size, |
| OUTPUT_FORMAT | a_outputFormat | ||
| ) | [inline] |
Returns a Copy of the XML-chars.
| size | on return contains the number of XML-Chars copied |
| a_outputFormat | defines an output format for the generated character array |
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;
}
| 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;
}
}
}
UINT32 MemFormatTarget::m_aktIndex [private] |
Definition at line 146 of file DOM_Output.hpp.
Referenced by dumpMem(), MemFormatTarget(), and writeChars().
UINT8* MemFormatTarget::m_Buff [private] |
Definition at line 145 of file DOM_Output.hpp.
Referenced by dumpMem(), MemFormatTarget(), writeChars(), and ~MemFormatTarget().
CAQueue* MemFormatTarget::m_pQueue [private] |
Definition at line 144 of file DOM_Output.hpp.
Referenced by dumpMem(), MemFormatTarget(), writeChars(), and ~MemFormatTarget().
1.7.6.1