File: ExampleSourceViewer_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 (220 lines) | stat: -rw-r--r-- 11,582 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!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/ExampleSourceViewer.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/ExampleSourceViewer.C File Reference</h1><code>#include &lt;iostream&gt;</code><br>
<code>#include &lt;stdlib.h&gt;</code><br>
<code>#include &lt;algorithm&gt;</code><br>
<code>#include &lt;Wt/WApplication&gt;</code><br>
<code>#include &lt;Wt/WContainerWidget&gt;</code><br>
<code>#include &lt;Wt/WEnvironment&gt;</code><br>
<code>#include &lt;Wt/WLineEdit&gt;</code><br>
<code>#include &lt;Wt/WGridLayout&gt;</code><br>
<code>#include &lt;Wt/WHBoxLayout&gt;</code><br>
<code>#include &lt;Wt/WPushButton&gt;</code><br>
<code>#include &lt;Wt/WTable&gt;</code><br>
<code>#include &lt;Wt/WText&gt;</code><br>
<code>#include &lt;Wt/WTreeView&gt;</code><br>
<code>#include &lt;Wt/WVBoxLayout&gt;</code><br>
<code>#include &lt;Wt/WViewWidget&gt;</code><br>
<code>#include &lt;boost/filesystem/operations.hpp&gt;</code><br>
<code>#include &lt;boost/filesystem/exception.hpp&gt;</code><br>
<code>#include &lt;boost/filesystem/convenience.hpp&gt;</code><br>
<code>#include &lt;boost/algorithm/string.hpp&gt;</code><br>
<code>#include &quot;<a class="el" href="ExampleSourceViewer_8h-source.html">ExampleSourceViewer.h</a>&quot;</code><br>
<code>#include &quot;<a class="el" href="FileItem_8h-source.html">FileItem.h</a>&quot;</code><br>

