]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
58b3e36e64955c0f049fd0b3d46289759e5a737e
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* OSBoolean.cpp created by rsulack on Tue Oct 12 1999 */
24 #ifndef _OS_OSBOOLEAN_H
25 #define _OS_OSBOOLEAN_H
27 #include <libkern/c++/OSObject.h>
33 @abstract Container class for boolean values.
35 class OSBoolean
: public OSObject
37 OSDeclareDefaultStructors ( OSBoolean
)
42 /*D @function taggedRelease
43 @abstract Overrides tagged release mechanism.
46 virtual void taggedRelease ( const void * tag
, const int when
) const ;
49 static void initialize ();
53 @abstract A static constructor function to create and initialize an instance of OSBoolean.
54 @param value A boolean value.
55 @result Returns and instance of OSBoolean, or 0 if an error occurred.
57 static OSBoolean
* withBoolean ( bool value
);
61 @abstract A member function to release all resources used by the OSBoolean instance.
62 @discussion This function should not be called directly, use release() instead.
66 /*D @function taggedRetain
67 @abstract Override tagged retain mechanism. */
68 virtual void taggedRetain ( const void * tag
) const ;
72 @abstract A member function to test if the boolean object is true.
73 @result Returns true if the OSBoolean object is true, false otherwise.
75 virtual bool isTrue () const ;
78 @abstract A member function to test if the boolean object is false.
79 @result Returns true if the OSBoolean object is false, false otherwise.
81 virtual bool isFalse () const ;
85 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
86 @result The value of the OSBoolean object.
88 virtual bool getValue () const ;
92 @abstract A member function to test the equality of two OSBoolean objects.
93 @param boolean An OSBoolean object to be compared against the receiver.
94 @result Returns true if the two objects are equivalent.
96 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
99 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
100 @param obj An OSObject derived object to be compared against the receiver.
101 @result Returns true if the two objects are equivalent.
103 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
107 @abstract A member function that archives the receiver.
108 @param s The OSSerialize object.
109 @result Returns true if serialization was successful, false if not.
111 virtual bool serialize ( OSSerialize
* s
) const ;
113 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
114 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
115 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
116 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
117 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
118 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
119 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
120 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
124 @const kOSBooleanTrue
125 @abstract The OSBoolean constant for "true".
126 @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).
128 extern OSBoolean
* const & kOSBooleanTrue
;
131 @const kOSBooleanFalse
132 @abstract The OSBoolean constant for "false".
133 @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).
135 extern OSBoolean
* const & kOSBooleanFalse
;
137 #endif /* !_OS_OSBOOLEAN_H */