PTLib Version 2.12.9

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

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 * $Revision$
27 * $Author$
28 * $Date$
29 */
30
31 #ifndef PTLIB_SPOOLDIR_H
32 #define PTLIB_SPOOLDIR_H
33
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37
38
40
41 #include <ptlib.h>
42
43 #include <ptlib/pdirect.h>
44 #include <ptclib/guid.h>
45
46 class PSpoolDirectory : PObject
47 {
48 public:
49 PSpoolDirectory();
50
51 bool Open(const PDirectory & dir, const PString & type = PString::Empty());
52 void Close();
53 void ThreadMain();
54
55 PDirectory operator=(const PSpoolDirectory & dir) const
56 {
57 return dir.GetDirectory();
58 }
59
60 PDirectory GetDirectory() const { return m_directory; }
61
62 PString CreateLockName(const PString & filename) const;
63
64 virtual void ProcessEntry();
65 virtual bool OnProcess(const PString & entry);
66 virtual bool OnCleanup(const PString & entry);
67
68 virtual PString CreateUniqueName() const;
69 virtual bool CreateLockFile(const PString & filename);
70 virtual bool DestroyLockFile(const PString & filename);
71
72 virtual PString GetLockExtension() const;
73
74 virtual void SetNotifier(const PNotifier & func);
75
76 protected:
77 PMutex m_mutex;
78 PThread * m_thread;
79
80 PDirectory m_directory;
81
82 PString m_fileType;
83
84 bool m_threadRunning;
85 PDirectory m_scanner;
86
87 int m_timeoutIfNoDir;
88 int m_scanTimeout;
89
90 PNotifier m_callback;
91 };
92
93
94 #endif // PTLIB_SPOOLDIR_H
95