Skip to content
Snippets Groups Projects
Commit 333b2dc7 authored by PeiYong Zhang's avatar PeiYong Zhang
Browse files

data member changed, reset() added.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173798 13f79535-47bb-0310-9956-ffa450edef68
parent afac806d
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
* Revision 1.2 2002/06/05 15:47:13 peiyongz
* data member changed, reset() added.
*
* Revision 1.1 2002/05/28 22:40:46 peiyongz
* DOM3 Save Interface: DOMWriter/DOMWriterFilter
*
......@@ -66,14 +69,11 @@
#include <xercesc/util/XMLString.hpp>
MemBufFormatTarget::MemBufFormatTarget()
:fDataBuf(0)
{
fDataBuf = new XMLBuffer();
}
MemBufFormatTarget::~MemBufFormatTarget()
{
delete fDataBuf;
}
void MemBufFormatTarget::writeChars(const XMLByte* const toWrite
......@@ -83,21 +83,26 @@ void MemBufFormatTarget::writeChars(const XMLByte* const toWrite
//
// The toWrite may not be null terminated,
// so we need to do some extra work here
//
//
XMLByte lastChar = toWrite[count]; // preserve the last char
XMLByte* tmpBuf = (XMLByte *)toWrite;
tmpBuf[count] = 0;
XMLCh* transBuf = XMLString::transcode((char *) tmpBuf);
fDataBuf->append(transBuf, XMLString::stringLen(transBuf));
delete[] transBuf;
fDataBuf.append(transBuf, XMLString::stringLen(transBuf));
delete[] transBuf;
tmpBuf[count] = lastChar; // restore the last char
}
XMLCh* MemBufFormatTarget::getString() const
{
return XMLString::replicate(fDataBuf->getRawBuffer());
return XMLString::replicate(fDataBuf.getRawBuffer());
}
void MemBufFormatTarget::reset()
{
fDataBuf.reset();
}
......@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
* Revision 1.2 2002/06/05 15:47:13 peiyongz
* data member changed, reset() added.
*
* Revision 1.1 2002/05/28 22:40:46 peiyongz
* DOM3 Save Interface: DOMWriter/DOMWriterFilter
*
......@@ -88,21 +91,33 @@ public:
// Getter
// -----------------------------------------------------------------------
/** @name getString */
/**
* caller owns the returned string and is accountable
* for the memory release
*/
//@{
/**
* Returned the internal string buffer.
*
* Caller owns the returned string and is accountable
* for the memory release
*/
XMLCh* getString() const;
//@}
/** @name reset */
//@{
/**
* Reset the internal string buffer.
*
*/
void reset();
//@}
private:
// -----------------------------------------------------------------------
// Unimplemented methods.
// -----------------------------------------------------------------------
MemBufFormatTarget(const MemBufFormatTarget& other);
void operator=(const MemBufFormatTarget& rhs);
MemBufFormatTarget(const MemBufFormatTarget&);
MemBufFormatTarget& operator=(const MemBufFormatTarget&);
XMLBuffer *fDataBuf;
XMLBuffer fDataBuf;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment