Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.


3



Common Classes and Functions




Classes





HashTable


Inherits From: Object


Initializing and Freeing a HashTable

init Initializes a new, default HashTable
initKeyDesc:(const char *)aKeyDesc Initializes a new HashTable
initKeyDesc:(const char *)aKeyDesc Initializes a new HashTable
valueDesc:(const char *)aValueDesc
initKeyDesc:(const char *)aKeyDesc Initializes a new HashTable
valueDesc:(const char *)aValueDesc
capacity:(unsigned int)aCapacity
free Deallocates the HashTable
freeObjects Deallocates the HashTable's objects
freeKeys:(void (*)(void *))keyFunc Conditionally frees the HashTable's associations
values:(void (*)(void *))valueFunc
empty Empties the HashTable but retains its capacity


Copying a HashTable

copyFromZone:(NXZone *) zone Returns an empty copy of the HashTable


Manipulating Table Associations

(unsigned int)count Returns the number of objects in the table
(BOOL)isKey:(const void *)aKey Indicates whether aKey is in the table
(void *)valueForKey:(const void *)aKey Returns the value mapped to aKey
(void *)insertKey:(const void *)aKey Adds or updates akey/avalue pair
value:(void *)aValue
(void *)removeKey:(const void *)aKey Removes akey/avalue pair


Iterating Over All Associations

(NXHashState)initState Begins process of iteration through the HashTable
(BOOL)nextState:(NXHashState *)aState Moves to the next entry in the HashTable
key:(const void **)aKey
value:(void **)aValue


Archiving

read:(NXTypedStream *)stream Read the HashTable from the typed stream stream
write:(NXTypedStream *)stream Writes the HashTable to the typed stream stream




List


Inherits From: Object


Initializing a New List Object

init Initializes the new List object
initCount:(unsigned int)numSlots Initializes the new List to hold at least numSlots objects


Copying and Freeing a List

copyFromZone:(NXZone *)zone Returns a copy of the List allocated from zone
free Deallocates the List object


Manipulating Objects by Index

insertObject:anObject at:(unsigned int)index Puts anObject in the List at index
addObject:anObject Adds anObject at the end of the List
removeObjectAt:(unsigned int)index Removes the object located at index
removeLastObject Removes the object at the end of the List
replaceObjectAt:(unsigned int)index
with:newObject Puts newObject in place of the object at index
objectAt:(unsigned int)index Returns the object at index
lastObject Returns the object at the end of the List
(unsigned int)count Returns the number of objects in the List


Manipulating Objects by id

addObject:anObject Adds anObject at the end of the List
addObjectIfAbsent:anObject Adds anObject to the List, if it's not already in the List
removeObject:anObject Removes first occurrence of anObject from the List
replaceObject:anObject with:newObject Puts newObject in the List in place of anObject
(unsigned int)indexOf:anObject Returns the index of anObject


Comparing and Combining Lists

(BOOL)isEqual:anObject Returns whether the two Lists have the same contents
appendList:(List *)otherList Adds the objects in otherList to the receiving List


Emptying a List

empty Empties the List of its contents, but doesn't free the objects
freeObjects Deallocates all the objects in the List


Sending Messages to the Objects

makeObjectsPerform:(SEL)aSelector Sends an aSelector message to each object in the List
makeObjectsPerform:(SEL)aSelector Sends aSelector message with an argument to each object
with:anObject


Managing the Storage Capacity

(unsigned int)capacity Returns the number of objects the List can store
setAvailableCapacity:(unsigned int)numSlots Sets the capacity of the List to at least numSlots objects


Archiving

write:(NXTypedStream *)stream Writes the List to the typed stream stream
read:(NXTypedStream *)stream Reads the List from the typed stream stream




NXBundle


Inherits From: Object


Initializing a New NXBundle object

initForDirectory:(const char *)fullPath Initializes a new object for the fullPath directory


Getting and Freeing an NXBundle

+ mainBundle Returns the NXBundle for the directory of the executable
+ bundleForClass:classObject Returns the NXBundle that loaded classObject
free Frees the receiving NXBundle, if it can be freed


Getting a Bundled Class

principalClass Returns the principal class loaded by the receiver
classNamed:(const char *)classname Returns the class object for the classname class


Setting Which Resources To Use

+ setSystemLanguages:(const char * const *)languageArray
Informs the receiver of the user's language preferences


Finding a Resource

(BOOL)getPath:(char *)path Provides the full path to the filename resource
forResource:(const char *)filename
ofType:(const char *)extension
+ (BOOL)getPath:(char *)path Provides the full path to the filename resource
forResource:(const char *)filename
ofType:(const char *)extension
inDirectory:(const char *)directory
withVersion:(int)version


Getting the Bundle Directory

(const char *)directory Returns the full pathname of the NXBundle's directory


Setting the Version

setVersion:(int)version Sets the version that resources must match
(int)version Returns the version that resources must match




NXStringTable


Inherits From: HashTable : Object


Initializing and Freeing an NXStringTable

init Initializes a new NXStringTable
free Deallocates the NXStringTable


Querying an NXStringTable

(const char *)valueForStringKey:(const char *)aString
Returns the value that corresponds to aString


Writing Elements

readFromFile:(const char *)fileName Reads the keys and values from fileName
writeToFile:(const char *)fileName Writes the keys and values to fileName
readFromStream:(NXStream *)stream Reads the keys and values from stream
writeToStream:(NXStream *)stream Writes the keys and values to stream




Storage


Inherits From: Object


Initializing a New Storage Object

init Initializes the Storage object
initCount:(unsigned int)count Initializes the new object to store at least count elements
elementSize:(unsigned int)sizeInBytes
description:(const char *)descriptor


Copying and Freeing Storage Objects

copyFromZone:(NXZone *)zone Returns a copy of the Storage object allocated from zone
free Deallocates the Storage object and its contents


Getting, Adding, and Removing Elements

addElement:(void *)anElement Adds anElement at the end of the Storage array
insertElement:(void *)anElement
at:(unsigned int)index Puts anElement in the Storage array at index
removeElementAt:(unsigned int)index Removes the element located at index
removeLastElement Removes the last element
replaceElementAt:(unsigned int)index
with:(void *)anElement Replaces the element at index with anElement
empty Empties the Storage object but retains its capacity
(void *)elementAt:(unsigned int)index Returns a pointer to the element at index


Comparing Storage Objects

(BOOL)isEqual:anObject Returns whether two Storage objects are the same


Managing the Storage Capacity and Type

(unsigned int)count Returns the number of elements currently stored
(const char *)description Returns the encoding for the type of elements stored
setAvailableCapacity:(unsigned int)numSlots Sets the capacity of the Storage array to at least numSlots
setNumSlots:(unsigned int)numSlots Sets the number of elements stored to numSlots elements


Archiving

read:(NXTypedStream *)stream Reads the Storage object from the typed stream stream
write:(NXTypedStream *)stream Writes the Storage object to the typed stream stream