OpenStep Programming Reference
  Искать только в названиях книг
Загрузить это руководство в формате PDF

Types and Constants

8

Bundle Notification

NSString *NSBundleDidLoadNotification

After a bundle dynamically loads its code, the bundle sends out this notification. NSBundleDidLoadNotification's user information dictionary contains an array of strings which are the names of the classes loaded. The key for this dictionary entry is @"NSLoadedClasses".

Exception Handling

Exception Handler

typedef struct _NSHandler NSHandler;

Exception handler information.

Uncaught Exception Handler

typedef volatile void
    NSUncaughtExceptionHandler
    (NSException *exception);

Registers an uncaught exception handler.

Inconsistent Archive Exception

NSString *NSInconsistentArchiveException;

Consistency error in archive file.

Generic Exception

NSString *NSGenericException;

General programming error.

Internal Inconsistency Exception

NSString *NSInternalInconsistencyException;

Some item that should be invariant changed.

Invalid Argument Exception

NSString *NSInvalidArgumentException;

Invalid argument.

Malloc Exception

NSString *NSMallocException;

No memory left to allocate.

Range Exception

NSString *NSRangeException;

Attempt to access an element beyond the limit of an array or similar structure.

Character Conversion Exception

NSString *NSCharacterConversionException

Raised when conversion to a C string fails.

Geometry

NSPoint

typedef struct _NSPoint {
    float x;
    float y;
} NSPoint;

Graphical point definition.

NSSize

typedef struct _NSSize {
    float width;
    float height;
} NSSize;

Rectangle sizes.

NSRect

typedef struct _NSRect {
    NSPoint origin;
    NSSize size;
} NSRect;

Rectangle size and origin.

Rectangle Sides

typedef enum _NSRectEdge {
    NSMinXEdge,
    NSMinYEdge,
    NSMaxXEdge,
    NSMaxYEdge
} NSRectEdge;

Rectangle sides.

Zero Point

const NSPoint NSZeroPoint;

A zero point.

Zero-Sized Rectangle

const NSRect NSZeroRect;

A rectangle with zero size and origin.

Zero Size

const NSSize NSZeroSize;

A size with zero height and width.

Hash Table

Hash Enumerator

typedef struct NSHashEnumerator;

Private type for enumerating.

Hash Table

typedef struct _NSHashTable NSHashTable;

Hash table type.

Hash Table Call Backs

typedef struct {
    unsigned (*hash)(NSHashTable *table,
                               const void *anObject);
    BOOL (*isEqual)(NSHashTable *table,
                               const void *anObject,
                               const void *anObject);
    void (*retain)(NSHashTable *table,
                               const void *anObject);
    void (*release)(NSHashTable *table,
                               void *anObject);

    NSString *(*describe)(NSHashTable *table,
                               const void *anObject);
} NSHashTableCallBacks;

Describes callback functions. hash is a hashing function. Note that elements with equal values must have equal hash function values. isEqual is a comparison function. retain is a retaining function call when adding elements to the table. release is a releasing function called when a data element is removed from the table. describe is a description function.
The following constants describe specific hash table callbacks. See NSFoundationGlobals.m for more information.
const NSHashTableCallBacks NSIntHashCallBacks;

For sets of pointer-sized or smaller quantities.

const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks;

For sets of pointers hashed by address.
const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks;

For sets of objects without retaining and releasing.
const NSHashTableCallBacks NSObjectHashCallBacks;

For sets of objects; similar to NSSet.
const NSHashTableCallBacks NSOwnedPointerHashCallBacks;

For sets of pointers with transfer of ownership upon insertion.
const NSHashTableCallBacks NSPointerToStructHashCallBacks;

For sets of pointers to structs when the first field of the struct is the size of an int.
const NSHashTableCallBacks NSOwnedObjectIdentityHashCallBacks;

For sets that own the objects but use pointer comparison.

Map Table

Map Enumerator

typedef struct NSMapEnumerator;

Private type for enumerating.

Map Table

typedef struct _NSMapTable NSMapTable;

Map table type.

Map Table Key Callbacks

typedef struct {
    unsigned (*hash)(NSMapTable *table,
                          const void *anObject);
    BOOL (*isEqual)(NSMapTable *table,
                          const void *anObject,
                          const void *anObject);
    void (*retain)(NSMapTable *table,
                          const void *anObject);
    void (*release)(NSMapTable *table,
                          void *anObject);
    NSString *(*describe)(NSMapTable *table,
                          const void *anObject);
    const void *notAKeyMarker;
} NSMapTableKeyCallBacks;

Callback functions for a key. hash is a hashing function. Note that elements with equal values must have equal hash function values. isEqual is a comparison function. retain is a retaining function call when adding elements to the table. release is a releasing function called when a data element is removed from the table. describe is a description function. notAKeyMarker is a quantity that is not a key to the hash table.

Map Table Value Callbacks

typedef struct {
    void (*retain)(NSMapTable *table,
                          const void *anObject);
    void (*release)(NSMapTable *table,
                          void *anObject);
    NSString *(*describe)(NSMapTable *table,
                          const void *anObject);
 } NSMapTableValueCallBacks;

Callback functions for a value. retain is a retaining function call when adding elements to the table. release is a releasing function called when a data element is removed from the table. describe is a description function.

Not An Integer Map Key

#define NSNotAnIntMapKey;

Quantity that is never a map key.

Not A Pointer Map Key

#define NSNotAPointerMapKey;

Quantity that is never a map key.

Pointer-Sized Map Key Callbacks

