]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
107e536311de7ff72cca7180cc55c5eeec219028
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* OSBoolean.cpp created by rsulack on Tue Oct 12 1999 */
30 #ifndef _OS_OSBOOLEAN_H
31 #define _OS_OSBOOLEAN_H
33 #include <libkern/c++/OSObject.h>
39 @abstract Container class for boolean values.
41 class OSBoolean
: public OSObject
43 OSDeclareDefaultStructors ( OSBoolean
)
48 /*D @function taggedRelease
49 @abstract Overrides tagged release mechanism.
52 virtual void taggedRelease ( const void * tag
, const int when
) const ;
55 static void initialize ();
59 @abstract A static constructor function to create and initialize an instance of OSBoolean.
60 @param value A boolean value.
61 @result Returns and instance of OSBoolean, or 0 if an error occurred.
63 static OSBoolean
* withBoolean ( bool value
);
67 @abstract A member function to release all resources used by the OSBoolean instance.
68 @discussion This function should not be called directly, use release() instead.
72 /*D @function taggedRetain
73 @abstract Override tagged retain mechanism. */
74 virtual void taggedRetain ( const void * tag
) const ;
78 @abstract A member function to test if the boolean object is true.
79 @result Returns true if the OSBoolean object is true, false otherwise.
81 virtual bool isTrue () const ;
84 @abstract A member function to test if the boolean object is false.
85 @result Returns true if the OSBoolean object is false, false otherwise.
87 virtual bool isFalse () const ;
91 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
92 @result The value of the OSBoolean object.
94 virtual bool getValue () const ;
98 @abstract A member function to test the equality of two OSBoolean objects.
99 @param boolean An OSBoolean object to be compared against the receiver.
100 @result Returns true if the two objects are equivalent.
102 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
105 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
106 @param obj An OSObject derived object to be compared against the receiver.
107 @result Returns true if the two objects are equivalent.
109 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
113 @abstract A member function that archives the receiver.
114 @param s The OSSerialize object.
115 @result Returns true if serialization was successful, false if not.
117 virtual bool serialize ( OSSerialize
* s
) const ;
119 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
120 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
121 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
122 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
123 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
124 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
125 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
126 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
130 @const kOSBooleanTrue
131 @abstract The OSBoolean constant for "true".
132 @discussion The OSBoolean constant for "true". The object does not need to be retained or released. Comparisons of the form (booleanObject == kOSBooleanTrue) are acceptable and would be equivalent to (booleanObject->getValue() == true).
134 extern OSBoolean
* const & kOSBooleanTrue
;
137 @const kOSBooleanFalse
138 @abstract The OSBoolean constant for "false".
139 @discussion The OSBoolean constant for "false". The object does not need to be retained or released. Comparisons of the form (booleanObject == kOSBooleanFalse) are acceptable and would be equivalent to (booleanObject->getValue() == false).
141 extern OSBoolean
* const & kOSBooleanFalse
;
143 #endif /* !_OS_OSBOOLEAN_H */