XQuilla/docs/simple-api/classxercesc_1_1MemBufInputSource.html
2020-02-17 22:17:06 +01:00

308 lines
20 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>XQilla Simple API Documentation</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<a style="float:right;" href="http://sourceforge.net/projects/xqilla"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=152021&amp;type=2" border="0" alt="SourceForge.net Logo" /></a>
<!-- Generated by Doxygen 1.5.5 -->
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="classes.html"><span>Alphabetical&nbsp;List</span></a></li>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespacexercesc.html">xercesc</a>::<a class="el" href="classxercesc_1_1MemBufInputSource.html">MemBufInputSource</a>
</div>
</div>
<div class="contents">
<h1>xercesc::MemBufInputSource Class Reference</h1><!-- doxytag: class="xercesc::MemBufInputSource" --><!-- doxytag: inherits="xercesc::InputSource" -->This class is a derivative of the standard <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> class.
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="MemBufInputSource_8hpp-source.html">MemBufInputSource.hpp</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for xercesc::MemBufInputSource:</div>
<div class="dynsection">
<p><center><img src="classxercesc_1_1MemBufInputSource__inherit__graph.png" border="0" usemap="#xercesc_1_1MemBufInputSource__inherit__map" alt="Inheritance graph"></center>
<map name="xercesc_1_1MemBufInputSource__inherit__map">
<area shape="rect" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity." alt="" coords="31,82,175,106"><area shape="rect" href="classxercesc_1_1XMemory.html" title="This class makes it possible to override the C++ memory management by adding new/delete..." alt="" coords="37,7,168,31"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classxercesc_1_1MemBufInputSource-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td colspan="2"><div class="groupHeader">Constructors</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#aa8bd9496d65679b79bb16043309a6c4">MemBufInputSource</a> (const XMLByte *const srcDocBytes, const XMLSize_t byteCount, const XMLCh *const bufId, const bool adoptBuffer=false, <a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const manager=<a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a>)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A memory buffer input source is constructed from a buffer of byte data, and the count of bytes in that buffer. <a href="#aa8bd9496d65679b79bb16043309a6c4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#66ede45468921b97d2baf175561b9b6d">MemBufInputSource</a> (const XMLByte *const srcDocBytes, const XMLSize_t byteCount, const char *const bufId, const bool adoptBuffer=false, <a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const manager=<a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a>)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This constructor is identical to the previous one, except that it takes the fake system id in local code page form and transcodes it internally. <a href="#66ede45468921b97d2baf175561b9b6d"></a><br></td></tr>
<tr><td colspan="2"><div class="groupHeader">Destructor</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#0af721882921667f44881403ad977cc3">~MemBufInputSource</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If the buffer was adopted, the copy made during construction is deleted at this point. <a href="#0af721882921667f44881403ad977cc3"></a><br></td></tr>
<tr><td colspan="2"><div class="groupHeader">Virtual methods</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">BinInputStream *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#6763b5370b2b83eb987fa43dc8f31301">makeStream</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This method will return a binary input stream derivative that will parse from the memory buffer. <a href="#6763b5370b2b83eb987fa43dc8f31301"></a><br></td></tr>
<tr><td colspan="2"><div class="groupHeader">Setter methods</div></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#9efbedc3d265c066bc6fa65530ab7e75">setCopyBufToStream</a> (const bool newState)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">By default, for safety's sake, each newly created stream from this input source will make its own copy of the buffer to stream from. <a href="#9efbedc3d265c066bc6fa65530ab7e75"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classxercesc_1_1MemBufInputSource.html#745c57b859b4a29d1ab44e13af9eab85">resetMemBufInputSource</a> (const XMLByte *const srcDocBytes, const XMLSize_t byteCount)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This methods allows the <a class="el" href="classxercesc_1_1MemBufInputSource.html" title="This class is a derivative of the standard InputSource class.">MemBufInputSource</a> to be used for more than one input source, instead of destructing/constructing another <a class="el" href="classxercesc_1_1MemBufInputSource.html" title="This class is a derivative of the standard InputSource class.">MemBufInputSource</a>. <a href="#745c57b859b4a29d1ab44e13af9eab85"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
This class is a derivative of the standard <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> class.
<p>
It provides for the parser access to data stored in a memory buffer. The type of buffer and its host specific attributes are of little concern here. The only real requirement is that the memory be readable by the current process.<p>
Note that the memory buffer size is expressed in <b>bytes</b>, not in characters. If you pass it text data, you must account for the bytes per character when indicating the buffer size.<p>
As with all <a class="el" href="classxercesc_1_1InputSource.html" title="A single input source for an XML entity.">InputSource</a> derivatives. The primary objective of an input source is to create an input stream via which the parser can spool in data from the referenced source. In this case, there are two options available.<p>
The passed buffer can be adopted or merely referenced. If it is adopted, then it must be dynamically allocated and will be destroyed when the input source is destroyed (no reference counting!.) If not adopted, the caller must insure that it remains valid until the input source object is destroyed.<p>
The other option indicates whether each stream created for this input source should get its own copy of the data, or whether it should just stream the data directly from this object's copy of the data. The same rules apply here, in that the buffer must either be copied by the stream or it must remain valid until the stream is destroyed. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="aa8bd9496d65679b79bb16043309a6c4"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="aa8bd9496d65679b79bb16043309a6c4" args="(const XMLByte *const srcDocBytes, const XMLSize_t byteCount, const XMLCh *const bufId, const bool adoptBuffer=false, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">xercesc::MemBufInputSource::MemBufInputSource </td>
<td>(</td>
<td class="paramtype">const XMLByte *const &nbsp;</td>
<td class="paramname"> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const XMLSize_t&nbsp;</td>
<td class="paramname"> <em>byteCount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const XMLCh *const &nbsp;</td>
<td class="paramname"> <em>bufId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool&nbsp;</td>
<td class="paramname"> <em>adoptBuffer</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const &nbsp;</td>
<td class="paramname"> <em>manager</em> = <code><a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a></code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
A memory buffer input source is constructed from a buffer of byte data, and the count of bytes in that buffer.
<p>
The parser will parse from this memory buffer until it has eaten the indicated number of bytes.<p>
Note that the system id provided serves two purposes. Firstly it is going to be displayed in error messages as the source of the error. And secondly, any entities which are refered to from this entity via relative paths/URLs will be relative to this fake system id.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>srcDocBytes</em>&nbsp;</td><td>The actual data buffer to be parsed from. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>byteCount</em>&nbsp;</td><td>The count of bytes (not characters, bytes!) in the buffer. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>bufId</em>&nbsp;</td><td>A fake system id for the buffer. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>adoptBuffer</em>&nbsp;</td><td>Indicates whether this object should adopt the buffer (i.e. become responsible for deletion) or just use it in place. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>manager</em>&nbsp;</td><td>Pointer to the memory manager to be used to allocate objects. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="66ede45468921b97d2baf175561b9b6d"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="66ede45468921b97d2baf175561b9b6d" args="(const XMLByte *const srcDocBytes, const XMLSize_t byteCount, const char *const bufId, const bool adoptBuffer=false, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">xercesc::MemBufInputSource::MemBufInputSource </td>
<td>(</td>
<td class="paramtype">const XMLByte *const &nbsp;</td>
<td class="paramname"> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const XMLSize_t&nbsp;</td>
<td class="paramname"> <em>byteCount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *const &nbsp;</td>
<td class="paramname"> <em>bufId</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const bool&nbsp;</td>
<td class="paramname"> <em>adoptBuffer</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const &nbsp;</td>
<td class="paramname"> <em>manager</em> = <code><a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a></code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
This constructor is identical to the previous one, except that it takes the fake system id in local code page form and transcodes it internally.
<p>
</div>
</div><p>
<a class="anchor" name="0af721882921667f44881403ad977cc3"></a><!-- doxytag: member="xercesc::MemBufInputSource::~MemBufInputSource" ref="0af721882921667f44881403ad977cc3" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">xercesc::MemBufInputSource::~MemBufInputSource </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
If the buffer was adopted, the copy made during construction is deleted at this point.
<p>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="6763b5370b2b83eb987fa43dc8f31301"></a><!-- doxytag: member="xercesc::MemBufInputSource::makeStream" ref="6763b5370b2b83eb987fa43dc8f31301" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">BinInputStream* xercesc::MemBufInputSource::makeStream </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
This method will return a binary input stream derivative that will parse from the memory buffer.
<p>
If <a class="el" href="classxercesc_1_1MemBufInputSource.html#9efbedc3d265c066bc6fa65530ab7e75" title="By default, for safety&#39;s sake, each newly created stream from this input source...">setCopyBufToStream()</a> has been set, then the stream will make its own copy. Otherwise, it will use the buffer as is (in which case it must remain valid until the stream is no longer in use, i.e. the parse completes.)<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>A dynamically allocated binary input stream derivative that can parse from the memory buffer. </dd></dl>
<p>Implements <a class="el" href="classxercesc_1_1InputSource.html#9d3101df0ae8a72045f81a7028bc36d8">xercesc::InputSource</a>.</p>
</div>
</div><p>
<a class="anchor" name="9efbedc3d265c066bc6fa65530ab7e75"></a><!-- doxytag: member="xercesc::MemBufInputSource::setCopyBufToStream" ref="9efbedc3d265c066bc6fa65530ab7e75" args="(const bool newState)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xercesc::MemBufInputSource::setCopyBufToStream </td>
<td>(</td>
<td class="paramtype">const bool&nbsp;</td>
<td class="paramname"> <em>newState</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
By default, for safety's sake, each newly created stream from this input source will make its own copy of the buffer to stream from.
<p>
This avoids having to deal with aliasing of the buffer for simple work. But, for higher performance applications or for large buffers, this is obviously not optimal.<p>
In such cases, you can call this method to turn off that default action. Once turned off, the streams will just get a pointer to the buffer and parse directly from that. In this case, you must insure that the buffer remains valid for as long as any parse events are still using it.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>newState</em>&nbsp;</td><td>The new boolean flag state to set. </td></tr>
</table>
</dl>
</div>
</div><p>
<a class="anchor" name="745c57b859b4a29d1ab44e13af9eab85"></a><!-- doxytag: member="xercesc::MemBufInputSource::resetMemBufInputSource" ref="745c57b859b4a29d1ab44e13af9eab85" args="(const XMLByte *const srcDocBytes, const XMLSize_t byteCount)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void xercesc::MemBufInputSource::resetMemBufInputSource </td>
<td>(</td>
<td class="paramtype">const XMLByte *const &nbsp;</td>
<td class="paramname"> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const XMLSize_t&nbsp;</td>
<td class="paramname"> <em>byteCount</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
This methods allows the <a class="el" href="classxercesc_1_1MemBufInputSource.html" title="This class is a derivative of the standard InputSource class.">MemBufInputSource</a> to be used for more than one input source, instead of destructing/constructing another <a class="el" href="classxercesc_1_1MemBufInputSource.html" title="This class is a derivative of the standard InputSource class.">MemBufInputSource</a>.
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>srcDocBytes</em>&nbsp;</td><td>The actual data buffer to be parsed from. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>byteCount</em>&nbsp;</td><td>The count of bytes (not characters, bytes!) in the buffer. </td></tr>
</table>
</dl>
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="MemBufInputSource_8hpp-source.html">MemBufInputSource.hpp</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jan 5 19:54:32 2009 for XQilla Simple API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>