Sophie

Sophie

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

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: GitModel 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="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="#pri-types">Private Types</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a>  </div>
  <div class="headertitle">
<div class="title">GitModel Class Reference<div class="ingroups"><a class="el" href="group__gitmodelexample.html">Git model example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="GitModel" --><!-- doxytag: inherits="Wt::WAbstractItemModel" -->
<p>A model that retrieves revision trees from a git repository.  
 <a href="classGitModel.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="GitModel_8h_source.html">GitModel.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for GitModel:</div>
<div class="dyncontent">
<div class="center"><img src="classGitModel__inherit__graph.png" border="0" usemap="#GitModel_inherit__map" alt="Inheritance graph"/></div>
<map name="GitModel_inherit__map" id="GitModel_inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html" title="Wt::WAbstractItemModel" alt="" coords="5,80,173,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="41,5,137,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classGitModel-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structGitModel_1_1ChildIndex.html">ChildIndex</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Index usable as a key to a map, that identifies a child/row within a tree.  <a href="structGitModel_1_1ChildIndex.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel_1_1Tree.html">Tree</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Used to uniquely locate a folder within the folder hierarchy.  <a href="classGitModel_1_1Tree.html#details">More...</a><br/></td></tr>
<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="classGitModel.html#a056f5d6c45226ca08ada28e72eed294a">GitModel</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html">Wt::WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a056f5d6c45226ca08ada28e72eed294a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#aac776e532822827e59a2233645995e65">setRepositoryPath</a> (const std::string &amp;repositoryPath)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the repository and load its 'master' revision.  <a href="#aac776e532822827e59a2233645995e65"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#af78bddbae2d7b76ec1e49d8626dc7526">loadRevision</a> (const std::string &amp;revName)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Load a particular revision.  <a href="#af78bddbae2d7b76ec1e49d8626dc7526"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#ad707c92d586f8232f5e452b2b3cecc1b">parent</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;index) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the parent index.  <a href="#ad707c92d586f8232f5e452b2b3cecc1b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a78b52d35048396dc60aa660b1d5bcf55">columnCount</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;parent=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the column count.  <a href="#a78b52d35048396dc60aa660b1d5bcf55"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#aa5f75edbb291d0b03c22fc8a608a3171">rowCount</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;parent=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the row count.  <a href="#aa5f75edbb291d0b03c22fc8a608a3171"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141">index</a> (int row, int column, const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;parent=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a child index.  <a href="#a47f5ebf88be96b003b4bf31bfafff141"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual boost::any&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a6e30f8cddbb1039d7d749eaafa1120a8">data</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;index, int role=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">Wt::DisplayRole</a>) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns data.  <a href="#a6e30f8cddbb1039d7d749eaafa1120a8"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual boost::any&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a23fb9ef292e416fbdf20790a2a93c016">headerData</a> (int section, <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a2a8d45559e16a0185bf61bfad0a67912">Wt::Orientation</a> orientation=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a2a8d45559e16a0185bf61bfad0a67912ac2ebf22b096a22b18eef23e736aa2e28">Wt::Horizontal</a>, int role=<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">Wt::DisplayRole</a>) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns header data.  <a href="#a23fb9ef292e416fbdf20790a2a93c016"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a49c30024f0241738b30cf4cec589b292">ContentsRole</a> = <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">Wt::UserRole</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The role which may be used on a file to retrieve its contents.  <a href="#a49c30024f0241738b30cf4cec589b292"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static const int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a9419f872ce68506009748f0595400ef7">FilePathRole</a> = <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">Wt::UserRole</a> + 1</td></tr>
<tr><td colspan="2"><h2><a name="pri-types"></a>
Private Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">typedef std::map&lt; <a class="el" href="structGitModel_1_1ChildIndex.html">ChildIndex</a>, int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a5bdd5d3dea3e158889afc795b455d103">ChildPointerMap</a></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">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#ab2efe3ae663dfbd670dc41dd3cb8d2a0">getTreeId</a> (int parentId, int childIndex) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get or allocate an id for a folder.  <a href="#ab2efe3ae663dfbd670dc41dd3cb8d2a0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structGit_1_1Object.html">Git::Object</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a0eec46284e84c7deeb1a39eb7185d1d1">getObject</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;index) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the <a class="el" href="structGit_1_1Object.html" title="Git object.">Git::Object</a> that corresponds to an index.  <a href="#a0eec46284e84c7deeb1a39eb7185d1d1"></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"><a class="el" href="classGit.html">Git</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e">git_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The git repository.  <a href="#afc8ff43e47ae51ce2af04d63a162be8e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="classGitModel_1_1Tree.html">Tree</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4">treeData_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">List of folder objects.  <a href="#a59307dfceb1f5712914e0754144422e4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classGitModel.html#a5bdd5d3dea3e158889afc795b455d103">ChildPointerMap</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90">childPointer_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Maps child indexes to tree indexes.  <a href="#a4f3e07cf6dddd098c4c4f0978be0fe90"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A model that retrieves revision trees from a git repository. </p>
<p>In its present form, it presents only a single column of data: the file names. Additional data could be easily added. <a class="el" href="classGit.html" title="Git utility class for browsing git archives.">Git</a> "tree" objects correspond to folders, and "blob" objects to files.</p>
<p>The model is read-only, does not support sorting (that could be provided by using a WSortFilterProxyModel).</p>
<p>The model loads only minimal information in memory: to create model indexes for folders. These cannot be uniquely identified by their SHA1 id, since two identical folders at different locations would have the same SHA1 id.</p>
<p>The internal id of model indexes created by the model uniquely identify a containing folder for a particular file. </p>

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00036">36</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>
</div><hr/><h2>Member Typedef Documentation</h2>
<a class="anchor" id="a5bdd5d3dea3e158889afc795b455d103"></a><!-- doxytag: member="GitModel::ChildPointerMap" ref="a5bdd5d3dea3e158889afc795b455d103" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">typedef std::map&lt;<a class="el" href="structGitModel_1_1ChildIndex.html">ChildIndex</a>, int&gt; <a class="el" href="classGitModel.html#a5bdd5d3dea3e158889afc795b455d103">GitModel::ChildPointerMap</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00168">168</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>

