Mac OS X Reference Library Apple Developer
Search

OSBoolean

Inherits from:
Declared In:

Overview

OSBoolean wraps a boolean value in a C++ object for use in Libkern collections.

Discussion

OSBoolean represents a boolean true/false value as a Libkern C++ object. There are only two instances of OSBoolean, kOSBooleanTrue and kOSBooleanFalse. These are shared globally and returned by the instance-creation function withBoolean. Thus, you can use pointer comparison to test whether two OSBoolean objects are equal.



Functions

free

Overridden to prevent deallocation of the shared global instances.

getValue

Returns the C++ bool value for the OSBoolean object.

isEqualTo(const OSBoolean *)

Tests the equality of two OSBoolean objects.

isEqualTo(const OSMetaClassBase *)

Tests the equality an OSBoolean to an arbitrary object.

isFalse

Checks whether the OSBoolean object represents a false bool value.

isTrue

Checks whether the OSBoolean object represents a true bool value.

serialize

Archives the receiver into the provided OSSerialize object.

taggedRelease

Overrides the reference counting mechanism for the shared global instances.

taggedRetain

Overrides the reference counting mechanism for the shared global instances.

withBoolean

Returns one of the global instances of OSBoolean.


free


Overridden to prevent deallocation of the shared global instances.

public

virtual void free();
Discussion

This function should never be called.


getValue


Returns the C++ bool value for the OSBoolean object.

public

virtual bool getValue() const;
Return Value

Returns the C++ bool value of the OSBoolean object.


isEqualTo(const OSBoolean *)


Tests the equality of two OSBoolean objects.

public

virtual bool isEqualTo( const OSBoolean *aBoolean) const;
Parameters
aBoolean

The OSBoolean to be compared against the receiver.

Return Value

true if the OSBoolean objects are equal, false if not.

Discussion

Two OSBoolean objects are considered equal if they are the same exact object (pointer equality).


isEqualTo(const OSMetaClassBase *)


Tests the equality an OSBoolean to an arbitrary object.

public

virtual bool isEqualTo( const OSMetaClassBase *anObject) const;
Parameters
anObject

An object to be compared against the receiver.

Return Value

true if the objects are equal, false if not.

Discussion

An OSBoolean is considered equal to another object if that object is derived from OSBoolean and represents the same C++ bool value.


isFalse


Checks whether the OSBoolean object represents a false bool value.

public

virtual bool isFalse() const;
Return Value

true if the OSBoolean object is false, true otherwise.

Discussion

You can also use == against kOSBooleanFalse.


isTrue


Checks whether the OSBoolean object represents a true bool value.

public

virtual bool isTrue() const;
Return Value

true if the OSBoolean object is true, false otherwise.

Discussion

You can also use == against kOSBooleanTrue.


serialize


Archives the receiver into the provided OSSerialize object.

public

virtual bool serialize( OSSerialize *serializer) const;
Parameters
serializer

The OSSerialize object.

Return Value

true if serialization succeeds, false if not.


taggedRelease


Overrides the reference counting mechanism for the shared global instances.

protected

virtual void taggedRelease( const void *tag, const int when) const;
Parameters
tag

Unused.

when

Unused.


taggedRetain


Overrides the reference counting mechanism for the shared global instances.

public

virtual void taggedRetain( const void *tag) const;
Parameters
tag

Unused.


withBoolean


Returns one of the global instances of OSBoolean.

public

static OSBoolean * withBoolean( bool value);
Parameters
value

A boolean value.

Return Value

The global instance of OSBoolean with the boolean value.

Discussion

This function actually returns either kOSBooleanTrue or kOSBooleanFalse, so that you can always use pointer comparison with OSBoolean objects.

 

Did this document help you? Yes It's good, but... Not helpful...

Last Updated: 2010-07-29