root / trunk / tbeta / Linux / libs / poco / include / Poco / ValidArgs.h @ 164

View | Annotate | Download (2.2 KB)

1 164 ss
//
2 164 ss
// ValidArgs.h
3 164 ss
//
4 164 ss
// $Id: //poco/1.3/Foundation/include/Poco/ValidArgs.h#1 $
5 164 ss
//
6 164 ss
// Library: Foundation
7 164 ss
// Package: Cache
8 164 ss
// Module:  ValidArgs
9 164 ss
//
10 164 ss
// Definition of the ValidArgs class.
11 164 ss
//
12 164 ss
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
13 164 ss
// and Contributors.
14 164 ss
//
15 164 ss
// Permission is hereby granted, free of charge, to any person or organization
16 164 ss
// obtaining a copy of the software and accompanying documentation covered by
17 164 ss
// this license (the "Software") to use, reproduce, display, distribute,
18 164 ss
// execute, and transmit the Software, and to prepare derivative works of the
19 164 ss
// Software, and to permit third-parties to whom the Software is furnished to
20 164 ss
// do so, all subject to the following:
21 164 ss
//
22 164 ss
// The copyright notices in the Software and this entire statement, including
23 164 ss
// the above license grant, this restriction and the following disclaimer,
24 164 ss
// must be included in all copies of the Software, in whole or in part, and
25 164 ss
// all derivative works of the Software, unless such copies or derivative
26 164 ss
// works are solely in the form of machine-executable object code generated by
27 164 ss
// a source language processor.
28 164 ss
//
29 164 ss
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 164 ss
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 164 ss
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
32 164 ss
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
33 164 ss
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
34 164 ss
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
35 164 ss
// DEALINGS IN THE SOFTWARE.
36 164 ss
//
37 164 ss
38 164 ss
39 164 ss
#ifndef  Foundation_ValidArgs_INCLUDED
40 164 ss
#define  Foundation_ValidArgs_INCLUDED
41 164 ss
42 164 ss
43 164 ss
#include "Poco/Foundation.h"
44 164 ss
45 164 ss
46 164 ss
namespace Poco {
47 164 ss
48 164 ss
49 164 ss
template <class TKey>
50 164 ss
class ValidArgs
51 164 ss
{
52 164 ss
public:
53 164 ss
        ValidArgs(const TKey& key):
54 164 ss
                _key(key),
55 164 ss
                _isValid(true)
56 164 ss
        {
57 164 ss
        }
58 164 ss
59 164 ss
        ValidArgs(const ValidArgs& args):
60 164 ss
                _key(args._key),
61 164 ss
                _isValid(args._isValid)
62 164 ss
        {
63 164 ss
        }
64 164 ss
65 164 ss
        ~ValidArgs()
66 164 ss
        {
67 164 ss
        }
68 164 ss
69 164 ss
        const TKey&        key() const
70 164 ss
        {
71 164 ss
                return _key;
72 164 ss
        }
73 164 ss
74 164 ss
        bool isValid() const
75 164 ss
        {
76 164 ss
                return _isValid;
77 164 ss
        }
78 164 ss
79 164 ss
        void invalidate()
80 164 ss
        {
81 164 ss
                _isValid = false;
82 164 ss
        }
83 164 ss
84 164 ss
protected:
85 164 ss
        const TKey& _key;
86 164 ss
        bool        _isValid;
87 164 ss
88 164 ss
private:
89 164 ss
        ValidArgs& operator = (const ValidArgs& args);
90 164 ss
};
91 164 ss
92 164 ss
93 164 ss
} // namespace Poco
94 164 ss
95 164 ss
96 164 ss
#endif