| 1 | // |
| 2 | // Void.h |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Core |
| 6 | // Module: Void |
| 7 | // |
| 8 | // Definition of the Void 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_Void_INCLUDED |
| 18 | #define Foundation_Void_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/Foundation.h" |
| 22 | |
| 23 | |
| 24 | namespace Poco { |
| 25 | |
| 26 | |
| 27 | class Foundation_API Void |
| 28 | /// A dummy class with value-type semantics, |
| 29 | /// mostly useful as a template argument. |
| 30 | /// |
| 31 | /// This class is typically used together with ActiveMethod, |
| 32 | /// if no argument or return value is needed. |
| 33 | { |
| 34 | public: |
| 35 | Void(); |
| 36 | /// Creates the Void. |
| 37 | |
| 38 | Void(const Void& v); |
| 39 | /// Creates the Void from another Void. |
| 40 | /// |
| 41 | /// The philosophical aspects of this operation |
| 42 | /// remain undiscussed for now. |
| 43 | |
| 44 | ~Void(); |
| 45 | /// Destroys the Void. |
| 46 | |
| 47 | Void& operator = (const Void& v); |
| 48 | /// Assigns another void. |
| 49 | |
| 50 | bool operator ==(const Void& v) const; |
| 51 | /// Will return always true due to Voids having no members. |
| 52 | |
| 53 | bool operator !=(const Void& v) const; |
| 54 | /// Will return always false due to Voids having no members. |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | inline bool Void::operator ==(const Void& /*v*/) const |
| 59 | { |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | inline bool Void::operator !=(const Void& /*v*/) const |
| 65 | { |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | |
| 70 | } // namespace Poco |
| 71 | |
| 72 | |
| 73 | #endif // Foundation_Void_INCLUDED |
| 74 | |