| Framework | Foundation/Foundation.h |
| Declared in | NSByteOrder.h NSDecimal.h NSException.h NSGeometry.h NSHFSFileTypes.h NSHashTable.h NSJavaSetup.h NSMapTable.h NSObjCRuntime.h NSObject.h NSPathUtilities.h NSRange.h NSZone.h |
This chapter describes the functions and function-like macros defined in the Foundation Framework.
For additional information about Assertions, see Assertions and Logging.
NSAssert
NSAssert1
NSAssert2
NSAssert3
NSAssert4
NSAssert5
NSCAssert
NSCAssert1
NSCAssert2
NSCAssert3
NSCAssert4
NSCAssert5
NSCParameterAssert
NSParameterAssert
For additional information on generating strings files see “Generating Strings Files”.
NSLocalizedString
NSLocalizedStringFromTable
NSLocalizedStringFromTableInBundle
NSLocalizedStringWithDefaultValue
NSConvertHostDoubleToSwapped
NSConvertHostFloatToSwapped
NSConvertSwappedDoubleToHost
NSConvertSwappedFloatToHost
NSHostByteOrder
NSSwapBigDoubleToHost
NSSwapBigFloatToHost
NSSwapBigIntToHost
NSSwapBigLongLongToHost
NSSwapBigLongToHost
NSSwapBigShortToHost
NSSwapDouble
NSSwapFloat
NSSwapHostDoubleToBig
NSSwapHostDoubleToLittle
NSSwapHostFloatToBig
NSSwapHostFloatToLittle
NSSwapHostIntToBig
NSSwapHostIntToLittle
NSSwapHostLongLongToBig
NSSwapHostLongLongToLittle
NSSwapHostLongToBig
NSSwapHostLongToLittle
NSSwapHostShortToBig
NSSwapHostShortToLittle
NSSwapInt
NSSwapLittleDoubleToHost
NSSwapLittleFloatToHost
NSSwapLittleIntToHost
NSSwapLittleLongLongToHost
NSSwapLittleLongToHost
NSSwapLittleShortToHost
NSSwapLong
NSSwapLongLong
NSSwapShort
The class "NSDecimalNumber" may also be used for decimal arithmetic.
NSDecimalAdd
NSDecimalCompact
NSDecimalCompare
NSDecimalCopy
NSDecimalDivide
NSDecimalIsNotANumber
NSDecimalMultiply
NSDecimalMultiplyByPowerOf10
NSDecimalNormalize
NSDecimalPower
NSDecimalRound
NSDecimalString
NSDecimalSubtract
You can find the following macros implemented in NSException.h. Exception Programming Topics for Cocoa discusses these macros and gives examples of their usage. These macros are useful for code that needs to run on versions of the system prior to Mac OS X v10.3 For later versions of the operating system, you should use the Objective-C compiler directives @try, @catch, @throw, and @finally; for information about these directives, see “Exception Handling and Thread Synchronization” in The Objective-C 2.0 Programming Language.
NSJavaBundleCleanup
NSJavaBundleSetup
NSJavaClassesForBundle
NSJavaClassesFromPath
NSJavaNeedsToLoadClasses
NSJavaNeedsVirtualMachine
NSJavaObjectNamedInPath
NSJavaProvidesClasses
NSJavaSetup
NSJavaSetupVirtualMachine
NSAllHashTableObjects
NSCompareHashTables
NSCopyHashTableWithZone
NSCountHashTable
NSCreateHashTable
NSCreateHashTableWithZone
NSEndHashTableEnumeration
NSEnumerateHashTable
NSFreeHashTable
NSHashGet
NSHashInsert
NSHashInsertIfAbsent
NSHashInsertKnownAbsent
NSHashRemove
NSNextHashEnumeratorItem
NSResetHashTable
NSStringFromHashTable
NSAllMapTableKeys
NSAllMapTableValues
NSCompareMapTables
NSCopyMapTableWithZone
NSCountMapTable
NSCreateMapTable
NSCreateMapTableWithZone
NSEndMapTableEnumeration
NSEnumerateMapTable
NSFreeMapTable
NSMapGet
NSMapInsert
NSMapInsertIfAbsent
NSMapInsertKnownAbsent
NSMapMember
NSMapRemove
NSNextMapEnumeratorPair
NSResetMapTable
NSStringFromMapTable
NSAllocateObject
NSCopyObject
NSDeallocateObject
NSDecrementExtraRefCountWasZero
NSExtraRefCount
NSIncrementExtraRefCount
NSShouldRetainWithZone
NSGetSizeAndAlignment
NSClassFromString
NSStringFromClass
NSSelectorFromString
NSStringFromSelector
NSStringFromProtocol
NSProtocolFromString
NSFullUserName
NSHomeDirectory
NSHomeDirectoryForUser
NSOpenStepRootDirectory
NSSearchPathForDirectoriesInDomains
NSTemporaryDirectory
NSUserName
NSEqualRanges
NSIntersectionRange
NSLocationInRange
NSMakeRange
NSMaxRange
NSRangeFromString
NSStringFromRange
NSUnionRange
NSContainsRect
NSDivideRect
NSEqualRects
NSIsEmptyRect
NSHeight
NSInsetRect
NSIntegralRect
NSIntersectionRect
NSIntersectsRect
NSMakeRect
NSMaxX
NSMaxY
NSMidX
NSMidY
NSMinX
NSMinY
NSMouseInRect
NSOffsetRect
NSPointInRect
NSRectFromString
NSStringFromRect
NSRectFromCGRect
NSRectToCGRect
NSUnionRect
NSWidth
Whether there’s an uncaught exception handler function, any uncaught exceptions cause the program to terminate, unless the exception is raised during the posting of a notification.
NSDefaultMallocZone
NSAllocateCollectable
NSReallocateCollectable
NSMakeCollectable
NSAllocateMemoryPages
NSCopyMemoryPages
NSDeallocateMemoryPages
NSLogPageSize
NSPageSize
NSRealMemoryAvailable
NSRoundDownToMultipleOfPageSize
NSRoundUpToMultipleOfPageSize
NSCreateZone
NSRecycleZone
NSSetZoneName
NSZoneCalloc
NSZoneFree
NSZoneFromPointer
NSZoneMalloc
NSZoneName
NSZoneRealloc
Returns all of the elements in the specified hash table.
NSArray * NSAllHashTableObjects ( NSHashTable *table );
An array object containing all the elements of table.
This function should be called only when the table elements are objects, not when they’re any other data type.
NSHashTable.h
Returns all of the keys in the specified map table.
NSArray * NSAllMapTableKeys ( NSMapTable *table );
An array object containing all the keys in table. This function should be called only when table keys are objects, not when they’re any other type of pointer.
NSMapTable.h
Returns all of the values in the specified table.
NSArray * NSAllMapTableValues ( NSMapTable *table );
An array object containing all the values in table. This function should be called only when table values are objects, not when they’re any other type of pointer.
NSMapTable.hAllocates collectable memory.
void *__strong NSAllocateCollectable ( NSUInteger size, NSUInteger options );
The number of bytes of memory to allocate.
0 or NSScannedOption: A value of 0 allocates nonscanned memory; a value of NSScannedOption allocates scanned memory.
A pointer to the allocated memory, or NULL if the function is unable to allocate the requested memory.
NSZone.h
Allocates a new block of memory.
void * NSAllocateMemoryPages ( NSUInteger bytes );
Allocates the integral number of pages whose total size is closest to, but not less than, byteCount. The allocated pages are guaranteed to be filled with zeros. If the allocation fails, raises NSInvalidArgumentException.
NSZone.h
Creates and returns a new instance of a given class.
id NSAllocateObject ( Class aClass, NSUInteger extraBytes, NSZone *zone );
The class of which to create an instance.
The number of extra bytes required for indexed instance variables (this value is typically 0).
The zone in which to create the new instance (pass NULL to specify the default zone).
A new instance of aClass) or nil if an instance could not be created.
NSObject.h
Generates an assertion if a given condition is false.
#define NSAssert(condition, desc)
An expression that evaluates to YES or NO.
An NSString object that contains an error message describing the failure condition.
The NSAssert macro evaluates the condition and serves as a front end to the assertion handler.
Each thread has its own assertion handler, which is an object of class NSAssertionHandler. When invoked, an assertion handler prints an error message that includes the method and class names (or the function name). It then raises an NSInternalInconsistencyException exception. If condition evaluates to NO, the macro invokes handleFailureInMethod:object:file:lineNumber:description: on the assertion handler for the current thread, passing desc as the description string.
This macro should be used only within Objective-C methods.
Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined.
Generates an assertion if a given condition is false.
#define NSAssert1(condition, desc, arg1)
An expression that evaluates to YES or NO.
An NSString object that contains a printf-style string containing an error message describing the failure condition and a placeholder for a single argument.
An argument to be inserted, in place, into desc.
The NSAssert1 macro evaluates the condition and serves as a front end to the assertion handler.
Each thread has its own assertion handler, which is an object of class NSAssertionHandler. When invoked, an assertion handler prints an error message that includes the method and class names (or the function name). It then raises an NSInternalInconsistencyException exception. If condition evaluates to NO, the macro invokes handleFailureInMethod:object:file:lineNumber:description: on the assertion handler for the current thread, passing desc as the description string and arg1 as a substitution variable.
This macro should be used only within Objective-C methods.
Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined.
NSLogNSLogvNSAssertNSAssert2NSAssert3NSAssert4NSAssert5NSCAssertNSCParameterAssertNSParameterAssertGenerates an assertion if a given condition is false.
#define NSAssert2(condition, desc, arg1, arg2)
An expression that evaluates to YES or NO.
An NSString object that contains a printf-style string containing an error message describing the failure condition and placeholders for two arguments.
An argument to be inserted, in place, into desc.
An argument to be inserted, in place, into desc.
The NSAssert2 macro evaluates the condition and serves as a front end to the assertion handler.
Each thread has its own assertion handler, which is an object of class NSAssertionHandler. When invoked, an assertion handler prints an error message that includes the method and class names (or the function name). It then raises an NSInternalInconsistencyException exception. If condition evaluates to NO, the macro invokes handleFailureInMethod:object:file:lineNumber:description: on the assertion handler for the current thread, passing desc as the description string and arg1 and arg2 as substitution variables.
This macro should be used only within Objective-C methods.
Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined.
NSLogNSLogvNSAssertNSAssert1NSAssert3NSAssert4NSAssert5NSCAssertNSCParameterAssertNSParameterAssertGenerates an assertion if a given condition is false.
#define NSAssert3(condition, desc, arg1, arg2, arg3)
An expression that evaluates to YES or NO.
An NSString object that contains a printf-style string containing an error message describing the failure condition and placeholders for three arguments.
An argument to be inserted, in place, into desc.
An argument to be inserted, in place, into desc.
An argument to be inserted, in place, into desc.
The NSAssert3 macro evaluates the condition and serves as a front end to the assertion handler.
Each thread has its own assertion handler, which is an object of cl