]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
2116f1420cafe62a8d5b38512f7494442cb675e3
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* OSBoolean.cpp created by rsulack on Tue Oct 12 1999 */
27 #ifndef _OS_OSBOOLEAN_H
28 #define _OS_OSBOOLEAN_H
30 #include <libkern/c++/OSObject.h>
36 @abstract Container class for boolean values.
38 class OSBoolean
: public OSObject
40 OSDeclareDefaultStructors ( OSBoolean
)
45 /*D @function taggedRelease
46 @abstract Override tagged release mechanism.
47 @param when Unused. */
48 virtual void taggedRelease ( const void * tag
, const int when
) const ;
51 static void initialize ();
55 @abstract A static constructor function to create and initialize an instance of OSBoolean.
56 @param value A boolean value.
57 @result Returns and instance of OSBoolean, or 0 if an error occurred.
59 static OSBoolean
* withBoolean ( bool value
);
63 @abstract A member function to release all resources used by the OSBoolean instance.
64 @discussion This function should not be called directly, use release() instead.
68 /*D @function taggedRetain
69 @abstract Override tagged retain mechanism. */
70 virtual void taggedRetain ( const void * tag
) const ;
74 @abstract A member function to test if the boolean object is true.
75 @result Returns true if the OSBoolean object is true, false otherwise.
77 virtual bool isTrue () const ;
80 @abstract A member function to test if the boolean object is false.
81 @result Returns true if the OSBoolean object is false, false otherwise.
83 virtual bool isFalse () const ;
87 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
88 @result The value of the OSBoolean object.
90 virtual bool getValue () const ;
94 @abstract A member function to test the equality of two OSBoolean objects.
95 @param boolean An OSBoolean object to be compared against the receiver.
96 @result Returns true if the two objects are equivalent.
98 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
101 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
102 @param obj An OSObject derived object to be compared against the receiver.
103 @result Returns true if the two objects are equivalent.
105 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
109 @abstract A member function which archives the receiver.
110 @param s The OSSerialize object.
111 @result Returns true if serialization was successful, false if not.
113 virtual bool serialize ( OSSerialize
* s
) const ;
115 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
116 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
117 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
118 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
119 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
120 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
121 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
122 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
126 @defined kOSBooleanTrue
127 @abstract The OSBoolean constant for "true".
128 @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).
130 extern OSBoolean
* const & kOSBooleanTrue
;
133 @defined kOSBooleanFalse
134 @abstract The OSBoolean constant for "false".
135 @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).
137 extern OSBoolean
* const & kOSBooleanFalse
;
139 #endif /* !_OS_OSBOOLEAN_H */