29OF_ASSUME_NONNULL_BEGIN
33@class OFArray OF_GENERIC(ObjectType);
82# define OF_APPLICATION_DELEGATE(class_) \
84 main(int argc, char *argv[]) \
86 return OFApplicationMain(&argc, &argv, \
87 (class_ *)[[class_ alloc] init]); \
90# define OF_APPLICATION_DELEGATE(class_) \
92 main(int argc, char *argv[]) \
94 return OFApplicationMain(&argc, &argv, \
95 (class_ *)[[class_ alloc] init]); \
99 WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, \
100 LPSTR lpCmdLine, int nShowCmd) \
102 int argc = 0, si = 0; \
103 char **argv = NULL, **envp = NULL; \
105 __getmainargs(&argc, &argv, &envp, _CRT_glob, &si); \
107 return OFApplicationMain(&argc, &argv, \
108 (class_ *)[[class_ alloc] init]); \
113extern void __getmainargs(
int *_Nonnull,
char *_Nonnull *_Nullable *_Nullable,
114 char *_Nonnull *_Nullable *_Nullable,
int,
int *_Nonnull);
122# define OF_HAVE_SANDBOX
227OF_SUBCLASSING_RESTRICTED
235 id <OFApplicationDelegate> _Nullable _delegate;
236 void (*_Nullable _SIGINTHandler)(id,
SEL);
238 void (*_Nullable _SIGHUPHandler)(id,
SEL);
239 void (*_Nullable _SIGUSR1Handler)(id,
SEL);
240 void (*_Nullable _SIGUSR2Handler)(id,
SEL);
242#ifdef OF_HAVE_SANDBOX
243 OFSandbox *_Nullable _activeSandbox;
244 OFSandbox *_Nullable _activeSandboxForChildProcesses;
248#ifdef OF_HAVE_CLASS_PROPERTIES
249@property (
class, readonly, nullable, nonatomic)
251@property (
class, readonly, nullable, nonatomic)
OFString *programName;
252@property (
class, readonly, nullable, nonatomic)
254@property (
class, readonly, nullable, nonatomic)
261@property (readonly, nonatomic)
OFString *programName;
266@property (readonly, nonatomic)
OFArray OF_GENERIC(
OFString *) *arguments;
271@property (readonly, nonatomic)
277@property OF_NULLABLE_PROPERTY (assign, nonatomic)
278 id <OFApplicationDelegate> delegate;
280#ifdef OF_HAVE_SANDBOX
281@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFSandbox *activeSandbox;
282@property OF_NULLABLE_PROPERTY (readonly, nonatomic)
283 OFSandbox *activeSandboxForChildProcesses;
324+ (void)terminateWithStatus: (
int)status OF_NO_RETURN;
326#ifdef OF_HAVE_SANDBOX
327+ (void)of_activateSandbox: (OFSandbox *)sandbox;
328+ (void)of_activateSandboxForChildProcesses: (OFSandbox *)sandbox;
331- (instancetype)
init OF_UNAVAILABLE;
339- (void)getArgumentCount: (
int *_Nonnull *_Nonnull)argc
340 andArgumentValues: (
char *_Nullable *_Nonnull *_Nonnull[_Nonnull])argv;
352- (void)terminateWithStatus: (
int)status OF_NO_RETURN;
354#ifdef OF_HAVE_SANDBOX
355- (void)of_activateSandbox: (OFSandbox *)sandbox;
356- (void)of_activateSandboxForChildProcesses: (OFSandbox *)sandbox;
363extern int OFApplicationMain(
int *_Nonnull,
char *_Nullable *_Nonnull[_Nonnull],
364 id <OFApplicationDelegate>);
const OFNotificationName OFApplicationWillTerminateNotification
A notification that will be sent when the application will terminate.
Definition OFApplication.m:98
const OFNotificationName OFApplicationDidFinishLaunchingNotification
A notification that will be sent when the application did finish launching.
Definition OFApplication.m:96
OFConstantString * OFNotificationName
A name for a notification.
Definition OFNotification.h:32
const struct objc_selector * SEL
A selector.
Definition ObjFWRT.h:102
A class which represents the application as an object.
Definition OFApplication.h:229
OFString * programName
The name of the program (argv[0]).
Definition OFApplication.m:191
void terminate()
Terminates the application with the EXIT_SUCCESS status.
Definition OFApplication.m:634
OFDictionary * environment
The environment of the application.
Definition OFApplication.m:201
OFArray * arguments
The arguments passed to the application.
Definition OFApplication.m:196
An abstract class for storing objects in an array.
Definition OFArray.h:110
An abstract class for storing objects in a dictionary.
Definition OFDictionary.h:84
An abstract class for storing, adding and removing objects in an array.
Definition OFMutableArray.h:50
An abstract class for storing and changing objects in a dictionary.
Definition OFMutableDictionary.h:48
A class to represent a notification for or from OFNotificationCenter.
Definition OFNotification.h:42
The root class for all other classes inside ObjFW.
Definition OFObject.h:922
instancetype init()
Initializes an already allocated object.
Definition OFObject.m:671
A class for handling strings.
Definition OFString.h:143
void applicationDidReceiveSIGINT()
A method which is called when the application received a SIGINT.
void applicationDidReceiveSIGUSR1()
A method which is called when the application received a SIGUSR1.
void applicationDidReceiveSIGUSR2()
A method which is called when the application received a SIGUSR2.
void applicationDidReceiveSIGHUP()
A method which is called when the application received a SIGHUP.