Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > b3a1f4d91c26f535919e39e25606614a > files > 1900

wt-doc-3.2.3-1.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Wt: Wt::WMemoryResource Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="namespaceWt.html">Wt</a>      </li>
      <li class="navelem"><a class="el" href="classWt_1_1WMemoryResource.html">WMemoryResource</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">Wt::WMemoryResource Class Reference</div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="Wt::WMemoryResource" --><!-- doxytag: inherits="Wt::WResource" -->
<p>A resource which streams data from memory.  
 <a href="classWt_1_1WMemoryResource.html#details">More...</a></p>

<p><code>#include &lt;Wt/WMemoryResource&gt;</code></p>
<div class="dynheader">
Inheritance diagram for Wt::WMemoryResource:</div>
<div class="dyncontent">
<div class="center"><img src="classWt_1_1WMemoryResource__inherit__graph.png" border="0" usemap="#Wt_1_1WMemoryResource_inherit__map" alt="Inheritance graph"/></div>
<map name="Wt_1_1WMemoryResource_inherit__map" id="Wt_1_1WMemoryResource_inherit__map">
<area shape="rect" href="classWt_1_1WResource.html" title="An object which can be rendered in the HTTP protocol." alt="" coords="28,80,143,107"/><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="37,5,133,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classWt_1_1WMemoryResource-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a70c4b30cfef23b4a1ae692a4c90ead2b">WMemoryResource</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new resource.  <a href="#a70c4b30cfef23b4a1ae692a4c90ead2b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a8e72d3dae82e6c1a417bdc8a0439ab34">WMemoryResource</a> (const std::string &amp;mimeType, <a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new resource with given mime-type.  <a href="#a8e72d3dae82e6c1a417bdc8a0439ab34"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2060c05ef2cb27ef6d7a5cf204a053f5"></a><!-- doxytag: member="Wt::WMemoryResource::WMemoryResource" ref="a2060c05ef2cb27ef6d7a5cf204a053f5" args="(const std::string &amp;mimeType, const std::vector&lt; unsigned char &gt; &amp;data, WObject *parent=0)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a2060c05ef2cb27ef6d7a5cf204a053f5">WMemoryResource</a> (const std::string &amp;mimeType, const std::vector&lt; unsigned char &gt; &amp;data, <a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new resource with given mime-type and data. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a330bf924bd2d01de7dfce15778b56d48"></a><!-- doxytag: member="Wt::WMemoryResource::setData" ref="a330bf924bd2d01de7dfce15778b56d48" args="(const std::vector&lt; unsigned char &gt; &amp;data)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a330bf924bd2d01de7dfce15778b56d48">setData</a> (const std::vector&lt; unsigned char &gt; &amp;data)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets new data for the resource to serve. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a9ad4324110014390132405e941c9c87c">setData</a> (const unsigned char *data, int count)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets new data for the resource to serve.  <a href="#a9ad4324110014390132405e941c9c87c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab5c0d0fc5fb3db1cb10e8be8909733f5"></a><!-- doxytag: member="Wt::WMemoryResource::data" ref="ab5c0d0fc5fb3db1cb10e8be8909733f5" args="() const " -->
const std::vector&lt; unsigned <br class="typebreak"/>
char &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#ab5c0d0fc5fb3db1cb10e8be8909733f5">data</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the data this resource will serve. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00b0908ba8be1c51ba964a31d6d43712"></a><!-- doxytag: member="Wt::WMemoryResource::mimeType" ref="a00b0908ba8be1c51ba964a31d6d43712" args="() const " -->
const std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a00b0908ba8be1c51ba964a31d6d43712">mimeType</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the mime-type. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a057ea5ac18daacf2894c28e5bfbbde60"></a><!-- doxytag: member="Wt::WMemoryResource::setMimeType" ref="a057ea5ac18daacf2894c28e5bfbbde60" args="(const std::string &amp;mimeType)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a057ea5ac18daacf2894c28e5bfbbde60">setMimeType</a> (const std::string &amp;mimeType)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the mime-type. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMemoryResource.html#a7800a19988ddf5af4e4ffe0f323316ae">handleRequest</a> (const <a class="el" href="classWt_1_1Http_1_1Request.html">Http::Request</a> &amp;request, <a class="el" href="classWt_1_1Http_1_1Response.html">Http::Response</a> &amp;response)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Handles a request.  <a href="#a7800a19988ddf5af4e4ffe0f323316ae"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A resource which streams data from memory. </p>
<p>Use this resource if you want to serve resource data from memory. This is suitable for relatively small resources, which still require some computation.</p>
<p>If creating the data requires computation which you would like to post-pone until the resource is served, then you may want to directly reimplement <a class="el" href="classWt_1_1WResource.html" title="An object which can be rendered in the HTTP protocol.">WResource</a> instead and compute the data on the fly while streaming.</p>
<p>Usage examples: </p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WMemoryResource.html" title="A resource which streams data from memory.">Wt::WMemoryResource</a> *imageResource = <span class="keyword">new</span> <a class="code" href="classWt_1_1WMemoryResource.html#a70c4b30cfef23b4a1ae692a4c90ead2b" title="Creates a new resource.">Wt::WMemoryResource</a>(<span class="stringliteral">&quot;image/gif&quot;</span>, <span class="keyword">this</span>);

 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> gifData[]
    = { 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00,
        0x80, 0x00, 0x00, 0xdb, 0xdf, 0xef, 0x00, 0x00, 0x00, 0x21,
        0xf9, 0x04, 0x01, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00,
        0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44,
        0x01, 0x00, 0x3b };

 imageResource-&gt;<a class="code" href="classWt_1_1WMemoryResource.html#a330bf924bd2d01de7dfce15778b56d48" title="Sets new data for the resource to serve.">setData</a>(gifData, 43);
 <a class="code" href="classWt_1_1WImage.html" title="A widget that displays an image.">Wt::WImage</a> *image = <span class="keyword">new</span> <a class="code" href="classWt_1_1WImage.html" title="A widget that displays an image.">Wt::WImage</a>(imageResource, <span class="stringliteral">&quot;1 transparent pixel&quot;</span>);
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WFileResource.html" title="A resource which streams the data from a local file.">WFileResource</a>. </dd></dl>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a70c4b30cfef23b4a1ae692a4c90ead2b"></a><!-- doxytag: member="Wt::WMemoryResource::WMemoryResource" ref="a70c4b30cfef23b4a1ae692a4c90ead2b" args="(WObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Wt::WMemoryResource::WMemoryResource </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a new resource. </p>
<p>You must call <a class="el" href="classWt_1_1WMemoryResource.html#a057ea5ac18daacf2894c28e5bfbbde60" title="Sets the mime-type.">setMimeType()</a> and <a class="el" href="classWt_1_1WMemoryResource.html#a330bf924bd2d01de7dfce15778b56d48" title="Sets new data for the resource to serve.">setData()</a> before using the resource. </p>

</div>
</div>
<a class="anchor" id="a8e72d3dae82e6c1a417bdc8a0439ab34"></a><!-- doxytag: member="Wt::WMemoryResource::WMemoryResource" ref="a8e72d3dae82e6c1a417bdc8a0439ab34" args="(const std::string &amp;mimeType, WObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Wt::WMemoryResource::WMemoryResource </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>mimeType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Creates a new resource with given mime-type. </p>
<p>You must call <a class="el" href="classWt_1_1WMemoryResource.html#a330bf924bd2d01de7dfce15778b56d48" title="Sets new data for the resource to serve.">setData()</a> before using the resource. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a7800a19988ddf5af4e4ffe0f323316ae"></a><!-- doxytag: member="Wt::WMemoryResource::handleRequest" ref="a7800a19988ddf5af4e4ffe0f323316ae" args="(const Http::Request &amp;request, Http::Response &amp;response)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WMemoryResource::handleRequest </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classWt_1_1Http_1_1Request.html">Http::Request</a> &amp;&#160;</td>
          <td class="paramname"><em>request</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classWt_1_1Http_1_1Response.html">Http::Response</a> &amp;&#160;</td>
          <td class="paramname"><em>response</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Handles a request. </p>
<p>Reimplement this method so that a proper response is generated for the given request. From the <code>request</code> object you can access request parameters and whether the request is a continuation request. In the <code>response</code> object, you should set the mime type and stream the output data.</p>
<p>A request may also concern a continuation, indicated in <a class="el" href="classWt_1_1Http_1_1Request.html#a2d4f88961a222be846460a8238823ae0" title="Returns a continuation object.">Http::Request::continuation()</a>, in which case the next part for a previously created continuation should be served.</p>
<p>While handling a request, which may happen at any time together with event handling, the library makes sure that the resource is not being concurrently deleted, but multiple requests may happend simultaneously for a single resource. </p>

<p>Implements <a class="el" href="classWt_1_1WResource.html#a3a740f8cc29e2e6e4e58defc9c88b8b6">Wt::WResource</a>.</p>

</div>
</div>
<a class="anchor" id="a9ad4324110014390132405e941c9c87c"></a><!-- doxytag: member="Wt::WMemoryResource::setData" ref="a9ad4324110014390132405e941c9c87c" args="(const unsigned char *data, int count)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WMemoryResource::setData </td>
          <td>(</td>
          <td class="paramtype">const unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>count</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Sets new data for the resource to serve. </p>
<p>Sets the data from using the first <code>count</code> bytes from the C-style <code>data</code> array. </p>

</div>
</div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>