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

418 lines
23 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.1 -->
<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 id="current"><a href="classes.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</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="nav">
<a class="el" href="namespacexercesc.html">xercesc</a>::<a class="el" href="classxercesc_1_1MemBufInputSource.html">MemBufInputSource</a></div>
<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">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>
Inheritance diagram for xercesc::MemBufInputSource:<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 href="classxercesc_1_1InputSource.html" shape="rect" coords="33,82,196,106" alt="">
<area href="classxercesc_1_1XMemory.html" shape="rect" coords="41,7,188,31" alt="">
</map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><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">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#12e9b809f29882afb3d472a9e7d2fd65">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="#12e9b809f29882afb3d472a9e7d2fd65"></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#29770f293ebf71a35d76bbd52411e874">resetMemBufInputSource</a> (const XMLByte *const srcDocBytes, const unsigned int byteCount)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This methods allows the <a class="el" href="classxercesc_1_1MemBufInputSource.html">MemBufInputSource</a> to be used for more than one input source, instead of destructing/constructing another <a class="el" href="classxercesc_1_1MemBufInputSource.html">MemBufInputSource</a>. <a href="#29770f293ebf71a35d76bbd52411e874"></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">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">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.
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="edc17d384233bf736474b4b7271e3e76"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="edc17d384233bf736474b4b7271e3e76" args="(const XMLByte *const srcDocBytes, const unsigned int 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 unsigned int&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="88e791b5c8573f5c1d3d3b975fba9175"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="88e791b5c8573f5c1d3d3b975fba9175" args="(const XMLByte *const srcDocBytes, const unsigned int 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 unsigned int&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>
<a class="anchor" name="edc17d384233bf736474b4b7271e3e76"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="edc17d384233bf736474b4b7271e3e76" args="(const XMLByte *const srcDocBytes, const unsigned int 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 unsigned int&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="88e791b5c8573f5c1d3d3b975fba9175"></a><!-- doxytag: member="xercesc::MemBufInputSource::MemBufInputSource" ref="88e791b5c8573f5c1d3d3b975fba9175" args="(const XMLByte *const srcDocBytes, const unsigned int 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 unsigned int&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="12e9b809f29882afb3d472a9e7d2fd65"></a><!-- doxytag: member="xercesc::MemBufInputSource::makeStream" ref="12e9b809f29882afb3d472a9e7d2fd65" 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">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#58559673267865caf4090fcb881e9f2f">xercesc::InputSource</a>.
</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="29770f293ebf71a35d76bbd52411e874"></a><!-- doxytag: member="xercesc::MemBufInputSource::resetMemBufInputSource" ref="29770f293ebf71a35d76bbd52411e874" args="(const XMLByte *const srcDocBytes, const unsigned int 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 unsigned int&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">MemBufInputSource</a> to be used for more than one input source, instead of destructing/constructing another <a class="el" href="classxercesc_1_1MemBufInputSource.html">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>
<hr size="1"><address style="align: right;"><small>Generated on Wed Dec 12 20:17:02 2007 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.1 </small></address>
</body>
</html>