ValidArgs.h 998 B

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