File: Git_8h-source.html

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (96 lines) | stat: -rw-r--r-- 12,213 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/gitmodel/Git.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>/home/koen/project/wt/public-git/wt/examples/gitmodel/Git.h</h1><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 &lt;stdexcept&gt;</span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;boost/array.hpp&gt;</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#5b69585257b84ccd6963468086b224d3" title="Constructor.">Exception</a>(<span class="keyword">const</span> std::string&amp; 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&lt;unsigned char, 20&gt; {
<a name="l00039"></a>00039   <span class="keyword">public</span>:
<a name="l00042"></a>00042     <a class="code" href="classGit_1_1ObjectId.html#a39a26854b93e2a817e85fb5ae1ac001" 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#a39a26854b93e2a817e85fb5ae1ac001" title="Default constructor.">ObjectId</a>(<span class="keyword">const</span> std::string&amp; <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#02cf06424f8a867197e28a4163cf8bd0" 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#b282f46c36a47ddff9bc7be7c993041ae94d3a7ff6594f6b3b0dc121fbd01564">00058</a>   <span class="keyword">enum</span> <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a> { <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041ae94d3a7ff6594f6b3b0dc121fbd01564">Tree</a>, <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041a5952f4b5af05765dda2c75c09a1370b6">Commit</a>, <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041a64c3a7b641cdc0cb2c4203fc0bef1a4a">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#2e3989983524516e4a936714b55736ff">00063</a>     <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>    <a class="code" href="structGit_1_1Object.html#2e3989983524516e4a936714b55736ff">id</a>;
<a name="l00064"></a><a class="code" href="structGit_1_1Object.html#2ea77791af4fa6012b350469654332cc">00064</a>     <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a>  <a class="code" href="structGit_1_1Object.html#2ea77791af4fa6012b350469654332cc">type</a>;
<a name="l00065"></a><a class="code" href="structGit_1_1Object.html#db8686852d572aef8cdb80291e2f81ca">00065</a>     std::string <a class="code" href="structGit_1_1Object.html#db8686852d572aef8cdb80291e2f81ca">name</a>;
<a name="l00066"></a>00066 
<a name="l00067"></a>00067     <a class="code" href="structGit_1_1Object.html#1b554a7bec6c5b475324c0bb129875c0">Object</a>(<span class="keyword">const</span> <a class="code" href="classGit_1_1ObjectId.html" title="Git object Id.">ObjectId</a>&amp; <span class="keywordtype">id</span>, <a class="code" href="classGit.html#b282f46c36a47ddff9bc7be7c993041a" title="Git object type.">ObjectType</a> <a class="code" href="structGit_1_1Object.html#2ea77791af4fa6012b350469654332cc">type</a>);
<a name="l00068"></a>00068   };
<a name="l00069"></a>00069 
<a name="l00072"></a>00072   <a class="code" href="classGit.html#fdc93b8c52e55a1977c9333d71561cd5" 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#b21f8d442557b07321a274b5e976f1ac" title="Set the git repository path.">setRepositoryPath</a>(<span class="keyword">const</span> std::string&amp; 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#521bba51875ea14c9e39a14fcde01e04" title="Get the tree for a particular revision.">getCommitTree</a>(<span class="keyword">const</span> std::string&amp; 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#b432b071c7d22343a7ac136c35230251" title="Get the commit for a particular revision.">getCommit</a>(<span class="keyword">const</span> std::string&amp; 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#62bf9de2511aeb8e036a339ec8be8423" 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>&amp; 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#910f3a6123b494897cdedf7ba4ef648b" 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>&amp; 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#be86381afbbab0adb0680ae268752f1f" 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>&amp; tree) <span class="keyword">const</span>;
<a name="l00112"></a>00112 
<a name="l00117"></a>00117   std::string <a class="code" href="classGit.html#cf2d699d9f9bdfb42afb0f61e85b2f88" 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>&amp; <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#23da7b806839f7a482935a44142b04c9">00119</a>   <span class="keyword">typedef</span> std::list&lt;std::pair&lt;std::string, std::string&gt; &gt; <a class="code" href="classGit.html#23da7b806839f7a482935a44142b04c9">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#5f478cb0fb21487e60f87b93d4277440">00124</a>   std::string <a class="code" href="classGit.html#5f478cb0fb21487e60f87b93d4277440" title="The path to the repository.">repository_</a>;
<a name="l00125"></a>00125 
<a name="l00128"></a><a class="code" href="classGit.html#0097b8efc1e8530cc11133622684e9ef">00128</a>   <span class="keyword">mutable</span> <a class="code" href="classGit.html#23da7b806839f7a482935a44142b04c9">Cache</a> <a class="code" href="classGit.html#0097b8efc1e8530cc11133622684e9ef" 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#04766dfcc9edcae7c12e6ff373176c7c" 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#3dccd1727396de007ec5b43e96930a1b" title="Returns a line identified by a tag from the output of a git command.">getCmdResult</a>(<span class="keyword">const</span> std::string&amp; cmd, std::string&amp; result,
<a name="l00145"></a>00145                     <span class="keyword">const</span> std::string&amp; 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#3dccd1727396de007ec5b43e96930a1b" title="Returns a line identified by a tag from the output of a git command.">getCmdResult</a>(<span class="keyword">const</span> std::string&amp; cmd, std::string&amp; 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#451e493481c2b397497107a6e60a6360" title="Returns the number of lines in the output of a git command.">getCmdResultLineCount</a>(<span class="keyword">const</span> std::string&amp; 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>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>