1 | // |
2 | // ValidArgs.h |
3 | // |
4 | // Library: Foundation |
5 | // Package: Cache |
6 | // Module: ValidArgs |
7 | // |
8 | // Definition of the ValidArgs class. |
9 | // |
10 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
11 | // and Contributors. |
12 | // |
13 | // SPDX-License-Identifier: BSL-1.0 |
14 | // |
15 | |
16 | |
17 | #ifndef Foundation_ValidArgs_INCLUDED |
18 | #define Foundation_ValidArgs_INCLUDED |
19 | |
20 | |
21 | #include "Poco/Foundation.h" |
22 | |
23 | |
24 | namespace Poco { |
25 | |
26 | |
27 | template <class TKey> |
28 | class ValidArgs |
29 | { |
30 | public: |
31 | ValidArgs(const TKey& key): |
32 | _key(key), |
33 | _isValid(true) |
34 | { |
35 | } |
36 | |
37 | ValidArgs(const ValidArgs& args): |
38 | _key(args._key), |
39 | _isValid(args._isValid) |
40 | { |
41 | } |
42 | |
43 | ~ValidArgs() |
44 | { |
45 | } |
46 | |
47 | const TKey& key() const |
48 | { |
49 | return _key; |
50 | } |
51 | |
52 | bool isValid() const |
53 | { |
54 | return _isValid; |
55 | } |
56 | |
57 | void invalidate() |
58 | { |
59 | _isValid = false; |
60 | } |
61 | |
62 | protected: |
63 | const TKey& _key; |
64 | bool _isValid; |
65 | |
66 | private: |
67 | ValidArgs& operator = (const ValidArgs& args); |
68 | }; |
69 | |
70 | |
71 | } // namespace Poco |
72 | |
73 | |
74 | #endif // Foundation_ValidArgs_INCLUDED |
75 | |