Sophie

Sophie

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

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 examples: /home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C File Reference</title>

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



</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 examples
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">/home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C File Reference</div>  </div>
</div>
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="WtHome_8h_source.html">WtHome.h</a>&quot;</code><br/>
<code>#include &lt;Wt/WAnchor&gt;</code><br/>
<code>#include &lt;Wt/WEnvironment&gt;</code><br/>
<code>#include &lt;<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/WLogger.html">Wt/WLogger</a>&gt;</code><br/>
<code>#include &lt;Wt/WMenuItem&gt;</code><br/>
<code>#include &lt;Wt/WStackedWidget&gt;</code><br/>
<code>#include &lt;Wt/WTable&gt;</code><br/>
<code>#include &lt;Wt/WTabWidget&gt;</code><br/>
<code>#include &lt;Wt/WText&gt;</code><br/>
<code>#include &lt;Wt/WTreeNode&gt;</code><br/>
<code>#include &lt;Wt/WViewWidget&gt;</code><br/>
<code>#include &lt;Wt/WWidget&gt;</code><br/>
<code>#include &quot;<a class="el" href="ExampleSourceViewer_8h_source.html">ExampleSourceViewer.h</a>&quot;</code><br/>
</div>
<p><a href="WtHome_8C_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="WtHome_8C.html#add0ef25910d91a7bd79ffb3c07a9af32">createWtHomeApplication</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a> &amp;env)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="add0ef25910d91a7bd79ffb3c07a9af32"></a><!-- doxytag: member="WtHome.C::createWtHomeApplication" ref="add0ef25910d91a7bd79ffb3c07a9af32" args="(const WEnvironment &amp;env)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>* createWtHomeApplication </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a> &amp;&#160;</td>
          <td class="paramname"><em>env</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="WtHome_8C_source.html#l00170">170</a> of file <a class="el" href="WtHome_8C_source.html">WtHome.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// support for old (&lt; Wt-2.2) homepage URLS: redirect from &quot;states&quot;</span>
  <span class="comment">// to &quot;internal paths&quot;</span>
  <span class="comment">// this contains the initial &quot;history state&quot; in old Wt versions</span>
  <span class="keyword">const</span> std::string *historyKey = env.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html#a3f87915f10f39b18eac28bac65c0cd46">getParameter</a>(<span class="stringliteral">&quot;historyKey&quot;</span>);

  <span class="keywordflow">if</span> (historyKey) {
    <span class="keyword">const</span> <span class="keywordtype">char</span> *mainStr[]
      = { <span class="stringliteral">&quot;main:0&quot;</span>, <span class="stringliteral">&quot;/&quot;</span>,
          <span class="stringliteral">&quot;main:1&quot;</span>, <span class="stringliteral">&quot;/news&quot;</span>,
          <span class="stringliteral">&quot;main:2&quot;</span>, <span class="stringliteral">&quot;/features&quot;</span>,
          <span class="stringliteral">&quot;main:4&quot;</span>, <span class="stringliteral">&quot;/examples&quot;</span>,
          <span class="stringliteral">&quot;main:3&quot;</span>, <span class="stringliteral">&quot;/documentation&quot;</span>,
          <span class="stringliteral">&quot;main:5&quot;</span>, <span class="stringliteral">&quot;/download&quot;</span>,
          <span class="stringliteral">&quot;main:6&quot;</span>, <span class="stringliteral">&quot;/community&quot;</span> };

    <span class="keyword">const</span> <span class="keywordtype">char</span> *exampleStr[]
      = { <span class="stringliteral">&quot;example:0&quot;</span>, <span class="stringliteral">&quot;/examples&quot;</span>,
          <span class="stringliteral">&quot;example:1&quot;</span>, <span class="stringliteral">&quot;/examples/charts&quot;</span>,
          <span class="stringliteral">&quot;example:2&quot;</span>, <span class="stringliteral">&quot;/examples/wt-homepage&quot;</span>,
          <span class="stringliteral">&quot;example:3&quot;</span>, <span class="stringliteral">&quot;/examples/treelist&quot;</span>,
          <span class="stringliteral">&quot;example:4&quot;</span>, <span class="stringliteral">&quot;/examples/hangman&quot;</span>,
          <span class="stringliteral">&quot;example:5&quot;</span>, <span class="stringliteral">&quot;/examples/chat&quot;</span>,
          <span class="stringliteral">&quot;example:6&quot;</span>, <span class="stringliteral">&quot;/examples/mail-composer&quot;</span>,
          <span class="stringliteral">&quot;example:7&quot;</span>, <span class="stringliteral">&quot;/examples/drag-and-drop&quot;</span>,
          <span class="stringliteral">&quot;example:8&quot;</span>, <span class="stringliteral">&quot;/examples/file-explorer&quot;</span>,
          <span class="stringliteral">&quot;example:9&quot;</span>, <span class="stringliteral">&quot;/examples/calendar&quot;</span> };

    <span class="keywordflow">if</span> (historyKey-&gt;find(<span class="stringliteral">&quot;main:4&quot;</span>) != std::string::npos) {
      <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; 10; ++i)
        <span class="keywordflow">if</span> (historyKey-&gt;find(exampleStr[i*2]) != std::string::npos) {
          <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env);
          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">&quot;notice&quot;</span>) &lt;&lt; <span class="stringliteral">&quot;redirecting old style URL &#39;&quot;</span>
                             &lt;&lt; *historyKey &lt;&lt; <span class="stringliteral">&quot;&#39; to internal path: &#39;&quot;</span>
                             &lt;&lt; exampleStr[i*2+1] &lt;&lt; <span class="stringliteral">&quot;&#39;&quot;</span>;
          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(exampleStr[i*2+1]));
          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a5231d54ed34982f4366058eb6440c8f7">quit</a>();
          <span class="keywordflow">return</span> app;
        }
    } <span class="keywordflow">else</span>
      <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; 6; ++i)
        <span class="keywordflow">if</span> (historyKey-&gt;find(mainStr[i*2]) != std::string::npos) {
          <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env);

          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">&quot;notice&quot;</span>) &lt;&lt; <span class="stringliteral">&quot;redirecting old style URL &#39;&quot;</span>
                             &lt;&lt; *historyKey &lt;&lt; <span class="stringliteral">&quot;&#39; to internal path: &#39;&quot;</span>
                             &lt;&lt; mainStr[i*2+1] &lt;&lt; <span class="stringliteral">&quot;&#39;&quot;</span>;
          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(mainStr[i*2+1]));
          app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a5231d54ed34982f4366058eb6440c8f7">quit</a>();
          <span class="keywordflow">return</span> app;
        }

    <span class="comment">// unknown history key, just continue</span>
  }

  <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classWtHome.html">WtHome</a>(env);
}
</pre></div>
</div>
</div>
</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>