<p>
<a href="ExampleSourceViewer_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">static std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ExampleSourceViewer_8C.html#90d62aee81b34c117b8f494a54bee4d4">filename</a> (const fs::path &amp;p)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ExampleSourceViewer_8C.html#2fb90126657b786f14062b06f995583c">stem</a> (const fs::path &amp;p)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">fs::path&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ExampleSourceViewer_8C.html#e19c9a4a8bd0a5e02a00d6e17707a342">parent_path</a> (const fs::path &amp;p)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ExampleSourceViewer_8C.html#cb92ccbf2405b113c0b8b66cec63aaae">comparePaths</a> (const fs::path &amp;p1, const fs::path &amp;p2)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">static fs::path&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="ExampleSourceViewer_8C.html#0c61a4a8c171f6b23a9fc3872c2e9e5d">getCompanion</a> (const fs::path &amp;path)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="cb92ccbf2405b113c0b8b66cec63aaae"></a><!-- doxytag: member="ExampleSourceViewer.C::comparePaths" ref="cb92ccbf2405b113c0b8b66cec63aaae" args="(const fs::path &amp;p1, const fs::path &amp;p2)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static bool comparePaths           </td>
          <td>(</td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>p1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>p2</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C-source.html#l00062">62</a> of file <a class="el" href="ExampleSourceViewer_8C-source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00063"></a>00063 {
<a name="l00064"></a>00064   <span class="keywordflow">return</span> <a class="code" href="ExampleSourceViewer_8C.html#90d62aee81b34c117b8f494a54bee4d4">filename</a>(p1) &gt; <a class="code" href="ExampleSourceViewer_8C.html#90d62aee81b34c117b8f494a54bee4d4">filename</a>(p2);
<a name="l00065"></a>00065 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="90d62aee81b34c117b8f494a54bee4d4"></a><!-- doxytag: member="ExampleSourceViewer.C::filename" ref="90d62aee81b34c117b8f494a54bee4d4" args="(const fs::path &amp;p)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static std::string filename           </td>
          <td>(</td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>p</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C-source.html#l00036">36</a> of file <a class="el" href="ExampleSourceViewer_8C-source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00037"></a>00037 {
<a name="l00038"></a>00038   <span class="keywordflow">return</span> p.empty() ? std::string() : *--p.end();
<a name="l00039"></a>00039 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="0c61a4a8c171f6b23a9fc3872c2e9e5d"></a><!-- doxytag: member="ExampleSourceViewer.C::getCompanion" ref="0c61a4a8c171f6b23a9fc3872c2e9e5d" args="(const fs::path &amp;path)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static fs::path getCompanion           </td>
          <td>(</td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>path</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C-source.html#l00169">169</a> of file <a class="el" href="ExampleSourceViewer_8C-source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00170"></a>00170 {
<a name="l00171"></a>00171   std::string ext = fs::extension(path);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173   <span class="keywordflow">if</span> (ext == <span class="stringliteral">".h"</span>)
<a name="l00174"></a>00174     <span class="keywordflow">return</span> <a class="code" href="ExampleSourceViewer_8C.html#e19c9a4a8bd0a5e02a00d6e17707a342">parent_path</a>(path) / (<a class="code" href="ExampleSourceViewer_8C.html#2fb90126657b786f14062b06f995583c">stem</a>(path) + <span class="stringliteral">".C"</span>);
<a name="l00175"></a>00175   <span class="keywordflow">else</span> <span class="keywordflow">if</span> (ext == <span class="stringliteral">".C"</span> || ext == <span class="stringliteral">".cpp"</span>)
<a name="l00176"></a>00176     <span class="keywordflow">return</span> <a class="code" href="ExampleSourceViewer_8C.html#e19c9a4a8bd0a5e02a00d6e17707a342">parent_path</a>(path) / (<a class="code" href="ExampleSourceViewer_8C.html#2fb90126657b786f14062b06f995583c">stem</a>(path) + <span class="stringliteral">".h"</span>);
<a name="l00177"></a>00177   <span class="keywordflow">else</span>
<a name="l00178"></a>00178     <span class="keywordflow">return</span> fs::path();
<a name="l00179"></a>00179 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="e19c9a4a8bd0a5e02a00d6e17707a342"></a><!-- doxytag: member="ExampleSourceViewer.C::parent_path" ref="e19c9a4a8bd0a5e02a00d6e17707a342" args="(const fs::path &amp;p)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">fs::path parent_path           </td>
          <td>(</td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>p</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C-source.html#l00054">54</a> of file <a class="el" href="ExampleSourceViewer_8C-source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00055"></a>00055 {
<a name="l00056"></a>00056   std::string fn = <a class="code" href="ExampleSourceViewer_8C.html#90d62aee81b34c117b8f494a54bee4d4">filename</a>(p);
<a name="l00057"></a>00057   std::string path = p.string();
<a name="l00058"></a>00058 
<a name="l00059"></a>00059   <span class="keywordflow">return</span> path.substr(0, path.length() - fn.length() - 1);
<a name="l00060"></a>00060 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="2fb90126657b786f14062b06f995583c"></a><!-- doxytag: member="ExampleSourceViewer.C::stem" ref="2fb90126657b786f14062b06f995583c" args="(const fs::path &amp;p)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static std::string stem           </td>
          <td>(</td>
          <td class="paramtype">const fs::path &amp;&nbsp;</td>
          <td class="paramname"> <em>p</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="ExampleSourceViewer_8C-source.html#l00042">42</a> of file <a class="el" href="ExampleSourceViewer_8C-source.html">ExampleSourceViewer.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00043"></a>00043 {
<a name="l00044"></a>00044   std::string fn = <a class="code" href="ExampleSourceViewer_8C.html#90d62aee81b34c117b8f494a54bee4d4">filename</a>(p);
<a name="l00045"></a>00045   std::size_t pos = fn.find(<span class="charliteral">'.'</span>);
<a name="l00046"></a>00046   <span class="keywordflow">if</span> (pos == std::string::npos)
<a name="l00047"></a>00047     <span class="keywordflow">return</span> fn;
<a name="l00048"></a>00048   <span class="keywordflow">else</span>
<a name="l00049"></a>00049     <span class="keywordflow">return</span> fn.substr(0, pos);
<a name="l00050"></a>00050 }
</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>