const NSMapTableKeyCallBacks NSIntMapKeyCallBacks;

For keys that are pointer-sized or smaller quantities.

Pointer-Sized MapValue Callbacks

const NSMapTableValueCallBacks NSIntMapValueCallBacks;

For values that are pointer-sized quantities.

Non-Owned Pointer Map Key Callbacks

const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks;

For keys that are pointers not freed.

Non-Owned Pointer Map Value Callbacks

const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks;

For values that are owned pointers.

Non-Owned Pointer Or Null Map Key Callbacks

const NSMapTableKeyCallBacks
    NSNonOwnedPointerOrNullMapKeyCallBacks;

For keys that are pointers not freed, or NULL.

Non-Retained Object Map Key Callbacks

const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks;
For sets of objects without retaining and releasing.

Object Map Key Callbacks

const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks;

For keys that are objects.

Object Map Value Callbacks

const NSMapTableValueCallBacks NSObjectMapValueCallBacks;

For values that are objects.

Owned Pointer Map Key Callbacks

const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks;

For keys that are pointers with transfer of ownership upon insertion.

Owned Pointer Map Value Callbacks

const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks;

For values that are owned pointers.

Non-Retained Object Map Value Callbacks

const NSMapTableValueCallBacks
    NSNonRetainedObjectMapValueCallBacks;

For values which are objects that should not be retained.

Notification Queue

Posting Style

typedef enum
    NSPostWhenIdle,
    NSPostASAP,
    NSPostNow
} NSPostingStyle;

NSPostWhenIdle means to post the notification when the run loop is idle. NSPostASAP means to post the notification as soon as possible. And NSPostNow means to post the notification immediately.

Notification Coalescing

typedef enum {
    NSNotificationNoCoalescing,
    NSNotificationCoalescingOnName,
    NSNotificationCoalescingOnSender,
} NSNotificationCoalescing;

NSNotificationNoCoalescing means not to coalesce similar notifications in the queue. NSNotificationCoalescingOnName means to coalesce notifications in the queue matching name. And
NSNotificationCoalescingOnSender means to coalesce notifications in the queue matching sender.

Run Loop

Connection Reply Mode

NSString *NSConnectionReplyMode;

NSRunLoop mode in which Distributed Object system seeks replies.

Default Run Loop Mode

NSString *NSDefaultRunLoopMode;

Common NSRunLoop mode.

Searching

Comparison Result

typedef enum _NSComparisonResult {
    NSOrderedAscending,
    NSOrderedSame,
    NSOrderedDescending
} NSComparisonResult;

Ordered comparison results.

Anchored Search

enum {
    NSCaseInsensitiveSearch,
    NSLiteralSearch,
    NSBackwardsSearch,
    NSAnchoredSearch
};

Flags passed to various search methods.

Not Found

enum {NSNotFound};

Indicates an item not found.

String

String Encodings

typedef unsigned NSStringEncoding;

Known string encodings.

Unicode String Encodings

enum {
    NSASCIIStringEncoding,
    NSNEXTSTEPStringEncoding,
    NSJapaneseEUCStringEncoding,
    NSUTF8StringEncoding,
    NSISOLatin1StringEncoding ,
    NSSymbolStringEncoding ,
    NSNonLossyASCIIStringEncoding,
    NSShiftJISStringEncoding,
    NSISOLatin2StringEncoding,
    NSUnicodeStringEncoding
};

Known Unicode string encodings.

OpenStep Unicode Base

enum _NSOpenStepUnicodeReservedBase {
    NSOpenStepUnicodeReservedBase
};

Base for Unicode characters.

Maximum String Length

NSMaximumStringLength

Maximum string length, defined as INT_MAX-1.

Threads

Thread Priorities

typedef enum {
    NSInteractiveThreadPriority,
    NSBackgroundThreadPriority,
    NSLowThreadPriority
} NSThreadPriority;

Notifications

NSString *NSBecomingMultiThreaded;
NSString *NSThreadExiting;

User Defaults

NSString *NSArgumentDomain;
//For defaults parsed from the application's arguments.
NSString *NSGlobalDomain;
//For defaults seen by all applications.
NSString *NSRegistrationDomain;
//For registered defaults.
NSString *NSUserDefaultsChanged;
//Public notification.
NSString *NSWeekDayNameArray;
//Keys for language-dependent information.
NSString *NSShortWeekDayNameArray;
NSString *NSMonthNameArray;
NSString *NSShortMonthNameArray;
NSString *NSTimeFormatString;
NSString *NSDateFormatString;
NSString *NSTimeDateFormatString;
NSString *NSShortTimeDateFormatString;
NSString *NSCurrencySymbol;
NSString *NSDecimalSeparator;
NSString *NSThousandsSeparator;
NSString *NSInternationalCurrencyString;
NSString *NSCurrencyString;
NSString *NSDecimalDigits;
NSString *NSAMPMDesignation;

Miscellaneous

NSArgumentInfo

typedef struct {
    int         offset;
    int         size;
    char        *type;
} NSArgumentInfo;

Specifies the layout of arguments used in invocations. See the NSCoder class description for a list of argument types.

NSRange

typedef struct _NSRange {
    unsigned int location;
    unsigned int length;
} NSRange;

Specifies a range of items in arrays, strings, and so on.

NSTimeInterval

typedef double NSTimeInterval;

Time interval difference between two dates.

NSZone

typedef struct _NSZone NSZone;

Large region allocation. See also NSCreateZone()(Foundation Kit Functions chapter).