</div>
</div>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a056f5d6c45226ca08ada28e72eed294a"></a><!-- doxytag: member="GitModel::GitModel" ref="a056f5d6c45226ca08ada28e72eed294a" args="(Wt::WObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">GitModel::GitModel </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html">Wt::WObject</a> *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Constructor. </p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00011">11</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">  : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#aceb39c2027dc4dc464ac5942798e62e6">WAbstractItemModel</a>(parent)
{ }
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a78b52d35048396dc60aa660b1d5bcf55"></a><!-- doxytag: member="GitModel::columnCount" ref="a78b52d35048396dc60aa660b1d5bcf55" args="(const Wt::WModelIndex &amp;parent=Wt::WModelIndex()) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GitModel::columnCount </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>parent</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()</code></td><td>)</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the column count. </p>
<p>Returns 1. </p>

<p>Implements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#abcf7912a95a0a60f8e9b1c37d30b8383">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00097">97</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// currently only one column</span>
  <span class="keywordflow">return</span> 1;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a6e30f8cddbb1039d7d749eaafa1120a8"></a><!-- doxytag: member="GitModel::data" ref="a6e30f8cddbb1039d7d749eaafa1120a8" args="(const Wt::WModelIndex &amp;index, int role=Wt::DisplayRole) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boost::any GitModel::data </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>role</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">Wt::DisplayRole</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns data. </p>
<p>Returns only data corresponding to DisplayRole and ContentsRole. </p>

