summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cocoaint/src/foundation/NSException.inc
blob: b256da2b32b202e7fcf06e3bae9ba6a4700d5912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{ Parsed from Foundation.framework NSException.h }

{$ifdef TYPES}
{$ifndef NSEXCEPTION_PAS_T}
{$define NSEXCEPTION_PAS_T}

{ Callbacks }
type
  NSUncaughtExceptionHandler = procedure (exception: NSException); cdecl;


{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSEXCEPTION_PAS_R}
{$define NSEXCEPTION_PAS_R}

{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSEXCEPTION_PAS_F}
{$define NSEXCEPTION_PAS_F}

{ Functions }
function NSGetUncaughtExceptionHandler: NSUncaughtExceptionHandler; cdecl; external;
procedure NSSetUncaughtExceptionHandler(param1: NSUncaughtExceptionHandler); cdecl; external;

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSEXCEPTION_PAS_S}
{$define NSEXCEPTION_PAS_S}

{ External string constants }
var
  NSGenericException: NSString; cvar; external;
  NSRangeException: NSString; cvar; external;
  NSInvalidArgumentException: NSString; cvar; external;
  NSInternalInconsistencyException: NSString; cvar; external;
  NSMallocException: NSString; cvar; external;
  NSObjectInaccessibleException: NSString; cvar; external;
  NSObjectNotAvailableException: NSString; cvar; external;
  NSDestinationInvalidException: NSString; cvar; external;
  NSPortTimeoutException: NSString; cvar; external;
  NSInvalidSendPortException: NSString; cvar; external;
  NSInvalidReceivePortException: NSString; cvar; external;
  NSPortSendException: NSString; cvar; external;
  NSPortReceiveException: NSString; cvar; external;
  NSOldStyleException: NSString; cvar; external;
  NSAssertionHandlerKey: NSString; cvar; external;

{$endif}
{$endif}

{$ifdef FORWARD}
  NSException = objcclass;
  NSExceptionPointer = ^NSException;
  NSExceptionPtr = NSExceptionPointer;
  NSAssertionHandler = objcclass;
  NSAssertionHandlerPointer = ^NSAssertionHandler;
  NSAssertionHandlerPtr = NSAssertionHandlerPointer;

{$endif}

{$ifdef CLASSES}
{$ifndef NSEXCEPTION_PAS_C}
{$define NSEXCEPTION_PAS_C}

{ NSException }
  NSException = objcclass external (NSObject, NSCopyingProtocol, NSCodingProtocol)
  private
    _name: NSString;
    _reason: NSString;
    _userInfo: NSDictionary;
    reserved: id;
    
  public
    class function exceptionWithName_reason_userInfo(name_: NSString; reason_: NSString; userInfo_: NSDictionary): NSException; message 'exceptionWithName:reason:userInfo:';
    function initWithName_reason_userInfo(aName: NSString; aReason: NSString; aUserInfo: NSDictionary): id; message 'initWithName:reason:userInfo:';
    function name: NSString; message 'name';
    function reason: NSString; message 'reason';
    function userInfo: NSDictionary; message 'userInfo';
    function callStackReturnAddresses: NSArray; message 'callStackReturnAddresses';
    function callStackSymbols: NSArray; message 'callStackSymbols';
    procedure raise_; message 'raise';

    { Adopted Protocols }
    function copyWithZone(zone_: NSZonePtr): id;
    procedure encodeWithCoder(aCoder: NSCoder);
    function initWithCoder(aDecoder: NSCoder): id;
  end;

{ NSAssertionHandler }
  NSAssertionHandler = objcclass external (NSObject)
  private
    _reserved: Pointer;
    
  public
    class function currentHandler: NSAssertionHandler; message 'currentHandler';
    procedure handleFailureInMethod_object_file_lineNumber_description(selector: SEL; object_: id; fileName: NSString; line: NSInteger; firstKey: id); varargs; message 'handleFailureInMethod:object:file:lineNumber:description:';
    procedure handleFailureInFunction_file_lineNumber_description(functionName: NSString; fileName: NSString; line: NSInteger; firstKey: id); varargs; message 'handleFailureInFunction:file:lineNumber:description:';
  end;

{ NSExceptionRaisingConveniencesCategory }
  NSExceptionRaisingConveniencesCategory = objccategory external (NSException)
    class procedure raise_format(name_: NSString; firstKey: id); varargs; message 'raise:format:';
    class procedure raise_format_arguments(name_: NSString; format: NSString; argList: va_list); message 'raise:format:arguments:';
  end;

{$endif}
{$endif}