]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSBoolean.h
c228492b5f66e1710bdd3e99993a7b19cb9a06a8
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
)
43 static void initialize ();
47 @abstract A static constructor function to create and initialize an instance of OSBoolean.
48 @param value A boolean value.
49 @result Returns and instance of OSBoolean, or 0 if an error occurred.
51 static OSBoolean
* withBoolean ( bool value
);
55 @abstract A member function to release all resources used by the OSBoolean instance.
56 @discussion This function should not be called directly, use release() instead.
62 @abstract A member function to test if the boolean object is true.
63 @result Returns true if the OSBoolean object is true, false otherwise.
65 virtual bool isTrue () const ;
68 @abstract A member function to test if the boolean object is false.
69 @result Returns true if the OSBoolean object is false, false otherwise.
71 virtual bool isFalse () const ;
75 @abstract Obtains the value of the OSBoolean object as the standard C++ type bool.
76 @result The value of the OSBoolean object.
78 virtual bool getValue () const ;
82 @abstract A member function to test the equality of two OSBoolean objects.
83 @param boolean An OSBoolean object to be compared against the receiver.
84 @result Returns true if the two objects are equivalent.
86 virtual bool isEqualTo ( const OSBoolean
* boolean
) const ;
89 @abstract A member function to test the equality between an arbitrary OSObject derived object and an OSBoolean object.
90 @param obj An OSObject derived object to be compared against the receiver.
91 @result Returns true if the two objects are equivalent.
93 virtual bool isEqualTo ( const OSMetaClassBase
* obj
) const ;
97 @abstract A member function which archives the receiver.
98 @param s The OSSerialize object.
99 @result Returns true if serialization was successful, false if not.
101 virtual bool serialize ( OSSerialize
* s
) const ;
103 OSMetaClassDeclareReservedUnused ( OSBoolean
, 0 );
104 OSMetaClassDeclareReservedUnused ( OSBoolean
, 1 );
105 OSMetaClassDeclareReservedUnused ( OSBoolean
, 2 );
106 OSMetaClassDeclareReservedUnused ( OSBoolean
, 3 );
107 OSMetaClassDeclareReservedUnused ( OSBoolean
, 4 );
108 OSMetaClassDeclareReservedUnused ( OSBoolean
, 5 );
109 OSMetaClassDeclareReservedUnused ( OSBoolean
, 6 );
110 OSMetaClassDeclareReservedUnused ( OSBoolean
, 7 );
114 @defined kOSBooleanTrue
115 @abstract The OSBoolean constant for "true".
116 @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).
118 extern OSBoolean
* const & kOSBooleanTrue
;
121 @defined kOSBooleanFalse
122 @abstract The OSBoolean constant for "false".
123 @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).
125 extern OSBoolean
* const & kOSBooleanFalse
;
127 #endif /* !_OS_OSBOOLEAN_H */