1 | /* |
2 | This file is part of libkabc. |
3 | |
4 | Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> |
5 | |
6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. |
10 | |
11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02110-1301, USA. |
20 | */ |
21 | #ifndef KABC_LOCKNULL_H |
22 | #define KABC_LOCKNULL_H |
23 | |
24 | #include "lock.h" |
25 | #include <QtCore/QString> |
26 | |
27 | namespace KABC { |
28 | |
29 | /** |
30 | This class provides a lock without actually locking. It can be constructed in |
31 | two ways: One that let all locks succeed and one that let all locks fail. |
32 | */ |
33 | class KABC_DEPRECATED_EXPORT LockNull : public Lock |
34 | { |
35 | public: |
36 | /** |
37 | Creates an instance of the null lock. |
38 | |
39 | @param allowAccess if @c true all calls to lock() will "succeed", |
40 | if @c false all calls to lock() will "fail" |
41 | */ |
42 | LockNull( bool allowAccess ); |
43 | ~LockNull(); |
44 | |
45 | bool lock(); |
46 | bool unlock(); |
47 | |
48 | QString error() const; |
49 | |
50 | private: |
51 | class Private; |
52 | Private *const d; |
53 | }; |
54 | |
55 | } |
56 | |
57 | #endif |
58 | |