File: WtHome_8C.html

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (125 lines) | stat: -rw-r--r-- 11,640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!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>Wt examples: /home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;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>
<div class="contents">
<h1>/home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C File Reference</h1><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;Wt/WLogger&gt;</code><br>
<code>#include &lt;Wt/WMenuItem&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>

<p>
<a href="WtHome_8C-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="WtHome_8C.html#dd0ef25910d91a7bd79ffb3c07a9af32">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" name="dd0ef25910d91a7bd79ffb3c07a9af32"></a><!-- doxytag: member="WtHome.C::createWtHomeApplication" ref="dd0ef25910d91a7bd79ffb3c07a9af32" 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;&nbsp;</td>
          <td class="paramname"> <em>env</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="WtHome_8C-source.html#l00165">165</a> of file <a class="el" href="WtHome_8C-source.html">WtHome.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00166"></a>00166 {
<a name="l00167"></a>00167   <span class="comment">// support for old (&lt; Wt-2.2) homepage URLS: redirect from "states"</span>
<a name="l00168"></a>00168   <span class="comment">// to "internal paths"</span>
<a name="l00169"></a>00169   <span class="comment">// this contains the initial "history state" in old Wt versions</span>
<a name="l00170"></a>00170   <span class="keyword">const</span> std::string *historyKey = env.<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WEnvironment.html#3f87915f10f39b18eac28bac65c0cd46">getParameter</a>(<span class="stringliteral">"historyKey"</span>);
<a name="l00171"></a>00171 
<a name="l00172"></a>00172   <span class="keywordflow">if</span> (historyKey) {
<a name="l00173"></a>00173     <span class="keyword">const</span> <span class="keywordtype">char</span> *mainStr[]
<a name="l00174"></a>00174       = { <span class="stringliteral">"main:0"</span>, <span class="stringliteral">"/"</span>,
<a name="l00175"></a>00175           <span class="stringliteral">"main:1"</span>, <span class="stringliteral">"/news"</span>,
<a name="l00176"></a>00176           <span class="stringliteral">"main:2"</span>, <span class="stringliteral">"/features"</span>,
<a name="l00177"></a>00177           <span class="stringliteral">"main:4"</span>, <span class="stringliteral">"/examples"</span>,
<a name="l00178"></a>00178           <span class="stringliteral">"main:3"</span>, <span class="stringliteral">"/documentation"</span>,
<a name="l00179"></a>00179           <span class="stringliteral">"main:5"</span>, <span class="stringliteral">"/download"</span>,
<a name="l00180"></a>00180           <span class="stringliteral">"main:6"</span>, <span class="stringliteral">"/community"</span> };
<a name="l00181"></a>00181 
<a name="l00182"></a>00182     <span class="keyword">const</span> <span class="keywordtype">char</span> *exampleStr[]
<a name="l00183"></a>00183       = { <span class="stringliteral">"example:0"</span>, <span class="stringliteral">"/examples"</span>,
<a name="l00184"></a>00184           <span class="stringliteral">"example:1"</span>, <span class="stringliteral">"/examples/charts"</span>,
<a name="l00185"></a>00185           <span class="stringliteral">"example:2"</span>, <span class="stringliteral">"/examples/wt-homepage"</span>,
<a name="l00186"></a>00186           <span class="stringliteral">"example:3"</span>, <span class="stringliteral">"/examples/treelist"</span>,
<a name="l00187"></a>00187           <span class="stringliteral">"example:4"</span>, <span class="stringliteral">"/examples/hangman"</span>,
<a name="l00188"></a>00188           <span class="stringliteral">"example:5"</span>, <span class="stringliteral">"/examples/chat"</span>,
<a name="l00189"></a>00189           <span class="stringliteral">"example:6"</span>, <span class="stringliteral">"/examples/mail-composer"</span>,
<a name="l00190"></a>00190           <span class="stringliteral">"example:7"</span>, <span class="stringliteral">"/examples/drag-and-drop"</span>,
<a name="l00191"></a>00191           <span class="stringliteral">"example:8"</span>, <span class="stringliteral">"/examples/file-explorer"</span>,
<a name="l00192"></a>00192           <span class="stringliteral">"example:9"</span>, <span class="stringliteral">"/examples/calendar"</span> };
<a name="l00193"></a>00193 
<a name="l00194"></a>00194     <span class="keywordflow">if</span> (historyKey-&gt;find(<span class="stringliteral">"main:4"</span>) != std::string::npos) {
<a name="l00195"></a>00195       <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; 10; ++i)
<a name="l00196"></a>00196         <span class="keywordflow">if</span> (historyKey-&gt;find(exampleStr[i*2]) != std::string::npos) {
<a name="l00197"></a>00197           <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);
<a name="l00198"></a>00198           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) &lt;&lt; <span class="stringliteral">"redirecting old style URL '"</span>
<a name="l00199"></a>00199                              &lt;&lt; *historyKey &lt;&lt; <span class="stringliteral">"' to internal path: '"</span>
<a name="l00200"></a>00200                              &lt;&lt; exampleStr[i*2+1] &lt;&lt; <span class="stringliteral">"'"</span>;
<a name="l00201"></a>00201           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(exampleStr[i*2+1]));
<a name="l00202"></a>00202           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7">quit</a>();
<a name="l00203"></a>00203           <span class="keywordflow">return</span> app;
<a name="l00204"></a>00204         }
<a name="l00205"></a>00205     } <span class="keywordflow">else</span>
<a name="l00206"></a>00206       <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; 6; ++i)
<a name="l00207"></a>00207         <span class="keywordflow">if</span> (historyKey-&gt;find(mainStr[i*2]) != std::string::npos) {
<a name="l00208"></a>00208           <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);
<a name="l00209"></a>00209 
<a name="l00210"></a>00210           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) &lt;&lt; <span class="stringliteral">"redirecting old style URL '"</span>
<a name="l00211"></a>00211                              &lt;&lt; *historyKey &lt;&lt; <span class="stringliteral">"' to internal path: '"</span>
<a name="l00212"></a>00212                              &lt;&lt; mainStr[i*2+1] &lt;&lt; <span class="stringliteral">"'"</span>;
<a name="l00213"></a>00213           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(mainStr[i*2+1]));
<a name="l00214"></a>00214           app-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7">quit</a>();
<a name="l00215"></a>00215           <span class="keywordflow">return</span> app;
<a name="l00216"></a>00216         }
<a name="l00217"></a>00217 
<a name="l00218"></a>00218     <span class="comment">// unknown history key, just continue</span>
<a name="l00219"></a>00219   }
<a name="l00220"></a>00220 
<a name="l00221"></a>00221   <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classWtHome.html">WtHome</a>(env);
<a name="l00222"></a>00222 }
</pre></div>
<p>

</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>