Sophie

Sophie

distrib > Mandriva > 2011.0 > x86_64 > by-pkgid > e4e5aca55b6d7244e6bae95bf4fde3ca > files > 106

lib64edelib-devel-2.0-1.x86_64.rpm

<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>edelib: edelib/DirWatch.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">edelib
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</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>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">edelib/DirWatch.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * $Id: DirWatch.h 2839 2009-09-28 11:36:20Z karijes $</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Directory changes notifier</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright (c) 2005-2007 edelib authors</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00008"></a>00008 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
<a name="l00009"></a>00009 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00010"></a>00010 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span>
<a name="l00011"></a>00011 <span class="comment"> *</span>
<a name="l00012"></a>00012 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00013"></a>00013 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00014"></a>00014 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00015"></a>00015 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00016"></a>00016 <span class="comment"> *</span>
<a name="l00017"></a>00017 <span class="comment"> * You should have received a copy of the GNU Lesser General Public License</span>
<a name="l00018"></a>00018 <span class="comment"> * along with this library. If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00019"></a>00019 <span class="comment"> */</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="preprocessor">#ifndef __EDELIB_DIRWATCH_H__</span>
<a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define __EDELIB_DIRWATCH_H__</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;edelib-global.h&quot;</span>
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 EDELIB_NS_BEGIN
<a name="l00027"></a>00027 
<a name="l00032"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17">00032</a> <span class="keyword">enum</span> <a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17" title="Flags telling to DirWatch what changes to monitor.">DirWatchFlags</a> {
<a name="l00033"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17aa1fb79af2ab6ccc8fc9c1653a16dbab7">00033</a>         <a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17aa1fb79af2ab6ccc8fc9c1653a16dbab7" title="In directory item created.">DW_CREATE</a> = (1 &lt;&lt; 1),       
<a name="l00034"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17a1a3676da67752a5f27d218327bd5fc92">00034</a>         DW_MODIFY = (1 &lt;&lt; 2),       
<a name="l00035"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17a65ca1395c73dac10699fd88c1d45eb7c">00035</a>         <a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17a65ca1395c73dac10699fd88c1d45eb7c" title="In directory item is accessed (read, ...)">DW_ACCESS</a> = (1 &lt;&lt; 3),       
<a name="l00036"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17ad0707abc7d9d2dc2e7a540c0987f63c6">00036</a>         DW_RENAME = (1 &lt;&lt; 4),       
<a name="l00037"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17aca2e2aa79adfc262b5a6dc960c0ea5bd">00037</a>         <a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17aca2e2aa79adfc262b5a6dc960c0ea5bd" title="In directory item&#39;s attributes changed.">DW_ATTRIB</a> = (1 &lt;&lt; 5),       
<a name="l00038"></a><a class="code" href="namespaceedelib.html#ab35849a6627668de02a0a2c9807f2e17a186b014a1f2615d19cf5e4cd7c66be5c">00038</a>         DW_DELETE = (1 &lt;&lt; 6)        
<a name="l00039"></a>00039 };
<a name="l00040"></a>00040 
<a name="l00045"></a><a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3">00045</a> <span class="keyword">enum</span> <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3" title="Notifier type used by DirWatch.">DirWatchNotifier</a> {
<a name="l00046"></a><a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3a1bd451db7faeee08771072e8a19fe935">00046</a>         <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3a1bd451db7faeee08771072e8a19fe935" title="None notifier; watching disabled.">DW_NONE</a> = 0,                
<a name="l00047"></a><a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3aa91b1bbb0c68d02dd0383b7baad62c3b">00047</a>         <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3aa91b1bbb0c68d02dd0383b7baad62c3b" title="inotify (linux kernel &gt;= 2.6.13)">DW_INOTIFY</a>,                 
<a name="l00048"></a><a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3adc96abb548ccd3ec50a29503696da318">00048</a>         <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3adc96abb548ccd3ec50a29503696da318" title="FAM/gamin.">DW_FAM</a>                      
<a name="l00049"></a>00049 };
<a name="l00050"></a>00050 
<a name="l00055"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1c">00055</a> <span class="keyword">enum</span> <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1c" title="Returned codes for received event.">DirWatchReportFlags</a> {
<a name="l00056"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca72c08d56e6fc12aa1de7b025e9a3eda3">00056</a>         <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca72c08d56e6fc12aa1de7b025e9a3eda3" title="Not figured out what happened.">DW_REPORT_NONE</a>   = -1,      
<a name="l00057"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca8995840387f7be0b9a70031344d76064">00057</a>         <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca8995840387f7be0b9a70031344d76064" title="A new item was created.">DW_REPORT_CREATE</a> = 0,       
<a name="l00058"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1cac5a3d3a63d472a035cd3cbc041c52c29">00058</a>         <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1cac5a3d3a63d472a035cd3cbc041c52c29" title="Existing item was modified.">DW_REPORT_MODIFY</a>,           
<a name="l00059"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1cadcc40c0747575c89e8f9006baa657665">00059</a>         <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1cadcc40c0747575c89e8f9006baa657665" title="Existing item was renamed.">DW_REPORT_RENAME</a>,           
<a name="l00060"></a><a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca18af2accd8fcaa30c21885a7e2a41eb3">00060</a>         <a class="code" href="namespaceedelib.html#a7b7a63b0248d21b19b17fcb22fdade1ca18af2accd8fcaa30c21885a7e2a41eb3" title="Existing item was deleted.">DW_REPORT_DELETE</a>            
<a name="l00061"></a>00061 };
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 <span class="keyword">struct </span>DirWatchEntry;
<a name="l00064"></a>00064 <span class="keyword">struct </span>DirWatchImpl;
<a name="l00065"></a>00065 
<a name="l00066"></a>00066 <span class="preprocessor">#ifndef SKIP_DOCS</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span><span class="keyword">typedef</span> void (DirWatchCallback)(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir, <span class="keyword">const</span> <span class="keywordtype">char</span>* w, <span class="keywordtype">int</span> flags, <span class="keywordtype">void</span>* data);
<a name="l00068"></a>00068 <span class="preprocessor">#endif</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00180"></a><a class="code" href="classedelib_1_1DirWatch.html">00180</a> <span class="keyword">class </span>EDELIB_API <a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a> {
<a name="l00181"></a>00181 <span class="keyword">private</span>:
<a name="l00182"></a>00182         <span class="keyword">static</span> <a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a>* pinstance;
<a name="l00183"></a>00183 
<a name="l00184"></a>00184         DirWatchImpl*    impl;
<a name="l00185"></a>00185         <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3" title="Notifier type used by DirWatch.">DirWatchNotifier</a> backend_notifier;
<a name="l00186"></a>00186 
<a name="l00187"></a>00187         <span class="keywordtype">bool</span> init_backend(<span class="keywordtype">void</span>);
<a name="l00188"></a>00188 
<a name="l00189"></a>00189         <a class="code" href="group__macros.html#gaef9b2427c1dfe072bc563a6051cc385c">E_DISABLE_CLASS_COPY</a>(<a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a>)
<a name="l00190"></a>00190 <span class="keyword">public</span>:
<a name="l00194"></a>00194         <a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a>();
<a name="l00195"></a>00195 
<a name="l00199"></a>00199         ~<a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a>();
<a name="l00200"></a>00200 
<a name="l00201"></a>00201 <span class="preprocessor">#ifndef SKIP_DOCS</span>
<a name="l00202"></a>00202 <span class="preprocessor"></span>        <span class="keyword">static</span> <a class="code" href="classedelib_1_1DirWatch.html" title="Directory changes notifier.">DirWatch</a>* instance(<span class="keywordtype">void</span>);
<a name="l00203"></a>00203 
<a name="l00204"></a>00204         <span class="keywordtype">bool</span> add_entry(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir, <span class="keywordtype">int</span> flags);
<a name="l00205"></a>00205         <span class="keywordtype">bool</span> remove_entry(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir);
<a name="l00206"></a>00206         <span class="keywordtype">bool</span> have_entry(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir);
<a name="l00207"></a>00207         <span class="keywordtype">void</span> add_callback(DirWatchCallback* cb, <span class="keywordtype">void</span>* data);
<a name="l00208"></a>00208         <span class="keywordtype">void</span> run_callback(<span class="keywordtype">int</span> fd);
<a name="l00209"></a>00209         <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3" title="Notifier type used by DirWatch.">DirWatchNotifier</a> get_notifier(<span class="keywordtype">void</span>) { <span class="keywordflow">return</span> backend_notifier; }
<a name="l00210"></a>00210 <span class="preprocessor">#endif</span>
<a name="l00211"></a>00211 <span class="preprocessor"></span>
<a name="l00215"></a>00215         <span class="keyword">static</span> <span class="keywordtype">bool</span> init(<span class="keywordtype">void</span>);
<a name="l00216"></a>00216 
<a name="l00221"></a>00221         <span class="keyword">static</span> <span class="keywordtype">void</span> shutdown(<span class="keywordtype">void</span>);
<a name="l00222"></a>00222 
<a name="l00228"></a>00228         <span class="keyword">static</span> <span class="keywordtype">bool</span> add(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir, <span class="keywordtype">int</span> flags);
<a name="l00229"></a>00229 
<a name="l00233"></a>00233         <span class="keyword">static</span> <span class="keywordtype">bool</span> <span class="keyword">remove</span>(<span class="keyword">const</span> <span class="keywordtype">char</span>* dir);
<a name="l00234"></a>00234 
<a name="l00239"></a>00239         <span class="keyword">static</span> <span class="keywordtype">void</span> callback(DirWatchCallback&amp; cb, <span class="keywordtype">void</span>* data = 0);
<a name="l00240"></a>00240 
<a name="l00244"></a>00244         <span class="keyword">static</span> <a class="code" href="namespaceedelib.html#a74c565325075c0a87254e283b9bbcef3" title="Notifier type used by DirWatch.">DirWatchNotifier</a> notifier(<span class="keywordtype">void</span>);
<a name="l00245"></a>00245 };
<a name="l00246"></a>00246 
<a name="l00247"></a>00247 EDELIB_NS_END
<a name="l00248"></a>00248 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Tue Jun 5 2012 17:49:02 for edelib by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>