Sophie

Sophie

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

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: 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.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 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 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>