Mac Developer Library

Developer

OSBoolean Class Reference

Options
Deployment Target:

On This Page
Language:

OSBoolean

Inheritance


  • OSBoolean

Conforms To


Not Applicable

Import Statement


Not Applicable

Objective-C

@import Kernel;

Availability


Available in OS X v10.0 and later.

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

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.

  • Overridden to prevent deallocation of the shared global instances.

    Declaration

    C++

    virtual void free();

    Discussion

    This function should never be called.

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

    Declaration

    C++

    virtual bool getValue() const;

    Return Value

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

  • Tests the equality of two OSBoolean objects.

    Declaration

    C++

    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).

  • Tests the equality an OSBoolean to an arbitrary object.

    Declaration

    C++

    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.

  • Checks whether the OSBoolean object represents a false bool value.

    Declaration

    C++

    virtual bool isFalse() const;

    Return Value

    true if the OSBoolean object is false, true otherwise.

    Discussion

    You can also use == against kOSBooleanFalse.

  • Checks whether the OSBoolean object represents a true bool value.

    Declaration

    C++

    virtual bool isTrue() const;

    Return Value

    true if the OSBoolean object is true, false otherwise.

    Discussion

    You can also use == against kOSBooleanTrue.

  • Archives the receiver into the provided OSSerialize object.

    Declaration

    C++

    virtual bool serialize( OSSerialize *serializer) const;

    Parameters

    serializer

    The OSSerialize object.

    Return Value

    true if serialization succeeds, false if not.

  • Overrides the reference counting mechanism for the shared global instances.

    Declaration

    C++

    virtual void taggedRelease( const void *tag, const intwhen) const;

    Parameters

    tag

    Unused.

    when

    Unused.

  • Overrides the reference counting mechanism for the shared global instances.

    Declaration

    C++

    virtual void taggedRetain( const void *tag) const;

    Parameters

    tag

    Unused.

  • Returns one of the global instances of OSBoolean.

    Declaration

    C++

    static OSBoolean * withBoolean( boolvalue);

    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.