PTLib  Version 2.18.8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
spooldir.h
Go to the documentation of this file.
1 /*
2  * spooldir.h
3  *
4  * Spool Directory class
5  *
6  * Portable Windows Library
7  *
8  * Copyright (C) 2011 Post Increment
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Post Increment
23  *
24  * Contributor(s): ______________________________________.
25  *
26  */
27 
28 #ifndef PTLIB_SPOOLDIR_H
29 #define PTLIB_SPOOLDIR_H
30 
31 #ifdef P_USE_PRAGMA
32 #pragma interface
33 #endif
34 
35 
37 
38 #include <ptlib.h>
39 
40 #include <ptlib/pdirect.h>
41 #include <ptclib/guid.h>
42 
44 {
45  public:
47 
48  bool Open(const PDirectory & dir, const PString & type = PString::Empty());
49  void Close();
50  void ThreadMain();
51 
53  {
54  return dir.GetDirectory();
55  }
56 
57  PDirectory GetDirectory() const { return m_directory; }
58 
59  PString CreateLockName(const PString & filename) const;
60 
61  virtual void ProcessEntry();
62  virtual bool OnProcess(const PString & entry);
63  virtual bool OnCleanup(const PString & entry);
64 
65  virtual PString CreateUniqueName() const;
66  virtual bool CreateLockFile(const PString & filename);
67  virtual bool DestroyLockFile(const PString & filename);
68 
69  virtual PString GetLockExtension() const;
70 
71  virtual void SetNotifier(const PNotifier & func);
72 
73  protected:
76 
78 
80 
83 
86 
88 };
89 
90 
91 #endif // PTLIB_SPOOLDIR_H
92 
Class specialisation for PNotifierTemplate&lt;P_INT_PTR&gt;
virtual bool DestroyLockFile(const PString &filename)
virtual void ProcessEntry()
PDirectory m_scanner
Definition: spooldir.h:82
int m_timeoutIfNoDir
Definition: spooldir.h:84
virtual void SetNotifier(const PNotifier &func)
PThread * m_thread
Definition: spooldir.h:75
bool Open(const PDirectory &dir, const PString &type=PString::Empty())
Class to represent a directory in the operating system file system.
Definition: pdirect.h:173
virtual bool OnCleanup(const PString &entry)
PNotifier m_callback
Definition: spooldir.h:87
virtual PString GetLockExtension() const
PDirectory GetDirectory() const
Definition: spooldir.h:57
The character string class.
Definition: pstring.h:108
virtual PString CreateUniqueName() const
PDirectory operator=(const PSpoolDirectory &dir) const
Definition: spooldir.h:52
This class defines a thread mutual exclusion object.
Definition: mutex.h:101
This class defines a thread of execution in the system.
Definition: thread.h:66
static const PString & Empty()
Return an empty string.
PString m_fileType
Definition: spooldir.h:79
PDirectory m_directory
Definition: spooldir.h:77
virtual bool OnProcess(const PString &entry)
int m_scanTimeout
Definition: spooldir.h:85
PMutex m_mutex
Definition: spooldir.h:74
virtual bool CreateLockFile(const PString &filename)
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
Definition: spooldir.h:43
PString CreateLockName(const PString &filename) const
bool m_threadRunning
Definition: spooldir.h:81