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

346 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: xercesc::MemBufInputSource Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.6 -->
<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="31,84,181,108" alt="">
<area href="classxercesc_1_1XMemory.html" shape="rect" coords="39,9,173,33" 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">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#edc17d384233bf736474b4b7271e3e76">MemBufInputSource</a> (const XMLByte *const srcDocBytes, const unsigned int 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="#edc17d384233bf736474b4b7271e3e76"></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#88e791b5c8573f5c1d3d3b975fba9175">MemBufInputSource</a> (const XMLByte *const srcDocBytes, const unsigned int 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="#88e791b5c8573f5c1d3d3b975fba9175"></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#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)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">xercesc::MemBufInputSource::MemBufInputSource </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const XMLByte *const &nbsp;</td>
<td class="mdname" nowrap> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const unsigned int&nbsp;</td>
<td class="mdname" nowrap> <em>byteCount</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const XMLCh *const &nbsp;</td>
<td class="mdname" nowrap> <em>bufId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const bool&nbsp;</td>
<td class="mdname" nowrap> <em>adoptBuffer</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const &nbsp;</td>
<td class="mdname" nowrap> <em>manager</em> = <code><a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a></code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<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>
</td>
</tr>
</table>
<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)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">xercesc::MemBufInputSource::MemBufInputSource </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const XMLByte *const &nbsp;</td>
<td class="mdname" nowrap> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const unsigned int&nbsp;</td>
<td class="mdname" nowrap> <em>byteCount</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const char *const &nbsp;</td>
<td class="mdname" nowrap> <em>bufId</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const bool&nbsp;</td>
<td class="mdname" nowrap> <em>adoptBuffer</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="classxercesc_1_1MemoryManager.html">MemoryManager</a> *const &nbsp;</td>
<td class="mdname" nowrap> <em>manager</em> = <code><a class="el" href="classxercesc_1_1XMLPlatformUtils.html#2521473ea52894e9313573d330a264b4">XMLPlatformUtils::fgMemoryManager</a></code></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<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>
</td>
</tr>
</table>
<a class="anchor" name="0af721882921667f44881403ad977cc3"></a><!-- doxytag: member="xercesc::MemBufInputSource::~MemBufInputSource" ref="0af721882921667f44881403ad977cc3" args="()" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">xercesc::MemBufInputSource::~MemBufInputSource </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
If the buffer was adopted, the copy made during construction is deleted at this point.
<p>
</td>
</tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="6763b5370b2b83eb987fa43dc8f31301"></a><!-- doxytag: member="xercesc::MemBufInputSource::makeStream" ref="6763b5370b2b83eb987fa43dc8f31301" args="() const " --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">BinInputStream* xercesc::MemBufInputSource::makeStream </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap> const<code> [virtual]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<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 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>. </td>
</tr>
</table>
<a class="anchor" name="29770f293ebf71a35d76bbd52411e874"></a><!-- doxytag: member="xercesc::MemBufInputSource::resetMemBufInputSource" ref="29770f293ebf71a35d76bbd52411e874" args="(const XMLByte *const srcDocBytes, const unsigned int byteCount)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void xercesc::MemBufInputSource::resetMemBufInputSource </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const XMLByte *const &nbsp;</td>
<td class="mdname" nowrap> <em>srcDocBytes</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>const unsigned int&nbsp;</td>
<td class="mdname" nowrap> <em>byteCount</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<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>
</td>
</tr>
</table>
<a class="anchor" name="9efbedc3d265c066bc6fa65530ab7e75"></a><!-- doxytag: member="xercesc::MemBufInputSource::setCopyBufToStream" ref="9efbedc3d265c066bc6fa65530ab7e75" args="(const bool newState)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void xercesc::MemBufInputSource::setCopyBufToStream </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const bool&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>newState</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap><code> [inline]</code></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<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>
</td>
</tr>
</table>
<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 Mon Feb 12 16:52:07 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.4.6 </small></address>
</body>
</html>