File: classFileTreeTableNode.html

package info (click to toggle)
witty 3.2.1-2%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 70,436 kB
  • sloc: cpp: 117,095; ansic: 77,999; xml: 7,564; sh: 1,037; perl: 208; makefile: 144; java: 86; sql: 14
file content (289 lines) | stat: -rw-r--r-- 19,834 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
<!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: FileTreeTableNode Class 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.1</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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></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>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-static-methods">Static Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">FileTreeTableNode Class Reference<div class="ingroups"><a class="el" href="group__fileexplorer.html">File Explorer example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="FileTreeTableNode" --><!-- doxytag: inherits="Wt::WTreeTableNode" -->
<p>A single node in a file tree table.  
 <a href="classFileTreeTableNode.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="FileTreeTableNode_8h_source.html">FileTreeTableNode.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for FileTreeTableNode:</div>
<div class="dyncontent">
<div class="center"><img src="classFileTreeTableNode__inherit__graph.png" border="0" usemap="#FileTreeTableNode_inherit__map" alt="Inheritance graph"/></div>
<map name="FileTreeTableNode_inherit__map" id="FileTreeTableNode_inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html" title="Wt::WTreeTableNode" alt="" coords="15,304,159,331"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html" title="Wt::WTreeNode" alt="" coords="29,229,144,256"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCompositeWidget.html" title="Wt::WCompositeWidget" alt="" coords="5,155,168,181"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="37,80,136,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="39,5,135,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classFileTreeTableNode-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="classFileTreeTableNode.html#ad3dcd44cf30aaab34ee104f5bce5b1fe">FileTreeTableNode</a> (const boost::filesystem::path &amp;path)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct a new node for the given file.  <a href="#ad3dcd44cf30aaab34ee104f5bce5b1fe"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classFileTreeTableNode.html#a4f627886ee0f4b3a6cf2380959935228">populate</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reimplements WTreeNode::populate to read files within a directory.  <a href="#a4f627886ee0f4b3a6cf2380959935228"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classFileTreeTableNode.html#a5454d4ea1a4ab067a3179426024343d5">expandable</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reimplements WTreeNode::expandable.  <a href="#a5454d4ea1a4ab067a3179426024343d5"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-static-methods"></a>
Static Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WIconPair.html">Wt::WIconPair</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classFileTreeTableNode.html#a573bcecf27009f71e026600fbbdbf417">createIcon</a> (const boost::filesystem::path &amp;path)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create the iconpair for representing the path.  <a href="#a573bcecf27009f71e026600fbbdbf417"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">boost::filesystem::path&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62">path_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The path.  <a href="#a27263407eedaf759152902162099da62"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A single node in a file tree table. </p>
<p>The node manages the details about one file, and if the file is a directory, populates a subtree with nodes for every directory item.</p>
<p>The tree node reimplements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#a9ab70c6020dbd9ea3204c625029a7a1b">Wt::WTreeTableNode::populate()</a> to populate a directory node only when the node is expanded. In this way, only directories that are actually browsed are loaded from disk. </p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8h_source.html#l00028">28</a> of file <a class="el" href="FileTreeTableNode_8h_source.html">FileTreeTableNode.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad3dcd44cf30aaab34ee104f5bce5b1fe"></a><!-- doxytag: member="FileTreeTableNode::FileTreeTableNode" ref="ad3dcd44cf30aaab34ee104f5bce5b1fe" args="(const boost::filesystem::path &amp;path)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">FileTreeTableNode::FileTreeTableNode </td>
          <td>(</td>
          <td class="paramtype">const boost::filesystem::path &amp;&#160;</td>
          <td class="paramname"><em>path</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Construct a new node for the given file. </p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8C_source.html#l00022">22</a> of file <a class="el" href="FileTreeTableNode_8C_source.html">FileTreeTableNode.C</a>.</p>
<div class="fragment"><pre class="fragment">  : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#ad5c6c8ff8d8d83d386271594444a2691">WTreeTableNode</a>(Wt::widen(path.leaf()), <a class="code" href="classFileTreeTableNode.html#a573bcecf27009f71e026600fbbdbf417" title="Create the iconpair for representing the path.">createIcon</a>(path)),
#<span class="keywordflow">else</span>
  : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#ad5c6c8ff8d8d83d386271594444a2691">WTreeTableNode</a>(path.leaf(), <a class="code" href="classFileTreeTableNode.html#a573bcecf27009f71e026600fbbdbf417" title="Create the iconpair for representing the path.">createIcon</a>(path)),
#endif
#<span class="keywordflow">else</span>
  : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#ad5c6c8ff8d8d83d386271594444a2691">WTreeTableNode</a>(path.leaf().string(), <a class="code" href="classFileTreeTableNode.html#a573bcecf27009f71e026600fbbdbf417" title="Create the iconpair for representing the path.">createIcon</a>(path)),
#endif
    <a class="code" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62" title="The path.">path_</a>(path)
{
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#a32c24104359b595cbaf914e35accb3b4">label</a>()-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#af22c64c4c5fed3d2aef0915a7e5c5866">setTextFormat</a>(PlainText);

  <span class="keywordflow">if</span> (boost::filesystem::exists(path)) {
    <span class="keywordflow">if</span> (!boost::filesystem::is_directory(path)) {
      <span class="keywordtype">int</span> fsize = (int)boost::filesystem::file_size(path);
      <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#a136a48e8cda5e0abbfd0e0d8cf008b36">setColumnWidget</a>(1, <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(boost::lexical_cast&lt;std::string&gt;(fsize)));
      <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#a5e9f7b5afb4d92175a3d6307727eee81">columnWidget</a>(1)-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a4be23ecf48d5968efb5d926e38e01708">setStyleClass</a>(<span class="stringliteral">&quot;fsize&quot;</span>);
    } <span class="keywordflow">else</span>
      <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#a60428cfc48b2a39550efc308b38406b2">setSelectable</a>(<span class="keyword">false</span>);

    std::time_t t = boost::filesystem::last_write_time(path);
    <span class="keyword">struct </span>tm ttm;
<span class="preprocessor">#if WIN32</span>
<span class="preprocessor"></span>    ttm=*localtime(&amp;t);
<span class="preprocessor">#else</span>
<span class="preprocessor"></span>    localtime_r(&amp;t, &amp;ttm);
<span class="preprocessor">#endif</span>
<span class="preprocessor"></span>
    <span class="keywordtype">char</span> c[100];
    strftime(c, 100, <span class="stringliteral">&quot;%b %d %Y&quot;</span>, &amp;ttm);

    <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#a136a48e8cda5e0abbfd0e0d8cf008b36">setColumnWidget</a>(2, <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(c));
    <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeTableNode.html#a5e9f7b5afb4d92175a3d6307727eee81">columnWidget</a>(2)-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a4be23ecf48d5968efb5d926e38e01708">setStyleClass</a>(<span class="stringliteral">&quot;date&quot;</span>);
  }
}
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a573bcecf27009f71e026600fbbdbf417"></a><!-- doxytag: member="FileTreeTableNode::createIcon" ref="a573bcecf27009f71e026600fbbdbf417" args="(const boost::filesystem::path &amp;path)" -->
<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_1WIconPair.html">WIconPair</a> * FileTreeTableNode::createIcon </td>
          <td>(</td>
          <td class="paramtype">const boost::filesystem::path &amp;&#160;</td>
          <td class="paramname"><em>path</em></td><td>)</td>
          <td><code> [static, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create the iconpair for representing the path. </p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8C_source.html#l00060">60</a> of file <a class="el" href="FileTreeTableNode_8C_source.html">FileTreeTableNode.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span> (boost::filesystem::exists(path)
      &amp;&amp; boost::filesystem::is_directory(path))
    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WIconPair.html">WIconPair</a>(<span class="stringliteral">&quot;icons/yellow-folder-closed.png&quot;</span>,
                         <span class="stringliteral">&quot;icons/yellow-folder-open.png&quot;</span>, <span class="keyword">false</span>);
  <span class="keywordflow">else</span>
    <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WIconPair.html">WIconPair</a>(<span class="stringliteral">&quot;icons/document.png&quot;</span>,
                         <span class="stringliteral">&quot;icons/yellow-folder-open.png&quot;</span>, <span class="keyword">false</span>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a5454d4ea1a4ab067a3179426024343d5"></a><!-- doxytag: member="FileTreeTableNode::expandable" ref="a5454d4ea1a4ab067a3179426024343d5" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool FileTreeTableNode::expandable </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reimplements WTreeNode::expandable. </p>

