ObjFW  Diff

Differences From Artifact [879ac4c6e1]:

To Artifact [b8b3df6515]:


13
14
15
16
17
18
19

20
21
22
23





24
25
26
27
28
29
30
13
14
15
16
17
18
19
20




21
22
23
24
25
26
27
28
29
30
31
32







+
-
-
-
-
+
+
+
+
+







 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFString;
#ifndef DOXYGEN
@class OFArray;
@class OFDictionary;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFArray OF_GENERIC(ObjectType);
@class OFDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
#endif

#define OF_APPLICATION_DELEGATE(cls)					\
	int								\
	main(int argc, char *argv[])					\
	{								\
		return of_application_main(&argc, &argv, [cls class]);	\
	}
108
109
110
111
112
113
114
115
116


117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132



133
134
135
136
137
138
139
110
111
112
113
114
115
116


117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132


133
134
135
136
137
138
139
140
141
142







-
-
+
+














-
-
+
+
+







 * `OF_APPLICATION_DELEGATE(NameOfYourClass)` in the .m file of that class. The
 * only required method of the @ref OFApplicationDelegate protocol is
 * @ref OFApplicationDelegate::applicationDidFinishLaunching.
 */
@interface OFApplication: OFObject
{
	OFString *_programName;
	OFArray *_arguments;
	OFDictionary *_environment;
	OFArray OF_GENERIC(OFString*) *_arguments;
	OFDictionary OF_GENERIC(OFString*, OFString*) *_environment;
	int *_argc;
	char ***_argv;
@public
	id <OFApplicationDelegate> _delegate;
	void (*_SIGINTHandler)(id, SEL);
#ifndef _WIN32
	void (*_SIGHUPHandler)(id, SEL);
	void (*_SIGUSR1Handler)(id, SEL);
	void (*_SIGUSR2Handler)(id, SEL);
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy, nonatomic) OFString *programName;
@property (readonly, copy, nonatomic) OFArray *arguments;
@property (readonly, copy, nonatomic) OFDictionary *environment;
@property (readonly, copy, nonatomic) OFArray OF_GENERIC(OFString*) *arguments;
@property (readonly, copy, nonatomic)
    OFDictionary OF_GENERIC(OFString*, OFString*) *environment;
@property (assign) id <OFApplicationDelegate> delegate;
#endif

/*!
 * @brief Returns the only OFApplication instance in the application.
 *
 * @return The only OFApplication instance in the application
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162

163
164
165
166
167
168
169
151
152
153
154
155
156
157

158
159
160
161
162
163
164

165
166
167
168
169
170
171
172







-
+






-
+







+ (OFString*)programName;

/*!
 * @brief Returns the arguments passed to the application.
 *
 * @return The arguments passed to the application
 */
+ (OFArray*)arguments;
+ (OFArray OF_GENERIC(OFString*)*)arguments;

/*!
 * @brief Returns the environment of the application.
 *
 * @return The environment of the application
 */
+ (OFDictionary*)environment;
+ (OFDictionary OF_GENERIC(OFString*, OFString*)*)environment;

/*!
 * @brief Terminates the application with the EXIT_SUCCESS status.
 */
+ (void)terminate OF_NO_RETURN;

/*!
190
191
192
193
194
195
196
197

198
199
200
201
202
203
204

205
206
207
208
209
210
211
193
194
195
196
197
198
199

200
201
202
203
204
205
206

207
208
209
210
211
212
213
214







-
+






-
+







- (OFString*)programName;

/*!
 * @brief Returns the arguments passed to the application.
 *
 * @return The arguments passed to the application
 */
- (OFArray*)arguments;
- (OFArray OF_GENERIC(OFString*)*)arguments;

/*!
 * @brief Returns the environment of the application.
 *
 * @return The environment of the application
 */
- (OFDictionary*)environment;
- (OFDictionary OF_GENERIC(OFString*, OFString*)*)environment;

/*!
 * @brief Returns the delegate of the application.
 *
 * @return The delegate of the application
 */
- (id <OFApplicationDelegate>)delegate;