]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
105a617cdb91f65758755b674ee211e1ddde7643
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
30 /* OSBoolean.cpp created by rsulack on Tue Oct 12 1999 */
32 #ifndef _OS_OSBOOLEAN_H
33 #define _OS_OSBOOLEAN_H
35 #include <libkern/c++/OSObject.h>
41 @abstract Container class for boolean values.
43 class OSBoolean
: public OSObject
45 OSDeclareDefaultStructors ( OSBoolean
)
50 /*D @function taggedRelease
51 @abstract Overrides tagged release mechanism.
54 virtual void taggedRelease ( const void * tag
, const int when
) const ;
57 static void initialize ();
61 @abstract A static constructor function to create and initialize an instance of OSBoolean.
62 @param value A boolean value.
63 @result Returns and instance of OSBoolean, or 0 if an error occurred.
65 static OSBoolean
* withBoolean ( bool value
);
69 @abstract A member function to release all resources used by the OSBoolean instance.
70 @discussion This function should not be called directly, use release() instead.
74 /*D @function taggedRetain
75 @abstract Override tagged retain mechanism. */
76 virtual void taggedRetain ( const void * tag
) const ;
80 @abstract A member function to test if the boolean object is true.
81 @result Returns true if the OSBoolean object is true, false otherwise.
83 virtual bool isTrue () const ;
86 @abstract A member function to test if the boolean object is false.
87 @result Returns true if the OSBoolean object is false, false otherwise.
89 virtual bool isFalse () const ;
93 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
94 @result The value of the OSBoolean object.
96 virtual bool getValue () const ;
100 @abstract A member function to test the equality of two OSBoolean objects.
101 @param boolean An OSBoolean object to be compared against the receiver.
102 @result Returns true if the two objects are equivalent.
104 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
107 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
108 @param obj An OSObject derived object to be compared against the receiver.
109 @result Returns true if the two objects are equivalent.
111 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
115 @abstract A member function that archives the receiver.
116 @param s The OSSerialize object.
117 @result Returns true if serialization was successful, false if not.
119 virtual bool serialize ( OSSerialize
* s
) const ;
121 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
122 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
123 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
124 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
125 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
126 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
127 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
128 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
132 @const kOSBooleanTrue
133 @abstract The OSBoolean constant for "true".
134 @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).
136 extern OSBoolean
* const & kOSBooleanTrue
;
139 @const kOSBooleanFalse
140 @abstract The OSBoolean constant for "false".
141 @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).
143 extern OSBoolean
* const & kOSBooleanFalse
;
145 #endif /* !_OS_OSBOOLEAN_H */