]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
f493db210aacb81395f00f964fa204b13882c6ea
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 /* OSBoolean.cpp created by rsulack on Tue Oct 12 1999 */
25 #ifndef _OS_OSBOOLEAN_H
26 #define _OS_OSBOOLEAN_H
28 #include <libkern/c++/OSObject.h>
34 @abstract Container class for boolean values.
36 class OSBoolean
: public OSObject
38 OSDeclareDefaultStructors ( OSBoolean
)
43 /*D @function taggedRelease
44 @abstract Overrides tagged release mechanism.
47 virtual void taggedRelease ( const void * tag
, const int when
) const ;
50 static void initialize ();
54 @abstract A static constructor function to create and initialize an instance of OSBoolean.
55 @param value A boolean value.
56 @result Returns and instance of OSBoolean, or 0 if an error occurred.
58 static OSBoolean
* withBoolean ( bool value
);
62 @abstract A member function to release all resources used by the OSBoolean instance.
63 @discussion This function should not be called directly, use release() instead.
67 /*D @function taggedRetain
68 @abstract Override tagged retain mechanism. */
69 virtual void taggedRetain ( const void * tag
) const ;
73 @abstract A member function to test if the boolean object is true.
74 @result Returns true if the OSBoolean object is true, false otherwise.
76 virtual bool isTrue () const ;
79 @abstract A member function to test if the boolean object is false.
80 @result Returns true if the OSBoolean object is false, false otherwise.
82 virtual bool isFalse () const ;
86 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
87 @result The value of the OSBoolean object.
89 virtual bool getValue () const ;
93 @abstract A member function to test the equality of two OSBoolean objects.
94 @param boolean An OSBoolean object to be compared against the receiver.
95 @result Returns true if the two objects are equivalent.
97 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
100 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
101 @param obj An OSObject derived object to be compared against the receiver.
102 @result Returns true if the two objects are equivalent.
104 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
108 @abstract A member function that archives the receiver.
109 @param s The OSSerialize object.
110 @result Returns true if serialization was successful, false if not.
112 virtual bool serialize ( OSSerialize
* s
) const ;
114 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
115 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
116 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
117 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
118 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
119 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
120 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
121 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
125 @const kOSBooleanTrue
126 @abstract The OSBoolean constant for "true".
127 @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).
129 extern OSBoolean
* const & kOSBooleanTrue
;
132 @const kOSBooleanFalse
133 @abstract The OSBoolean constant for "false".
134 @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).
136 extern OSBoolean
* const & kOSBooleanFalse
;
138 #endif /* !_OS_OSBOOLEAN_H */