Main Page | Class List | File List | Class Members | File Members

incrontab.h

Go to the documentation of this file.
00001 
00003 
00017 #ifndef _INCRONTAB_H_
00018 #define _INCRONTAB_H_
00019 
00020 #include <string>
00021 #include <deque>
00022 
00023 #include "strtok.h"
00024 
00026 #define INCRON_TABLE_BASE "/var/spool/incron/"
00027 
00028 
00030 class InCronTabEntry
00031 {
00032 public:
00034 
00039   InCronTabEntry();
00040 
00042 
00049   InCronTabEntry(const std::string& rPath, uint32_t uMask, const std::string& rCmd);
00050   
00052   ~InCronTabEntry() {}
00053   
00055 
00060   std::string ToString() const;
00061   
00063 
00068   static bool Parse(const std::string& rStr, InCronTabEntry& rEntry);
00069   
00071 
00074   inline const std::string& GetPath() const
00075   {
00076     return m_path;
00077   }
00078   
00080 
00083   inline int32_t GetMask() const
00084   {
00085     return m_uMask;
00086   }
00087   
00089 
00092   inline const std::string& GetCmd() const
00093   {
00094     return m_cmd;
00095   }
00096   
00098 
00101   inline bool IsNoLoop() const
00102   {
00103     return m_fNoLoop;
00104   }
00105   
00106 protected:
00107   std::string m_path; 
00108   uint32_t m_uMask;   
00109   std::string m_cmd;  
00110   bool m_fNoLoop;     
00111 };
00112 
00113 
00115 class InCronTab
00116 {
00117 public:
00119   InCronTab() {}
00120   
00122   ~InCronTab() {}
00123   
00125 
00128   inline void Add(const InCronTabEntry& rEntry)
00129   {
00130     m_tab.push_back(rEntry);
00131   }
00132   
00134   inline void Clear()
00135   {
00136     m_tab.clear();
00137   }
00138   
00140 
00143   inline bool IsEmpty() const
00144   {
00145     return m_tab.empty();
00146   }
00147   
00149 
00152   inline int GetCount() const
00153   {
00154     return (int) m_tab.size();
00155   }
00156   
00158 
00165   inline InCronTabEntry& GetEntry(int index)
00166   {
00167     return m_tab[index];
00168   }
00169   
00171 
00175   bool Load(const std::string& rPath);
00176   
00178 
00182   bool Save(const std::string& rPath);
00183   
00185 
00189   static bool CheckUser(const std::string& rUser);
00190   
00192 
00198   static std::string GetUserTablePath(const std::string& rUser);
00199 
00200 protected:
00201   std::deque<InCronTabEntry> m_tab; 
00202 };
00203 
00204 
00205 #endif //_INCRONTAB_H_

Generated on Sun Oct 29 20:37:51 2006 for incron by  doxygen 1.4.4