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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
|
<!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>incron: incrontab.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">incron
 <span id="projectnumber">0.5.10</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="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">incrontab.h</div> </div>
</div>
<div class="contents">
<a href="incrontab_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001
<a name="l00003"></a>00003
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _INCRONTAB_H_</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _INCRONTAB_H_</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include <string></span>
<a name="l00021"></a>00021 <span class="preprocessor">#include <deque></span>
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="strtok_8h.html" title="string tokenizer header">strtok.h</a>"</span>
<a name="l00024"></a>00024
<a name="l00025"></a>00025 <span class="comment">/*</span>
<a name="l00027"></a>00027 <span class="comment">#define INCRON_USER_TABLE_BASE "/var/spool/incron/"</span>
<a name="l00028"></a>00028 <span class="comment"></span>
<a name="l00030"></a>00030 <span class="comment">#define INCRON_SYS_TABLE_BASE "/etc/incron.d/"</span>
<a name="l00031"></a>00031 <span class="comment">*/</span>
<a name="l00032"></a>00032
<a name="l00034"></a><a class="code" href="classIncronTabEntry.html">00034</a> <span class="keyword">class </span><a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036 <span class="keyword">public</span>:
<a name="l00038"></a>00038
<a name="l00043"></a>00043 <a class="code" href="classIncronTabEntry.html#a3b82e45096543af49e3284fd2e3ebb21" title="Constructor.">IncronTabEntry</a>();
<a name="l00044"></a>00044
<a name="l00046"></a>00046
<a name="l00053"></a>00053 <a class="code" href="classIncronTabEntry.html#a3b82e45096543af49e3284fd2e3ebb21" title="Constructor.">IncronTabEntry</a>(<span class="keyword">const</span> std::string& rPath, uint32_t uMask, <span class="keyword">const</span> std::string& rCmd);
<a name="l00054"></a>00054
<a name="l00056"></a><a class="code" href="classIncronTabEntry.html#ae02308fb7784faf554d42fa51063edd3">00056</a> <a class="code" href="classIncronTabEntry.html#ae02308fb7784faf554d42fa51063edd3" title="Destructor.">~IncronTabEntry</a>() {}
<a name="l00057"></a>00057
<a name="l00059"></a>00059
<a name="l00064"></a>00064 std::string <a class="code" href="classIncronTabEntry.html#a62ec7f62ad28b984420dc4c78b204600" title="Converts the entry to string representation.">ToString</a>() <span class="keyword">const</span>;
<a name="l00065"></a>00065
<a name="l00067"></a>00067
<a name="l00072"></a>00072 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#afc6647d1ec6aec2c52ad7488264b961b" title="Parses a string and attempts to extract entry parameters.">Parse</a>(<span class="keyword">const</span> std::string& rStr, <a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>& rEntry);
<a name="l00073"></a>00073
<a name="l00075"></a>00075
<a name="l00078"></a><a class="code" href="classIncronTabEntry.html#af2abda30bace975f720479dc97959d68">00078</a> <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classIncronTabEntry.html#af2abda30bace975f720479dc97959d68" title="Returns the watch filesystem path.">GetPath</a>()<span class="keyword"> const</span>
<a name="l00079"></a>00079 <span class="keyword"> </span>{
<a name="l00080"></a>00080 <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#a836fec204ac70c855f229d011c1e1629" title="watch path">m_path</a>;
<a name="l00081"></a>00081 }
<a name="l00082"></a>00082
<a name="l00084"></a>00084
<a name="l00087"></a><a class="code" href="classIncronTabEntry.html#a08dece0f96a74a72233b4287bd131d6d">00087</a> <span class="keyword">inline</span> int32_t <a class="code" href="classIncronTabEntry.html#a08dece0f96a74a72233b4287bd131d6d" title="Returns the event mask.">GetMask</a>()<span class="keyword"> const</span>
<a name="l00088"></a>00088 <span class="keyword"> </span>{
<a name="l00089"></a>00089 <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#ad317024cf370d856765e7a210904d87e" title="event mask">m_uMask</a>;
<a name="l00090"></a>00090 }
<a name="l00091"></a>00091
<a name="l00093"></a>00093
<a name="l00096"></a><a class="code" href="classIncronTabEntry.html#a0ace542d7f8f49a38b2d51e43f27e78e">00096</a> <span class="keyword">inline</span> <span class="keyword">const</span> std::string& <a class="code" href="classIncronTabEntry.html#a0ace542d7f8f49a38b2d51e43f27e78e" title="Returns the command string.">GetCmd</a>()<span class="keyword"> const</span>
<a name="l00097"></a>00097 <span class="keyword"> </span>{
<a name="l00098"></a>00098 <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#a4aeaa40804ebaa78dd84edbce86fdae4" title="command string">m_cmd</a>;
<a name="l00099"></a>00099 }
<a name="l00100"></a>00100
<a name="l00102"></a>00102
<a name="l00105"></a><a class="code" href="classIncronTabEntry.html#ad4b1ff4fbf637ef58046bad6955dc3ac">00105</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#ad4b1ff4fbf637ef58046bad6955dc3ac" title="Checks whether this entry has set loop-avoidance.">IsNoLoop</a>()<span class="keyword"> const</span>
<a name="l00106"></a>00106 <span class="keyword"> </span>{
<a name="l00107"></a>00107 <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#a91049dc7f267a5613cfcd8c6247c9e4f" title="no loop yes/no">m_fNoLoop</a>;
<a name="l00108"></a>00108 }
<a name="l00109"></a>00109
<a name="l00111"></a>00111
<a name="l00123"></a>00123 <span class="keyword">static</span> std::string <a class="code" href="classIncronTabEntry.html#a4812bc8f0d5291eacc8e66fda8fe1d13" title="Add backslashes before spaces in the source path.">GetSafePath</a>(<span class="keyword">const</span> std::string& rPath);
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="keyword">protected</span>:
<a name="l00126"></a><a class="code" href="classIncronTabEntry.html#a836fec204ac70c855f229d011c1e1629">00126</a> std::string <a class="code" href="classIncronTabEntry.html#a836fec204ac70c855f229d011c1e1629" title="watch path">m_path</a>;
<a name="l00127"></a><a class="code" href="classIncronTabEntry.html#ad317024cf370d856765e7a210904d87e">00127</a> uint32_t <a class="code" href="classIncronTabEntry.html#ad317024cf370d856765e7a210904d87e" title="event mask">m_uMask</a>;
<a name="l00128"></a><a class="code" href="classIncronTabEntry.html#a4aeaa40804ebaa78dd84edbce86fdae4">00128</a> std::string <a class="code" href="classIncronTabEntry.html#a4aeaa40804ebaa78dd84edbce86fdae4" title="command string">m_cmd</a>;
<a name="l00129"></a><a class="code" href="classIncronTabEntry.html#a91049dc7f267a5613cfcd8c6247c9e4f">00129</a> <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#a91049dc7f267a5613cfcd8c6247c9e4f" title="no loop yes/no">m_fNoLoop</a>;
<a name="l00130"></a>00130 };
<a name="l00131"></a>00131
<a name="l00132"></a>00132
<a name="l00134"></a><a class="code" href="classIncronTab.html">00134</a> <span class="keyword">class </span><a class="code" href="classIncronTab.html" title="Incron table class.">IncronTab</a>
<a name="l00135"></a>00135 {
<a name="l00136"></a>00136 <span class="keyword">public</span>:
<a name="l00138"></a><a class="code" href="classIncronTab.html#a9ff09c9b375176fc2b96b2e9c523e037">00138</a> <a class="code" href="classIncronTab.html#a9ff09c9b375176fc2b96b2e9c523e037" title="Constructor.">IncronTab</a>() {}
<a name="l00139"></a>00139
<a name="l00141"></a><a class="code" href="classIncronTab.html#a4ec208d89d7b11503ebfe54391a59b81">00141</a> <a class="code" href="classIncronTab.html#a4ec208d89d7b11503ebfe54391a59b81" title="Destructor.">~IncronTab</a>() {}
<a name="l00142"></a>00142
<a name="l00144"></a>00144
<a name="l00147"></a><a class="code" href="classIncronTab.html#af54355a6241c05ac955486d47f18fb50">00147</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classIncronTab.html#af54355a6241c05ac955486d47f18fb50" title="Add an entry to the table.">Add</a>(<span class="keyword">const</span> <a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>& rEntry)
<a name="l00148"></a>00148 {
<a name="l00149"></a>00149 <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.push_back(rEntry);
<a name="l00150"></a>00150 }
<a name="l00151"></a>00151
<a name="l00153"></a><a class="code" href="classIncronTab.html#a5fc3d14ccb6a17b4c19c3df04ea979b8">00153</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classIncronTab.html#a5fc3d14ccb6a17b4c19c3df04ea979b8" title="Removes all entries.">Clear</a>()
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155 <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.clear();
<a name="l00156"></a>00156 }
<a name="l00157"></a>00157
<a name="l00159"></a>00159
<a name="l00162"></a><a class="code" href="classIncronTab.html#aee67b6f3d9202fe659ca9f48ea316669">00162</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#aee67b6f3d9202fe659ca9f48ea316669" title="Checks whether the table is empty.">IsEmpty</a>()<span class="keyword"> const</span>
<a name="l00163"></a>00163 <span class="keyword"> </span>{
<a name="l00164"></a>00164 <span class="keywordflow">return</span> <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.empty();
<a name="l00165"></a>00165 }
<a name="l00166"></a>00166
<a name="l00168"></a>00168
<a name="l00171"></a><a class="code" href="classIncronTab.html#a73b95d66e3feed3d7c8cb6ee2cd4dcc0">00171</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classIncronTab.html#a73b95d66e3feed3d7c8cb6ee2cd4dcc0" title="Returns the count of entries.">GetCount</a>()<span class="keyword"> const</span>
<a name="l00172"></a>00172 <span class="keyword"> </span>{
<a name="l00173"></a>00173 <span class="keywordflow">return</span> (<span class="keywordtype">int</span>) <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.size();
<a name="l00174"></a>00174 }
<a name="l00175"></a>00175
<a name="l00177"></a>00177
<a name="l00184"></a><a class="code" href="classIncronTab.html#ab2b3ef9db60949d666a6316b4698074a">00184</a> <span class="keyword">inline</span> <a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>& <a class="code" href="classIncronTab.html#ab2b3ef9db60949d666a6316b4698074a" title="Returns an entry.">GetEntry</a>(<span class="keywordtype">int</span> index)
<a name="l00185"></a>00185 {
<a name="l00186"></a>00186 <span class="keywordflow">return</span> <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>[index];
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188
<a name="l00190"></a>00190
<a name="l00194"></a>00194 <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#a3e15c2a29bda1cd4118359736a75e905" title="Loads the table.">Load</a>(<span class="keyword">const</span> std::string& rPath);
<a name="l00195"></a>00195
<a name="l00197"></a>00197
<a name="l00201"></a>00201 <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#a6bb007c88e2efb823b96536b54bcb05b" title="Saves the table.">Save</a>(<span class="keyword">const</span> std::string& rPath);
<a name="l00202"></a>00202
<a name="l00204"></a>00204
<a name="l00208"></a>00208 <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#a887ffc0116f2e892178db882420e5aaa" title="Checks whether an user has permission to use incron.">CheckUser</a>(<span class="keyword">const</span> std::string& rUser);
<a name="l00209"></a>00209
<a name="l00211"></a>00211
<a name="l00217"></a>00217 <span class="keyword">static</span> std::string <a class="code" href="classIncronTab.html#a41994a129d3e38a2f032318d53f4e888" title="Composes a path to an user incron table file.">GetUserTablePath</a>(<span class="keyword">const</span> std::string& rUser);
<a name="l00218"></a>00218
<a name="l00220"></a>00220
<a name="l00226"></a>00226 <span class="keyword">static</span> std::string <a class="code" href="classIncronTab.html#a55f610c3405db0d48d0a759e3180cf7b" title="Composes a path to a system incron table file.">GetSystemTablePath</a>(<span class="keyword">const</span> std::string& rName);
<a name="l00227"></a>00227
<a name="l00228"></a>00228 <span class="keyword">protected</span>:
<a name="l00229"></a><a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7">00229</a> std::deque<IncronTabEntry> <a class="code" href="classIncronTab.html#afc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>;
<a name="l00230"></a>00230 };
<a name="l00231"></a>00231
<a name="l00232"></a>00232
<a name="l00233"></a>00233 <span class="preprocessor">#endif //_INCRONTAB_H_</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>
</body>
</html>
|