<p>Implements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a9112b74d160f916ef75fb6c1c09dd8fe">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00135">135</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span> (!index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a1d4b05ee51c5c6961d6123565fd77c82">isValid</a>())
    <span class="keywordflow">return</span> boost::any();

  <span class="comment">/* Only 3 data roles on column 0 data are supported:</span>
<span class="comment">   * - DisplayRole: the file name</span>
<span class="comment">   * - DecorationRole: an icon (folder or file)</span>
<span class="comment">   * - ContentsRole: the file contents</span>
<span class="comment">   */</span>
  <span class="keywordflow">if</span> (index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a0e6568dd7113662c3c378e2084729581">column</a>() == 0) {
    <a class="code" href="structGit_1_1Object.html" title="Git object.">Git::Object</a> <span class="keywordtype">object</span> = <a class="code" href="classGitModel.html#a0eec46284e84c7deeb1a39eb7185d1d1" title="Get the Git::Object that corresponds to an index.">getObject</a>(index);
    <span class="keywordflow">if</span> (role == <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">DisplayRole</a>) {
      <span class="keywordflow">if</span> (<span class="keywordtype">object</span>.type == <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aae94d3a7ff6594f6b3b0dc121fbd01564">Git::Tree</a>)
        <span class="keywordflow">return</span> <span class="keywordtype">object</span>.name + <span class="charliteral">&#39;/&#39;</span>;
      <span class="keywordflow">else</span>
        <span class="keywordflow">return</span> <span class="keywordtype">object</span>.name;
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (role == <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068aab6678fc176854f7990d6cff4eed779e">DecorationRole</a>) {
      <span class="keywordflow">if</span> (<span class="keywordtype">object</span>.type == <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aa64c3a7b641cdc0cb2c4203fc0bef1a4a">Git::Blob</a>)
        <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(<span class="stringliteral">&quot;icons/git-blob.png&quot;</span>);
      <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<span class="keywordtype">object</span>.type == <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aae94d3a7ff6594f6b3b0dc121fbd01564">Git::Tree</a>)
        <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(<span class="stringliteral">&quot;icons/git-tree.png&quot;</span>);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (role == <a class="code" href="classGitModel.html#a49c30024f0241738b30cf4cec589b292" title="The role which may be used on a file to retrieve its contents.">ContentsRole</a>) {
      <span class="keywordflow">if</span> (<span class="keywordtype">object</span>.type == <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aa64c3a7b641cdc0cb2c4203fc0bef1a4a">Git::Blob</a>)
        <span class="keywordflow">return</span> <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#acf2d699d9f9bdfb42afb0f61e85b2f88" title="Return the raw contents of a git object.">catFile</a>(<span class="keywordtype">object</span>.<span class="keywordtype">id</span>);
    } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (role == <a class="code" href="classGitModel.html#a9419f872ce68506009748f0595400ef7">FilePathRole</a>) {
      <span class="keywordflow">return</span> boost::any();
    }
  }

  <span class="keywordflow">return</span> boost::any();
}
</pre></div>
</div>
</div>
<a class="anchor" id="a0eec46284e84c7deeb1a39eb7185d1d1"></a><!-- doxytag: member="GitModel::getObject" ref="a0eec46284e84c7deeb1a39eb7185d1d1" args="(const Wt::WModelIndex &amp;index) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structGit_1_1Object.html">Git::Object</a> GitModel::getObject </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td> const<code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the <a class="el" href="structGit_1_1Object.html" title="Git object.">Git::Object</a> that corresponds to an index. </p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00177">177</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordtype">int</span> parentId = index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7ae49c4d0edaf9a520e6f5e8a62c3904">internalId</a>();
  <span class="keyword">const</span> Tree&amp; parentItem = <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>[parentId];
  <span class="keywordflow">return</span> <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#a910f3a6123b494897cdedf7ba4ef648b" title="Get some info on a tree object.">treeGetObject</a>(parentItem.treeObject(), index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#aa4f1385223391c46ee200a57672f6046">row</a>());
}
</pre></div>
</div>
</div>
<a class="anchor" id="ab2efe3ae663dfbd670dc41dd3cb8d2a0"></a><!-- doxytag: member="GitModel::getTreeId" ref="ab2efe3ae663dfbd670dc41dd3cb8d2a0" args="(int parentId, int childIndex) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GitModel::getTreeId </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>parentId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>childIndex</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get or allocate an id for a folder. </p>
<p>The folder is identified by a given childIndex within a parent folder. This method adds data to the treeData_ (and childPointer_) data structures. </p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00076">76</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  ChildIndex <a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>(parentId, childIndex);

  ChildPointerMap::const_iterator i = <a class="code" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90" title="Maps child indexes to tree indexes.">childPointer_</a>.find(<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>);
  <span class="keywordflow">if</span> (i == <a class="code" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90" title="Maps child indexes to tree indexes.">childPointer_</a>.end()) {
    <span class="comment">// no tree object was already allocated, so do that now.</span>

    <span class="comment">// lookup the git SHA1 object Id (within the parent)</span>
    <span class="keyword">const</span> Tree&amp; parentItem = <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>[parentId];
    <a class="code" href="structGit_1_1Object.html" title="Git object.">Git::Object</a> o = <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#a910f3a6123b494897cdedf7ba4ef648b" title="Get some info on a tree object.">treeGetObject</a>(parentItem.treeObject(), childIndex);

    <span class="comment">// and add to treeData_ and childPointer_ data structures</span>
    <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>.push_back(Tree(parentId, childIndex, o.<a class="code" href="structGit_1_1Object.html#a2e3989983524516e4a936714b55736ff">id</a>, <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#abe86381afbbab0adb0680ae268752f1f" title="Return the number of objects inside a tree object.">treeSize</a>(o.<a class="code" href="structGit_1_1Object.html#a2e3989983524516e4a936714b55736ff">id</a>)));
    <span class="keywordtype">int</span> result = <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>.size() - 1;
    <a class="code" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90" title="Maps child indexes to tree indexes.">childPointer_</a>[<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>] = result;
    <span class="keywordflow">return</span> result;
  } <span class="keywordflow">else</span>
    <span class="keywordflow">return</span> i-&gt;second;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a23fb9ef292e416fbdf20790a2a93c016"></a><!-- doxytag: member="GitModel::headerData" ref="a23fb9ef292e416fbdf20790a2a93c016" args="(int section, Wt::Orientation orientation=Wt::Horizontal, int role=Wt::DisplayRole) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boost::any GitModel::headerData </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>section</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a2a8d45559e16a0185bf61bfad0a67912">Wt::Orientation</a>&#160;</td>
          <td class="paramname"><em>orientation</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a2a8d45559e16a0185bf61bfad0a67912ac2ebf22b096a22b18eef23e736aa2e28">Wt::Horizontal</a></code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>role</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">Wt::DisplayRole</a></code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns header data. </p>

<p>Reimplemented from <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a86bbab7c809fce4de9b5cb543b2fb124">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00168">168</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span> (orientation == Horizontal &amp;&amp; role == <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f">DisplayRole</a>)
    <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span><span class="keyword">const </span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span>(<span class="stringliteral">&quot;File&quot;</span>);
  <span class="keywordflow">else</span>
    <span class="keywordflow">return</span> boost::any();
}
</pre></div>
</div>
</div>
<a class="anchor" id="a47f5ebf88be96b003b4bf31bfafff141"></a><!-- doxytag: member="GitModel::index" ref="a47f5ebf88be96b003b4bf31bfafff141" args="(int row, int column, const Wt::WModelIndex &amp;parent=Wt::WModelIndex()) const " -->
<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_1WModelIndex.html">WModelIndex</a> GitModel::index </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>row</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>column</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>parent</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns a child index. </p>
<p>Consults the internal data structure to create a child index. If necessary, the internal data structure is expanded by adding an entry for using the <em>parent</em> index as a parent index. </p>

<p>Implements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#a83f37bf04b8574b328c139b02523b8cb">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00056">56</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordtype">int</span> parentId;

  <span class="comment">// the top-level parent has id=0.</span>
  <span class="keywordflow">if</span> (!parent.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a1d4b05ee51c5c6961d6123565fd77c82">isValid</a>())
    parentId = 0;
  <span class="keywordflow">else</span> {
    <span class="comment">// the internal id of the parent identifies the grand parent</span>
    <span class="keywordtype">int</span> grandParentId = parent.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7ae49c4d0edaf9a520e6f5e8a62c3904">internalId</a>();

    <span class="comment">// lookup the parent id for the parent himself, based on grand parent</span>
    <span class="comment">// and child-index (=row) within the grand parent</span>
    parentId = <a class="code" href="classGitModel.html#ab2efe3ae663dfbd670dc41dd3cb8d2a0" title="Get or allocate an id for a folder.">getTreeId</a>(grandParentId, parent.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#aa4f1385223391c46ee200a57672f6046">row</a>());
  }

  <span class="keywordflow">return</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ac837a73fe423255035ffb076946de122">createIndex</a>(row, column, parentId);
}
</pre></div>
</div>
</div>
<a class="anchor" id="af78bddbae2d7b76ec1e49d8626dc7526"></a><!-- doxytag: member="GitModel::loadRevision" ref="af78bddbae2d7b76ec1e49d8626dc7526" args="(const std::string &amp;revName)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GitModel::loadRevision </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>revName</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Load a particular revision. </p>
<p>The revision name may be any revision accepted by git, by git-rev-parse(1). </p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00021">21</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">Git::ObjectId</a> treeRoot = <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#a521bba51875ea14c9e39a14fcde01e04" title="Get the tree for a particular revision.">getCommitTree</a>(revName);

  <span class="comment">// You need to call this method before invalidating all existing</span>
  <span class="comment">// model indexes. Anyone listening for this event could temporarily</span>
  <span class="comment">// convert some model indexes to a raw index pointer, but this model</span>
  <span class="comment">// does not reimplement these methods.</span>
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ab377ac2fcb9de9d191bd1353665d1389">layoutAboutToBeChanged</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a8d9cf8a1e83634462fe2b492b3beb1c5">emit</a>();

  <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>.clear();
  <a class="code" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90" title="Maps child indexes to tree indexes.">childPointer_</a>.clear();

  <span class="comment">// Store the tree root as treeData_[0]</span>
  <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>.push_back(Tree(-1, -1, treeRoot, <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#abe86381afbbab0adb0680ae268752f1f" title="Return the number of objects inside a tree object.">treeSize</a>(treeRoot)));

  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#afe7cb1d5186881f83aa8f0e452aaef66">layoutChanged</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a8d9cf8a1e83634462fe2b492b3beb1c5">emit</a>();
}
</pre></div>
</div>
</div>
<a class="anchor" id="ad707c92d586f8232f5e452b2b3cecc1b"></a><!-- doxytag: member="GitModel::parent" ref="ad707c92d586f8232f5e452b2b3cecc1b" args="(const Wt::WModelIndex &amp;index) const " -->
<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_1WModelIndex.html">WModelIndex</a> GitModel::parent </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>index</em></td><td>)</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the parent index. </p>
<p>Consults the internal data structure to find the parent index. </p>

<p>Implements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ada454d45706ca0c1a0921dedd351c48c">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00040">40</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// treeData_[0] indicates the top-level parent.</span>
  <span class="keywordflow">if</span> (!index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a1d4b05ee51c5c6961d6123565fd77c82">isValid</a>() || index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7ae49c4d0edaf9a520e6f5e8a62c3904">internalId</a>() == 0)
    <span class="keywordflow">return</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">WModelIndex</a>();
  <span class="keywordflow">else</span> {
    <span class="comment">// get the item that corresponds to the parent ...</span>
    <span class="keyword">const</span> Tree&amp; item = <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>[index.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7ae49c4d0edaf9a520e6f5e8a62c3904">internalId</a>()];

    <span class="comment">// ... and construct that identifies the parent:</span>
    <span class="comment">//   row = child index in the grand parent</span>
    <span class="comment">//   internalId = id of the grand parent</span>
    <span class="keywordflow">return</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ac837a73fe423255035ffb076946de122">createIndex</a>(item.index(), 0, item.parentId()); 
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="aa5f75edbb291d0b03c22fc8a608a3171"></a><!-- doxytag: member="GitModel::rowCount" ref="aa5f75edbb291d0b03c22fc8a608a3171" args="(const Wt::WModelIndex &amp;parent=Wt::WModelIndex()) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int GitModel::rowCount </td>
          <td>(</td>
          <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a> &amp;&#160;</td>
          <td class="paramname"><em>parent</em> = <code><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html">Wt::WModelIndex</a>()</code></td><td>)</td>
          <td> const<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Returns the row count. </p>
<p>Returns 0 unless the item represents a folder, in which case it returns the number of items in the tree object that corresponds to the folder. </p>

<p>Implements <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAbstractItemModel.html#ab0709a8f71fd5df882f29bb29fd055f0">Wt::WAbstractItemModel</a>.</p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00103">103</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">// we are looking for the git SHA1 id of a tree object (since only folders</span>
  <span class="comment">// may contain children).</span>
  <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">Git::ObjectId</a> objectId;
  <span class="keywordtype">int</span> treeId;

  <span class="keywordflow">if</span> (<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a1d4b05ee51c5c6961d6123565fd77c82">isValid</a>()) {
    <span class="comment">// only column 0 items may contain children</span>
    <span class="keywordflow">if</span> (<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a0e6568dd7113662c3c378e2084729581">column</a>() != 0)
      <span class="keywordflow">return</span> 0;

    <a class="code" href="structGit_1_1Object.html" title="Git object.">Git::Object</a> o = <a class="code" href="classGitModel.html#a0eec46284e84c7deeb1a39eb7185d1d1" title="Get the Git::Object that corresponds to an index.">getObject</a>(<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>);
    <span class="keywordflow">if</span> (o.<a class="code" href="structGit_1_1Object.html#a2ea77791af4fa6012b350469654332cc">type</a> == <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aae94d3a7ff6594f6b3b0dc121fbd01564">Git::Tree</a>) {
      objectId = o.<a class="code" href="structGit_1_1Object.html#a2e3989983524516e4a936714b55736ff">id</a>;
      treeId = <a class="code" href="classGitModel.html#ab2efe3ae663dfbd670dc41dd3cb8d2a0" title="Get or allocate an id for a folder.">getTreeId</a>(<a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#a7ae49c4d0edaf9a520e6f5e8a62c3904">internalId</a>(), <a class="code" href="classGitModel.html#a47f5ebf88be96b003b4bf31bfafff141" title="Returns a child index.">index</a>.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WModelIndex.html#aa4f1385223391c46ee200a57672f6046">row</a>());
    } <span class="keywordflow">else</span>
      <span class="comment">// not a folder: no children</span>
      <span class="keywordflow">return</span> 0;
  } <span class="keywordflow">else</span> {
    treeId = 0;
    <span class="comment">// the index corresponds to the root object</span>
    <span class="keywordflow">if</span> (<a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>.empty())
      <span class="comment">// model not yet loaded !</span>
      <span class="keywordflow">return</span> 0;
    <span class="keywordflow">else</span>
      objectId = <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>[0].treeObject();
  }

  <span class="keywordflow">return</span> <a class="code" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4" title="List of folder objects.">treeData_</a>[treeId].rowCount();
}
</pre></div>
</div>
</div>
<a class="anchor" id="aac776e532822827e59a2233645995e65"></a><!-- doxytag: member="GitModel::setRepositoryPath" ref="aac776e532822827e59a2233645995e65" args="(const std::string &amp;repositoryPath)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void GitModel::setRepositoryPath </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&#160;</td>
          <td class="paramname"><em>repositoryPath</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the repository and load its 'master' revision. </p>

<p>Definition at line <a class="el" href="GitModel_8C_source.html#l00015">15</a> of file <a class="el" href="GitModel_8C_source.html">GitModel.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e" title="The git repository.">git_</a>.<a class="code" href="classGit.html#ab21f8d442557b07321a274b5e976f1ac" title="Set the git repository path.">setRepositoryPath</a>(gitRepositoryPath);
  <a class="code" href="classGitModel.html#af78bddbae2d7b76ec1e49d8626dc7526" title="Load a particular revision.">loadRevision</a>(<span class="stringliteral">&quot;master&quot;</span>);
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a4f3e07cf6dddd098c4c4f0978be0fe90"></a><!-- doxytag: member="GitModel::childPointer_" ref="a4f3e07cf6dddd098c4c4f0978be0fe90" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classGitModel.html#a5bdd5d3dea3e158889afc795b455d103">ChildPointerMap</a> <a class="el" href="classGitModel.html#a4f3e07cf6dddd098c4c4f0978be0fe90">GitModel::childPointer_</a><code> [mutable, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Maps child indexes to tree indexes. </p>
<p>This map provides a way to lookup data in treeData_. It has an entry corresponding to every entry in treeData_: it maps child indexes for folders to indexes in the treeData_ vector.</p>
<p>It is populated on-the-fly, as the user navigates the model. </p>

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00192">192</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>

</div>
</div>
<a class="anchor" id="a49c30024f0241738b30cf4cec589b292"></a><!-- doxytag: member="GitModel::ContentsRole" ref="a49c30024f0241738b30cf4cec589b292" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const int <a class="el" href="classGitModel.html#a49c30024f0241738b30cf4cec589b292">GitModel::ContentsRole</a> = <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">Wt::UserRole</a><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The role which may be used on a file to retrieve its contents. </p>

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00041">41</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>

</div>
</div>
<a class="anchor" id="a9419f872ce68506009748f0595400ef7"></a><!-- doxytag: member="GitModel::FilePathRole" ref="a9419f872ce68506009748f0595400ef7" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">const int <a class="el" href="classGitModel.html#a9419f872ce68506009748f0595400ef7">GitModel::FilePathRole</a> = <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a9b7eae9fc07ea4fd8afe7bc97954162c">Wt::UserRole</a> + 1<code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00042">42</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>

</div>
</div>
<a class="anchor" id="afc8ff43e47ae51ce2af04d63a162be8e"></a><!-- doxytag: member="GitModel::git_" ref="afc8ff43e47ae51ce2af04d63a162be8e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classGit.html">Git</a> <a class="el" href="classGitModel.html#afc8ff43e47ae51ce2af04d63a162be8e">GitModel::git_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The git repository. </p>

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00106">106</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.h</a>.</p>

</div>
</div>
<a class="anchor" id="a59307dfceb1f5712914e0754144422e4"></a><!-- doxytag: member="GitModel::treeData_" ref="a59307dfceb1f5712914e0754144422e4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="classGitModel_1_1Tree.html">Tree</a>&gt; <a class="el" href="classGitModel.html#a59307dfceb1f5712914e0754144422e4">GitModel::treeData_</a><code> [mutable, private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>List of folder objects. </p>
<p>This list contains folders for which a model index has been allocated.</p>
<p>Model indexes have an internal id that are indexes into this vector, identifying the folder that contains a particular file.</p>
<p>Note: only for folders this is needed, since files will never be used as a 'parent' index.</p>
<p>It is populated on-the-fly, as the user navigates the model. </p>

<p>Definition at line <a class="el" href="GitModel_8h_source.html#l00182">182</a> of file <a class="el" href="GitModel_8h_source.html">GitModel.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/gitmodel/<a class="el" href="GitModel_8h_source.html">GitModel.h</a></li>
<li>/home/koen/project/wt/public-git/wt/examples/gitmodel/<a class="el" href="GitModel_8C_source.html">GitModel.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>