PageRenderTime 66ms CodeModel.GetById 25ms app.highlight 34ms RepoModel.GetById 1ms app.codeStats 0ms

/incron-0.5.9/doc/html/incrontab_8h-source.html

#
HTML | 146 lines | 145 code | 0 blank | 1 comment | 0 complexity | 9e10e48458c8f2d3bf96768bad42e522 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  3<title>incron: incrontab.h Source File</title>
  4<link href="doxygen.css" rel="stylesheet" type="text/css">
  5<link href="tabs.css" rel="stylesheet" type="text/css">
  6</head><body>
  7<!-- Generated by Doxygen 1.5.6 -->
  8<div class="navigation" id="top">
  9  <div class="tabs">
 10    <ul>
 11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
 12      <li><a href="annotated.html"><span>Classes</span></a></li>
 13      <li class="current"><a href="files.html"><span>Files</span></a></li>
 14    </ul>
 15  </div>
 16<h1>incrontab.h</h1><a href="incrontab_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
 17<a name="l00003"></a>00003 
 18<a name="l00017"></a>00017 <span class="preprocessor">#ifndef _INCRONTAB_H_</span>
 19<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define _INCRONTAB_H_</span>
 20<a name="l00019"></a>00019 <span class="preprocessor"></span>
 21<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;string&gt;</span>
 22<a name="l00021"></a>00021 <span class="preprocessor">#include &lt;deque&gt;</span>
 23<a name="l00022"></a>00022 
 24<a name="l00023"></a>00023 <span class="preprocessor">#include "<a class="code" href="strtok_8h.html" title="string tokenizer header">strtok.h</a>"</span>
 25<a name="l00024"></a>00024 
 26<a name="l00025"></a>00025 <span class="comment">/*</span>
 27<a name="l00027"></a>00027 <span class="comment">#define INCRON_USER_TABLE_BASE "/var/spool/incron/"</span>
 28<a name="l00028"></a>00028 <span class="comment"></span>
 29<a name="l00030"></a>00030 <span class="comment">#define INCRON_SYS_TABLE_BASE "/etc/incron.d/"</span>
 30<a name="l00031"></a>00031 <span class="comment">*/</span>
 31<a name="l00032"></a>00032 
 32<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>
 33<a name="l00035"></a>00035 {
 34<a name="l00036"></a>00036 <span class="keyword">public</span>:
 35<a name="l00038"></a>00038 
 36<a name="l00043"></a>00043   <a class="code" href="classIncronTabEntry.html#3b82e45096543af49e3284fd2e3ebb21" title="Constructor.">IncronTabEntry</a>();
 37<a name="l00044"></a>00044 
 38<a name="l00046"></a>00046 
 39<a name="l00053"></a>00053   <a class="code" href="classIncronTabEntry.html#3b82e45096543af49e3284fd2e3ebb21" title="Constructor.">IncronTabEntry</a>(<span class="keyword">const</span> std::string&amp; rPath, uint32_t uMask, <span class="keyword">const</span> std::string&amp; rCmd);
 40<a name="l00054"></a>00054   
 41<a name="l00056"></a><a class="code" href="classIncronTabEntry.html#e02308fb7784faf554d42fa51063edd3">00056</a>   <a class="code" href="classIncronTabEntry.html#e02308fb7784faf554d42fa51063edd3" title="Destructor.">~IncronTabEntry</a>() {}
 42<a name="l00057"></a>00057   
 43<a name="l00059"></a>00059 
 44<a name="l00064"></a>00064   std::string <a class="code" href="classIncronTabEntry.html#62ec7f62ad28b984420dc4c78b204600" title="Converts the entry to string representation.">ToString</a>() <span class="keyword">const</span>;
 45<a name="l00065"></a>00065   
 46<a name="l00067"></a>00067 
 47<a name="l00072"></a>00072   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#fc6647d1ec6aec2c52ad7488264b961b" title="Parses a string and attempts to extract entry parameters.">Parse</a>(<span class="keyword">const</span> std::string&amp; rStr, <a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>&amp; rEntry);
 48<a name="l00073"></a>00073   
 49<a name="l00075"></a>00075 
 50<a name="l00078"></a><a class="code" href="classIncronTabEntry.html#f2abda30bace975f720479dc97959d68">00078</a>   <span class="keyword">inline</span> <span class="keyword">const</span> std::string&amp; <a class="code" href="classIncronTabEntry.html#f2abda30bace975f720479dc97959d68" title="Returns the watch filesystem path.">GetPath</a>()<span class="keyword"> const</span>
 51<a name="l00079"></a>00079 <span class="keyword">  </span>{
 52<a name="l00080"></a>00080     <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#836fec204ac70c855f229d011c1e1629" title="watch path">m_path</a>;
 53<a name="l00081"></a>00081   }
 54<a name="l00082"></a>00082   
 55<a name="l00084"></a>00084 
 56<a name="l00087"></a><a class="code" href="classIncronTabEntry.html#08dece0f96a74a72233b4287bd131d6d">00087</a>   <span class="keyword">inline</span> int32_t <a class="code" href="classIncronTabEntry.html#08dece0f96a74a72233b4287bd131d6d" title="Returns the event mask.">GetMask</a>()<span class="keyword"> const</span>
 57<a name="l00088"></a>00088 <span class="keyword">  </span>{
 58<a name="l00089"></a>00089     <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#d317024cf370d856765e7a210904d87e" title="event mask">m_uMask</a>;
 59<a name="l00090"></a>00090   }
 60<a name="l00091"></a>00091   
 61<a name="l00093"></a>00093 
 62<a name="l00096"></a><a class="code" href="classIncronTabEntry.html#0ace542d7f8f49a38b2d51e43f27e78e">00096</a>   <span class="keyword">inline</span> <span class="keyword">const</span> std::string&amp; <a class="code" href="classIncronTabEntry.html#0ace542d7f8f49a38b2d51e43f27e78e" title="Returns the command string.">GetCmd</a>()<span class="keyword"> const</span>
 63<a name="l00097"></a>00097 <span class="keyword">  </span>{
 64<a name="l00098"></a>00098     <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#4aeaa40804ebaa78dd84edbce86fdae4" title="command string">m_cmd</a>;
 65<a name="l00099"></a>00099   }
 66<a name="l00100"></a>00100   
 67<a name="l00102"></a>00102 
 68<a name="l00105"></a><a class="code" href="classIncronTabEntry.html#d4b1ff4fbf637ef58046bad6955dc3ac">00105</a>   <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#d4b1ff4fbf637ef58046bad6955dc3ac" title="Checks whether this entry has set loop-avoidance.">IsNoLoop</a>()<span class="keyword"> const</span>
 69<a name="l00106"></a>00106 <span class="keyword">  </span>{
 70<a name="l00107"></a>00107     <span class="keywordflow">return</span> <a class="code" href="classIncronTabEntry.html#91049dc7f267a5613cfcd8c6247c9e4f" title="no loop yes/no">m_fNoLoop</a>;
 71<a name="l00108"></a>00108   }
 72<a name="l00109"></a>00109   
 73<a name="l00111"></a>00111 
 74<a name="l00123"></a>00123   <span class="keyword">static</span> std::string <a class="code" href="classIncronTabEntry.html#4812bc8f0d5291eacc8e66fda8fe1d13" title="Add backslashes before spaces in the source path.">GetSafePath</a>(<span class="keyword">const</span> std::string&amp; rPath);
 75<a name="l00124"></a>00124   
 76<a name="l00125"></a>00125 <span class="keyword">protected</span>:
 77<a name="l00126"></a><a class="code" href="classIncronTabEntry.html#836fec204ac70c855f229d011c1e1629">00126</a>   std::string <a class="code" href="classIncronTabEntry.html#836fec204ac70c855f229d011c1e1629" title="watch path">m_path</a>; 
 78<a name="l00127"></a><a class="code" href="classIncronTabEntry.html#d317024cf370d856765e7a210904d87e">00127</a>   uint32_t <a class="code" href="classIncronTabEntry.html#d317024cf370d856765e7a210904d87e" title="event mask">m_uMask</a>;   
 79<a name="l00128"></a><a class="code" href="classIncronTabEntry.html#4aeaa40804ebaa78dd84edbce86fdae4">00128</a>   std::string <a class="code" href="classIncronTabEntry.html#4aeaa40804ebaa78dd84edbce86fdae4" title="command string">m_cmd</a>;  
 80<a name="l00129"></a><a class="code" href="classIncronTabEntry.html#91049dc7f267a5613cfcd8c6247c9e4f">00129</a>   <span class="keywordtype">bool</span> <a class="code" href="classIncronTabEntry.html#91049dc7f267a5613cfcd8c6247c9e4f" title="no loop yes/no">m_fNoLoop</a>;     
 81<a name="l00130"></a>00130 };
 82<a name="l00131"></a>00131 
 83<a name="l00132"></a>00132 
 84<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>
 85<a name="l00135"></a>00135 {
 86<a name="l00136"></a>00136 <span class="keyword">public</span>:
 87<a name="l00138"></a><a class="code" href="classIncronTab.html#9ff09c9b375176fc2b96b2e9c523e037">00138</a>   <a class="code" href="classIncronTab.html#9ff09c9b375176fc2b96b2e9c523e037" title="Constructor.">IncronTab</a>() {}
 88<a name="l00139"></a>00139   
 89<a name="l00141"></a><a class="code" href="classIncronTab.html#4ec208d89d7b11503ebfe54391a59b81">00141</a>   <a class="code" href="classIncronTab.html#4ec208d89d7b11503ebfe54391a59b81" title="Destructor.">~IncronTab</a>() {}
 90<a name="l00142"></a>00142   
 91<a name="l00144"></a>00144 
 92<a name="l00147"></a><a class="code" href="classIncronTab.html#f54355a6241c05ac955486d47f18fb50">00147</a>   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classIncronTab.html#f54355a6241c05ac955486d47f18fb50" 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>&amp; rEntry)
 93<a name="l00148"></a>00148   {
 94<a name="l00149"></a>00149     <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.push_back(rEntry);
 95<a name="l00150"></a>00150   }
 96<a name="l00151"></a>00151   
 97<a name="l00153"></a><a class="code" href="classIncronTab.html#5fc3d14ccb6a17b4c19c3df04ea979b8">00153</a>   <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="classIncronTab.html#5fc3d14ccb6a17b4c19c3df04ea979b8" title="Removes all entries.">Clear</a>()
 98<a name="l00154"></a>00154   {
 99<a name="l00155"></a>00155     <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.clear();
100<a name="l00156"></a>00156   }
101<a name="l00157"></a>00157   
102<a name="l00159"></a>00159 
103<a name="l00162"></a><a class="code" href="classIncronTab.html#ee67b6f3d9202fe659ca9f48ea316669">00162</a>   <span class="keyword">inline</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#ee67b6f3d9202fe659ca9f48ea316669" title="Checks whether the table is empty.">IsEmpty</a>()<span class="keyword"> const</span>
104<a name="l00163"></a>00163 <span class="keyword">  </span>{
105<a name="l00164"></a>00164     <span class="keywordflow">return</span> <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.empty();
106<a name="l00165"></a>00165   }
107<a name="l00166"></a>00166   
108<a name="l00168"></a>00168 
109<a name="l00171"></a><a class="code" href="classIncronTab.html#73b95d66e3feed3d7c8cb6ee2cd4dcc0">00171</a>   <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="classIncronTab.html#73b95d66e3feed3d7c8cb6ee2cd4dcc0" title="Returns the count of entries.">GetCount</a>()<span class="keyword"> const</span>
110<a name="l00172"></a>00172 <span class="keyword">  </span>{
111<a name="l00173"></a>00173     <span class="keywordflow">return</span> (<span class="keywordtype">int</span>) <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>.size();
112<a name="l00174"></a>00174   }
113<a name="l00175"></a>00175   
114<a name="l00177"></a>00177 
115<a name="l00184"></a><a class="code" href="classIncronTab.html#b2b3ef9db60949d666a6316b4698074a">00184</a>   <span class="keyword">inline</span> <a class="code" href="classIncronTabEntry.html" title="Incron table entry class.">IncronTabEntry</a>&amp; <a class="code" href="classIncronTab.html#b2b3ef9db60949d666a6316b4698074a" title="Returns an entry.">GetEntry</a>(<span class="keywordtype">int</span> index)
116<a name="l00185"></a>00185   {
117<a name="l00186"></a>00186     <span class="keywordflow">return</span> <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>[index];
118<a name="l00187"></a>00187   }
119<a name="l00188"></a>00188   
120<a name="l00190"></a>00190 
121<a name="l00194"></a>00194   <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#3e15c2a29bda1cd4118359736a75e905" title="Loads the table.">Load</a>(<span class="keyword">const</span> std::string&amp; rPath);
122<a name="l00195"></a>00195   
123<a name="l00197"></a>00197 
124<a name="l00201"></a>00201   <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#6bb007c88e2efb823b96536b54bcb05b" title="Saves the table.">Save</a>(<span class="keyword">const</span> std::string&amp; rPath);
125<a name="l00202"></a>00202   
126<a name="l00204"></a>00204 
127<a name="l00208"></a>00208   <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classIncronTab.html#887ffc0116f2e892178db882420e5aaa" title="Checks whether an user has permission to use incron.">CheckUser</a>(<span class="keyword">const</span> std::string&amp; rUser);
128<a name="l00209"></a>00209   
129<a name="l00211"></a>00211 
130<a name="l00217"></a>00217   <span class="keyword">static</span> std::string <a class="code" href="classIncronTab.html#41994a129d3e38a2f032318d53f4e888" title="Composes a path to an user incron table file.">GetUserTablePath</a>(<span class="keyword">const</span> std::string&amp; rUser);
131<a name="l00218"></a>00218   
132<a name="l00220"></a>00220 
133<a name="l00226"></a>00226   <span class="keyword">static</span> std::string <a class="code" href="classIncronTab.html#55f610c3405db0d48d0a759e3180cf7b" title="Composes a path to a system incron table file.">GetSystemTablePath</a>(<span class="keyword">const</span> std::string&amp; rName);
134<a name="l00227"></a>00227 
135<a name="l00228"></a>00228 <span class="keyword">protected</span>:
136<a name="l00229"></a><a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7">00229</a>   std::deque&lt;IncronTabEntry&gt; <a class="code" href="classIncronTab.html#fc0c07b696470b29c2173e4dcf313bc7" title="incron table">m_tab</a>; 
137<a name="l00230"></a>00230 };
138<a name="l00231"></a>00231 
139<a name="l00232"></a>00232 
140<a name="l00233"></a>00233 <span class="preprocessor">#endif //_INCRONTAB_H_</span>
141</pre></div></div>
142<hr size="1"><address style="text-align: right;"><small>Generated on Sun Jun 21 22:27:24 2009 for incron by&nbsp;
143<a href="http://www.doxygen.org/index.html">
144<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>
145</body>
146</html>