<!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: /home/koen/project/wt/public-git/wt/examples/gitmodel/Git.h Source File</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  <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 Page</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">/home/koen/project/wt/public-git/wt/examples/gitmodel/Git.h</div> </div> </div> <div class="contents"> <a href="Git_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// This may look like C code, but it's really -*- C++ -*-</span> <a name="l00002"></a>00002 <span class="comment">/*</span> <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span> <a name="l00004"></a>00004 <span class="comment"> *</span> <a name="l00005"></a>00005 <span class="comment"> * See the LICENSE file for terms of use.</span> <a name="l00006"></a>00006 <span class="comment"> */</span> <a name="l00007"></a>00007 <span class="preprocessor">#ifndef GIT_H_</span> <a name="l00008"></a>00008 <span class="preprocessor"></span><span class="preprocessor">#define GIT_H_</span> <a name="l00009"></a>00009 <span class="preprocessor"></span> <a name="l00010"></a>00010 <span class="preprocessor">#include <stdexcept></span> <a name="l00011"></a>00011 <span class="preprocessor">#include <list></span> <a name="l00012"></a>00012 <span class="preprocessor">#include <boost/array.hpp></span> <a name="l00013"></a>00013 <a name="l00018"></a>00018 <a name="l00023"></a><a class="code" href="classGit.html">00023</a> <span class="keyword">class </span><a class="code" href="classGit.html" title="Git utility class for browsing git archives.">Git</a> { <a name="l00024"></a>00024 <span class="keyword">public</span>: <a name="l00027"></a><a class="code" href="classGit_1_1Exception.html">00027</a> <span class="keyword">class </span><a class="code" href="classGit_1_1Exception.html" title="Exception class.">Exception</a> : <span class="keyword">public</span> std::runtime_error { <a name="l00028"></a>00028 <span class="keyword">public</span>: <a name="l00031"></a>00031 <a class="code" href="classGit_1_1Exception.html#a5b69585257b84ccd6963468086b224d3" title="Constructor.">Exception</a>(<span class="keyword">const</span> std::string& msg); <a name="l00032"></a>00032 }; <a name="l00033"></a>00033 <a name="l00038"></a><a class="code" href="classGit_1_1ObjectId.html">00038</a> <span class="keyword">class </span><a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a> : <span class="keyword">public</span> boost::array<unsigned char, 20> { <a name="l00039"></a>00039 <span class="keyword">public</span>: <a name="l00042"></a>00042 <a class="code" href="classGit_1_1ObjectId.html#aa39a26854b93e2a817e85fb5ae1ac001" title="Default constructor.">ObjectId</a>(); <a name="l00043"></a>00043 <a name="l00049"></a>00049 <span class="keyword">explicit</span> <a class="code" href="classGit_1_1ObjectId.html#aa39a26854b93e2a817e85fb5ae1ac001" title="Default constructor.">ObjectId</a>(<span class="keyword">const</span> std::string& <span class="keywordtype">id</span>); <a name="l00050"></a>00050 <a name="l00053"></a>00053 std::string <a class="code" href="classGit_1_1ObjectId.html#a02cf06424f8a867197e28a4163cf8bd0" title="Print as a 40-digit hexadecimal number.">toString</a>() <span class="keyword">const</span>; <a name="l00054"></a>00054 }; <a name="l00055"></a>00055 <a name="l00058"></a><a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aae94d3a7ff6594f6b3b0dc121fbd01564">00058</a> <span class="keyword">enum</span> <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a> { <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aae94d3a7ff6594f6b3b0dc121fbd01564">Tree</a>, <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aa5952f4b5af05765dda2c75c09a1370b6">Commit</a>, <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041aa64c3a7b641cdc0cb2c4203fc0bef1a4a">Blob</a> }; <a name="l00059"></a>00059 <a name="l00062"></a><a class="code" href="structGit_1_1Object.html">00062</a> <span class="keyword">struct </span><a class="code" href="structGit_1_1Object.html" title="Git object.">Object</a> { <a name="l00063"></a><a class="code" href="structGit_1_1Object.html#a2e3989983524516e4a936714b55736ff">00063</a> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a> <a class="code" href="structGit_1_1Object.html#a2e3989983524516e4a936714b55736ff">id</a>; <a name="l00064"></a><a class="code" href="structGit_1_1Object.html#a2ea77791af4fa6012b350469654332cc">00064</a> <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a> <a class="code" href="structGit_1_1Object.html#a2ea77791af4fa6012b350469654332cc">type</a>; <a name="l00065"></a><a class="code" href="structGit_1_1Object.html#adb8686852d572aef8cdb80291e2f81ca">00065</a> std::string <a class="code" href="structGit_1_1Object.html#adb8686852d572aef8cdb80291e2f81ca">name</a>; <a name="l00066"></a>00066 <a name="l00067"></a>00067 <a class="code" href="structGit_1_1Object.html#a1b554a7bec6c5b475324c0bb129875c0">Object</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>& <span class="keywordtype">id</span>, <a class="code" href="classGit.html#ab282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a> <a class="code" href="structGit_1_1Object.html#a2ea77791af4fa6012b350469654332cc">type</a>); <a name="l00068"></a>00068 }; <a name="l00069"></a>00069 <a name="l00072"></a>00072 <a class="code" href="classGit.html#afdc93b8c52e55a1977c9333d71561cd5" title="Constructor.">Git</a>(); <a name="l00073"></a>00073 <a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classGit.html#ab21f8d442557b07321a274b5e976f1ac" title="Set the git repository path.">setRepositoryPath</a>(<span class="keyword">const</span> std::string& repository); <a name="l00079"></a>00079 <a name="l00084"></a>00084 <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a> <a class="code" href="classGit.html#a521bba51875ea14c9e39a14fcde01e04" title="Get the tree for a particular revision.">getCommitTree</a>(<span class="keyword">const</span> std::string& revision) <span class="keyword">const</span>; <a name="l00085"></a>00085 <a name="l00090"></a>00090 <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a> <a class="code" href="classGit.html#ab432b071c7d22343a7ac136c35230251" title="Get the commit for a particular revision.">getCommit</a>(<span class="keyword">const</span> std::string& revision) <span class="keyword">const</span>; <a name="l00091"></a>00091 <a name="l00096"></a>00096 <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a> <a class="code" href="classGit.html#a62bf9de2511aeb8e036a339ec8be8423" title="Get the tree for a particular commit.">getTreeFromCommit</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>& commit) <span class="keyword">const</span>; <a name="l00097"></a>00097 <a name="l00105"></a>00105 <a class="code" href="structGit_1_1Object.html" title="Git object.">Object</a> <a class="code" href="classGit.html#a910f3a6123b494897cdedf7ba4ef648b" title="Get some info on a tree object.">treeGetObject</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>& tree, <span class="keywordtype">int</span> index) <span class="keyword">const</span>; <a name="l00106"></a>00106 <a name="l00111"></a>00111 <span class="keywordtype">int</span> <a class="code" href="classGit.html#abe86381afbbab0adb0680ae268752f1f" title="Return the number of objects inside a tree object.">treeSize</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>& tree) <span class="keyword">const</span>; <a name="l00112"></a>00112 <a name="l00117"></a>00117 std::string <a class="code" href="classGit.html#acf2d699d9f9bdfb42afb0f61e85b2f88" title="Return the raw contents of a git object.">catFile</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>& <span class="keywordtype">id</span>) <span class="keyword">const</span>; <a name="l00118"></a>00118 <a name="l00119"></a><a class="code" href="classGit.html#a23da7b806839f7a482935a44142b04c9">00119</a> <span class="keyword">typedef</span> std::list<std::pair<std::string, std::string> > <a class="code" href="classGit.html#a23da7b806839f7a482935a44142b04c9">Cache</a>; <a name="l00120"></a>00120 <a name="l00121"></a>00121 <span class="keyword">private</span>: <a name="l00124"></a><a class="code" href="classGit.html#a5f478cb0fb21487e60f87b93d4277440">00124</a> std::string <a class="code" href="classGit.html#a5f478cb0fb21487e60f87b93d4277440" title="The path to the repository.">repository_</a>; <a name="l00125"></a>00125 <a name="l00128"></a><a class="code" href="classGit.html#a0097b8efc1e8530cc11133622684e9ef">00128</a> <span class="keyword">mutable</span> <a class="code" href="classGit.html#a23da7b806839f7a482935a44142b04c9">Cache</a> <a class="code" href="classGit.html#a0097b8efc1e8530cc11133622684e9ef" title="A small LRU cache that stores results of git commands.">cache_</a>; <a name="l00129"></a>00129 <a name="l00134"></a>00134 <span class="keywordtype">void</span> <a class="code" href="classGit.html#a04766dfcc9edcae7c12e6ff373176c7c" title="Checks the repository.">checkRepository</a>() <span class="keyword">const</span>; <a name="l00135"></a>00135 <a name="l00144"></a>00144 <span class="keywordtype">bool</span> <a class="code" href="classGit.html#a3dccd1727396de007ec5b43e96930a1b" title="Returns a line identified by a tag from the output of a git command.">getCmdResult</a>(<span class="keyword">const</span> std::string& cmd, std::string& result, <a name="l00145"></a>00145 <span class="keyword">const</span> std::string& tag) <span class="keyword">const</span>; <a name="l00146"></a>00146 <a name="l00155"></a>00155 <span class="keywordtype">bool</span> <a class="code" href="classGit.html#a3dccd1727396de007ec5b43e96930a1b" title="Returns a line identified by a tag from the output of a git command.">getCmdResult</a>(<span class="keyword">const</span> std::string& cmd, std::string& result, <a name="l00156"></a>00156 <span class="keywordtype">int</span> index) <span class="keyword">const</span>; <a name="l00157"></a>00157 <a name="l00162"></a>00162 <span class="keywordtype">int</span> <a class="code" href="classGit.html#a451e493481c2b397497107a6e60a6360" title="Returns the number of lines in the output of a git command.">getCmdResultLineCount</a>(<span class="keyword">const</span> std::string& cmd) <span class="keyword">const</span>; <a name="l00163"></a>00163 }; <a name="l00164"></a>00164 <a name="l00167"></a>00167 <span class="preprocessor">#endif // GIT_H_</span> </pre></div></div> </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 <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>