Aspose.Tasks for C++
NullableBool.h
1 #pragma once
2 //-----------------------------------------------------------------------
3 // <copyright file="NullableBool.cs" company="Aspose Pty Ltd">
4 // Copyright (c) 2002-2024 Aspose Pty Ltd. All Rights Reserved.
5 // </copyright>
6 //-----------------------------------------------------------------------
7 
8 #include <system/object_ext.h>
9 #include <system/iequatable.h>
10 #include <cstdint>
11 
12 #include "aspose.tasks.cpp/aspose_tasks_api_defs.h"
13 
14 namespace Aspose {
15 
16 namespace Tasks {
17 
18 /// <summary>
19 /// A class for boolean values with possibility to check whether the value was defined or not.
20 /// </summary>
21 class ASPOSE_TASKS_SHARED_CLASS NullableBool : public System::IEquatable<Aspose::Tasks::NullableBool>, public System::Details::BoxableObjectBase
22 {
23  typedef NullableBool ThisType;
24  typedef System::IEquatable<Aspose::Tasks::NullableBool> BaseType;
25 
26  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
27  ASPOSE_TASKS_SHARED_RTTI_INFO_DECL();
28 
29  friend ASPOSE_TASKS_SHARED_API bool operator ==(NullableBool a, NullableBool b);
30  friend ASPOSE_TASKS_SHARED_API bool operator !=(NullableBool a, NullableBool b);
31 
32 public:
33 
34  /// <summary>
35  /// Gets a value indicating whether current value is true or false.
36  /// </summary>
37  ASPOSE_TASKS_SHARED_API bool get_Value() const;
38  /// <summary>
39  /// Sets a value indicating whether current value is true or false.
40  /// </summary>
41  ASPOSE_TASKS_SHARED_API void set_Value(bool value);
42  /// <summary>
43  /// Gets a value indicating whether the value was defined; otherwise, false.
44  /// </summary>
45  ASPOSE_TASKS_SHARED_API bool get_IsDefined() const;
46 
47  /// <summary>
48  /// Initializes a new instance of the <see cref="NullableBool"></see> struct with the specified boolean value.
49  /// </summary>
50  /// <param name="value">the specified boolean value.</param>
51  ASPOSE_TASKS_SHARED_API NullableBool(bool value);
52  /// <summary>
53  /// Initializes a new instance of the <see cref="NullableBool"></see> struct.
54  /// </summary>
55  /// <param name="value">The current value.</param>
56  /// <param name="isDefined">The value indicating whether current value is defined.</param>
57  ASPOSE_TASKS_SHARED_API NullableBool(bool value, bool isDefined);
58 
59  static ASPOSE_TASKS_SHARED_API bool to_Boolean(NullableBool val);
60  static ASPOSE_TASKS_SHARED_API NullableBool to_NullableBool(bool val);
61 
62  /// <summary>
63  /// Returns a flag indicating whether this instance is equal to the specified instance of the <see cref="NullableBool"></see> class.
64  /// </summary>
65  /// <param name="other">the specified object to compare to this instance.</param>
66  /// <returns>a flag indicating whether this instance is equal to the specified instance of the <see cref="NullableBool"></see> class.</returns>
67  ASPOSE_TASKS_SHARED_API bool Equals(NullableBool other) override;
68  /// <summary>
69  /// Returns a flag indicating whether this instance is equal to the specified object.
70  /// </summary>
71  /// <param name="obj">the specified object to compare to this instance.</param>
72  /// <returns>a flag indicating whether this instance is equal to the specified object.</returns>
73  ASPOSE_TASKS_SHARED_API bool Equals(System::SharedPtr<System::Object> obj) override;
74  /// <summary>
75  /// Returns a hash code value for the instance of the <see cref="NullableBool"></see> class.
76  /// </summary>
77  /// <returns>returns a hash code value for this object.</returns>
78  ASPOSE_TASKS_SHARED_API int32_t GetHashCode() const override;
79  /// <summary>
80  /// Returns a string that represents the current object.
81  /// </summary>
82  /// <returns>A string that represents the current object.</returns>
83  ASPOSE_TASKS_SHARED_API System::String ToString() const override;
84 
85  ASPOSE_TASKS_SHARED_API NullableBool();
86 
87 private:
88 
89  bool value;
90  bool isDefined;
91 
92 };
93 
94 ASPOSE_TASKS_SHARED_API bool operator ==(NullableBool a, NullableBool b);
95 ASPOSE_TASKS_SHARED_API bool operator !=(NullableBool a, NullableBool b);
96 
97 } // namespace Tasks
98 } // namespace Aspose
99 
100 namespace System { template<> struct IsBoxable<Aspose::Tasks::NullableBool> : std::true_type {}; }
101 
102 
103 
A class for boolean values with possibility to check whether the value was defined or not.
Definition: NullableBool.h:22
NullableBool(bool value, bool isDefined)
Initializes a new instance of the NullableBool struct.
NullableBool(bool value)
Initializes a new instance of the NullableBool struct with the specified boolean value.
void set_Value(bool value)
Sets a value indicating whether current value is true or false.
bool Equals(System::SharedPtr< System::Object > obj) override
Returns a flag indicating whether this instance is equal to the specified object.
bool get_Value() const
Gets a value indicating whether current value is true or false.
System::String ToString() const override
Returns a string that represents the current object.
bool get_IsDefined() const
Gets a value indicating whether the value was defined; otherwise, false.
int32_t GetHashCode() const override
Returns a hash code value for the instance of the NullableBool class.
bool Equals(NullableBool other) override
Returns a flag indicating whether this instance is equal to the specified instance of the NullableBoo...
Definition: Asn.h:13