ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference

 


OSSymbol

Inherits from:
Declared In:

Overview

A container class whose instances represent unique string values.

Discussion

An OSSymbol object represents a unique string value. When creating an OSSymbol, a string is given and an OSSymbol representing this string is created if none already exist for this string. If an OSSymbol for this string already exists, then a reference to the existing OSSymbol is returned.



Functions

free

Synchronizes with the symbol pool (overridden super class release method).

isEqualTo

Tests the equality between an OSSymbol object and an arbitrary OSObject-derived object.

isEqualTo(const char *)

Tests the equality between an OSSymbol object and a simple C string.

isEqualTo(const OSSymbol *)

Tests the equality between two OSSymbol objects.

taggedRelease(const void *)

Releases a tag.

taggedRelease(const void *, const int)

Synchronizes with the symbol pool (overridden super class release method).

withCString

Creates an OSSymbol instance from a simple C string or returns an existing OSSymbol object based on the string given.

withCStringNoCopy

Creates an OSSymbol instance from a simple C string, but does not copy the string to the container.

withString

Creates an OSSymbol instance from an OSString object or returns an existing OSSymbol object based on the OSString object given.


free


Synchronizes with the symbol pool (overridden super class release method).

protected

virtual void free();
Discussion

When we release an OSSymbol, we need to synchronize the destruction of the object with any potential searches that may be occurring through the family factor methods. See OSObject::free.


isEqualTo


Tests the equality between an OSSymbol object and an arbitrary OSObject-derived object.

public

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

The OSObject-derived object to be compared against the receiver.

Return Value

Returns true if the OSSymbol and the OSObject objects are equivalent.


isEqualTo(const char *)


Tests the equality between an OSSymbol object and a simple C string.

public

virtual bool isEqualTo( const char *aCString) const;
Parameters
aCString

The C string to be compared against the receiver.

Return Value

Returns true if the OSSymbol's internal string representation is equivalent to the C string it is being compared against, false otherwise.


isEqualTo(const OSSymbol *)


Tests the equality between two OSSymbol objects.

public

virtual bool isEqualTo( const OSSymbol *aSymbol) const;
Parameters
aSymbol

The OSSymbol object to be compared against the receiver.

Return Value

Returns true if the two objects are equivalent, false otherwise.

Discussion

Note that two OSSymbol objects are only equivalent when their references are identical.


taggedRelease(const void *)


Releases a tag.

public

virtual void taggedRelease( const void *tag) const;
Discussion

It was necessary to override this method even though it was implemented as { super::taggedRelease(tag) }. It seems that C++ is confused about the appearance of the protected taggedRelease with 2 args and refuses to only inherit one function. See OSObject::taggedRelease.


taggedRelease(const void *, const int)


Synchronizes with the symbol pool (overridden super class release method).

protected

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

When we release an OSSymbol, we need to synchronize the destruction of the object with any potential searches that may be occurring through the family factor methods. See OSObject::taggedRelease.


withCString


Creates an OSSymbol instance from a simple C string or returns an existing OSSymbol object based on the string given.

public

static const OSSymbol *withCString(const char *cString);
Parameters
cString

A C string.

Return Value

Returns a unique OSSymbol object for the string given.


withCStringNoCopy


Creates an OSSymbol instance from a simple C string, but does not copy the string to the container.

public

static const OSSymbol *withCStringNoCopy(const char *cString);
Parameters
cString

A C string.

Return Value

Returns a unique OSSymbol object for the string given.


withString


Creates an OSSymbol instance from an OSString object or returns an existing OSSymbol object based on the OSString object given.

public

static const OSSymbol *withString(const OSString *aString);
Parameters
aString

An OSString object.

Return Value

Returns a unique OSSymbol object for the string given.

Member Data


reserved


private

ExpansionData *reserved;
Discussion

Reserved for future use. (Internal use only)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2008-12-19