File: Git_8h_source.html

package info (click to toggle)
witty 3.2.1-2%2Bdeb7u1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 70,436 kB
  • sloc: cpp: 117,095; ansic: 77,999; xml: 7,564; sh: 1,037; perl: 208; makefile: 144; java: 86; sql: 14
file content (142 lines) | stat: -rw-r--r-- 13,166 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!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
   &#160;<span id="projectnumber">3.2.1</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><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&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;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&#39;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#a5b69585257b84ccd6963468086b224d3" 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#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&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#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>&amp; <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&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#a521bba51875ea14c9e39a14fcde01e04" 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#ab432b071c7d22343a7ac136c35230251" 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#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>&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#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>&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#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>&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#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>&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#a23da7b806839f7a482935a44142b04c9">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#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&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#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&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#a451e493481c2b397497107a6e60a6360" 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>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Fri Mar 30 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>