FXFSMonitor.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            Filing system monitor                              *
00004 *                                                                               *
00005 *********************************************************************************
00006 *        Copyright (C) 2003-2008 by Niall Douglas.   All Rights Reserved.       *
00007 *       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
00008 *********************************************************************************
00009 * This code is free software; you can redistribute it and/or modify it under    *
00010 * the terms of the GNU Library General Public License v2.1 as published by the  *
00011 * Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
00012 * "upgrade" this code to the GPL without my prior written permission.           *
00013 * Please consult the file "License_Addendum2.txt" accompanying this file.       *
00014 *                                                                               *
00015 * This code is distributed in the hope that it will be useful,                  *
00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
00018 *********************************************************************************
00019 * $Id:                                                                          *
00020 ********************************************************************************/
00021 
00022 #ifndef FXFSMONITOR_H
00023 #define FXFSMONITOR_H
00024 
00025 #include "FXGenericTools.h"
00026 
00027 namespace FX {
00028 
00033 class FXString;
00034 class QFileInfo;
00035 
00113 class FXAPIR FXFSMonitor
00114 {
00115 public:
00117     struct Change
00118     {
00119         FXulong eventNo;            
00120         FXuint modified : 1;        
00121         FXuint created  : 1;        
00122         FXuint deleted  : 1;        
00123         FXuint renamed  : 1;        
00124         FXuint attrib   : 1;        
00125         FXuint security : 1;        
00126         Change() : eventNo(0), modified(false), created(false), deleted(false), renamed(false), attrib(false), security(false) { }
00127         Change(int) : eventNo(0), modified(true), created(true), deleted(true), renamed(true), attrib(true), security(true) { }
00128         operator FXuint() const throw()
00129         {
00130             struct Change_ { FXulong eventNo; FXuint flags; } *me=(Change_ *) this;
00131             return me->flags;
00132         }
00134         Change &setModified(bool v=true) throw()    { modified=v; return *this; }
00136         Change &setCreated(bool v=true) throw()     { created=v; return *this; }
00138         Change &setDeleted(bool v=true) throw()     { deleted=v; return *this; }
00140         Change &setRenamed(bool v=true) throw()     { renamed=v; return *this; }
00142         Change &setAttrib(bool v=true) throw()      { attrib=v; return *this; }
00144         Change &setSecurity(bool v=true) throw()    { security=v; return *this; }
00145     };
00146     typedef Generic::TL::create<void, Change, QFileInfo, QFileInfo>::value ChangeHandlerPars;
00148     typedef Generic::Functor<ChangeHandlerPars> ChangeHandler;
00150     static void add(const FXString &path, ChangeHandler handler);
00152     static bool remove(const FXString &path, ChangeHandler handler);
00153 };
00154 
00155 } // namespace
00156 
00157 #endif

(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:31:21 2009 for TnFOX by doxygen v1.4.7