<p>Reimplemented from <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#a4f19826594b5b080b0a436c474c31f61">Wt::WTreeNode</a>.</p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8C_source.html#l00090">90</a> of file <a class="el" href="FileTreeTableNode_8C_source.html">FileTreeTableNode.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span> (!<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#aee388605958559d124616ce9dbfc7df5">populated</a>()) {
    <span class="keywordflow">return</span> boost::filesystem::is_directory(<a class="code" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62" title="The path.">path_</a>);
  } <span class="keywordflow">else</span>
    <span class="keywordflow">return</span> <a class="code" href="classFileTreeTableNode.html#a5454d4ea1a4ab067a3179426024343d5" title="Reimplements WTreeNode::expandable.">WTreeTableNode::expandable</a>();
}
</pre></div>
</div>
</div>
<a class="anchor" id="a4f627886ee0f4b3a6cf2380959935228"></a><!-- doxytag: member="FileTreeTableNode::populate" ref="a4f627886ee0f4b3a6cf2380959935228" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void FileTreeTableNode::populate </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reimplements WTreeNode::populate to read files within a directory. </p>

<p>Reimplemented from <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#a9ab70c6020dbd9ea3204c625029a7a1b">Wt::WTreeNode</a>.</p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8C_source.html#l00071">71</a> of file <a class="el" href="FileTreeTableNode_8C_source.html">FileTreeTableNode.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">try</span> {
    <span class="keywordflow">if</span> (boost::filesystem::is_directory(<a class="code" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62" title="The path.">path_</a>)) {
      std::set&lt;boost::filesystem::path&gt; paths;
      boost::filesystem::directory_iterator end_itr;

      <span class="keywordflow">for</span> (boost::filesystem::directory_iterator i(<a class="code" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62" title="The path.">path_</a>); i != end_itr; ++i)
        paths.insert(*i);

      <span class="keywordflow">for</span> (std::set&lt;boost::filesystem::path&gt;::iterator i = paths.begin();
           i != paths.end(); ++i)
        <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTreeNode.html#adeb2bd7c946ef9c7bb5b72b3f88453a6">addChildNode</a>(<span class="keyword">new</span> <a class="code" href="classFileTreeTableNode.html#ad3dcd44cf30aaab34ee104f5bce5b1fe" title="Construct a new node for the given file.">FileTreeTableNode</a>(*i));
    }
  } <span class="keywordflow">catch</span> (boost::filesystem::filesystem_error&amp; e) {
    std::cerr &lt;&lt; e.what() &lt;&lt; std::endl;
  }
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a27263407eedaf759152902162099da62"></a><!-- doxytag: member="FileTreeTableNode::path_" ref="a27263407eedaf759152902162099da62" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boost::filesystem::path <a class="el" href="classFileTreeTableNode.html#a27263407eedaf759152902162099da62">FileTreeTableNode::path_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The path. </p>

<p>Definition at line <a class="el" href="FileTreeTableNode_8h_source.html#l00037">37</a> of file <a class="el" href="FileTreeTableNode_8h_source.html">FileTreeTableNode.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/filetreetable/<a class="el" href="FileTreeTableNode_8h_source.html">FileTreeTableNode.h</a></li>
<li>/home/koen/project/wt/public-git/wt/examples/filetreetable/<a class="el" href="FileTreeTableNode_8C_source.html">FileTreeTableNode.C</a></li>
</ul>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Fri Mar 30 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>