00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #import "OFObject.h"
00018
00019 @class OFString;
00020 @class OFArray;
00021 @class OFDictionary;
00022 @class OFMutableArray;
00023 @class OFMutableDictionary;
00024
00025 #define OF_APPLICATION_DELEGATE(cls) \
00026 int \
00027 main(int argc, char *argv[]) \
00028 { \
00029 return of_application_main(&argc, &argv, [cls class]); \
00030 }
00031
00035 #ifndef OF_APPLICATION_M
00036 @protocol OFApplicationDelegate <OFObject>
00037 #else
00038 @protocol OFApplicationDelegate
00039 #endif
00040
00044 - (void)applicationDidFinishLaunching;
00045
00046 #ifdef OF_HAVE_OPTIONAL_PROTOCOLS
00047 @optional
00048 #endif
00049
00052 - (void)applicationWillTerminate;
00053 @end
00054
00058 @interface OFApplication: OFObject
00059 {
00060 OFString *programName;
00061 OFMutableArray *arguments;
00062 OFMutableDictionary *environment;
00063 id <OFApplicationDelegate> delegate;
00064 int *argc;
00065 char ***argv;
00066 }
00067
00068 #ifdef OF_HAVE_PROPERTIES
00069 @property (readonly, copy) OFString *programName;
00070 @property (readonly, copy) OFArray *arguments;
00071 @property (readonly, copy) OFDictionary *environment;
00072 @property (retain) id <OFApplicationDelegate> delegate;
00073 #endif
00074
00078 + sharedApplication;
00079
00083 + (OFString*)programName;
00084
00088 + (OFArray*)arguments;
00089
00093 + (OFDictionary*)environment;
00094
00098 + (void)terminate;
00099
00105 + (void)terminateWithStatus: (int)status;
00106
00115 - (void)setArgumentCount: (int*)argc
00116 andArgumentValues: (char**[])argv;
00117
00124 - (void)getArgumentCount: (int**)argc
00125 andArgumentValues: (char***[])argv;
00126
00130 - (OFString*)programName;
00131
00135 - (OFArray*)arguments;
00136
00140 - (OFDictionary*)environment;
00141
00145 - (id <OFApplicationDelegate>)delegate;
00146
00152 - (void)setDelegate: (id <OFApplicationDelegate>)delegate;
00153
00157 - (void)run;
00158
00162 - (void)terminate;
00163
00169 - (void)terminateWithStatus: (int)status;
00170 @end
00171
00172 @interface OFObject (OFApplicationDelegate) <OFApplicationDelegate>
00173 @end
00174
00175 #ifdef __cplusplus
00176 extern "C" {
00177 #endif
00178 extern int of_application_main(int*, char**[], Class);
00179 #ifdef __cplusplus
00180 }
00181 #endif