Artifact ad7af612fb80bd076572f743ad263ccf59b31c9f65d3d0d2ddbdba0c25a48649:
- File
src/OFApplication.h
— part of check-in
[37db8f0fb3]
at
2010-04-17 22:27:17
on branch trunk
— New ivar naming convention.
ivars are now named like this: thisIsAnIVar. If an accessor exists for
the ivar, the ivar is named like the accessor. This is required for
@property to work. (user: js, size: 2621) [annotate] [blame] [check-ins using]
/* * Copyright (c) 2008 - 2010 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "OFObject.h" @class OFString; @class OFArray; @class OFMutableArray; #define OF_APPLICATION_DELEGATE(cls) \ int \ main(int argc, char *argv[]) \ { \ return of_application_main(argc, argv, [cls class]); \ } /** * \brief A protocol for delegates of OFApplication. */ @protocol OFApplicationDelegate /** * This method is called when the application was initialized and is running * now. */ - (void)applicationDidFinishLaunching; /** * This method is called when the application will terminate. */ - (void)applicationWillTerminate; @end /** * \brief Represents the application as an object. */ @interface OFApplication: OFObject { OFString *programName; OFMutableArray *arguments; id delegate; } /** * \return The only OFApplication instance in the application */ + sharedApplication; /** * \return The name of the program (argv[0]) */ + (OFString*)programName; /** * \return The arguments passed to the application */ + (OFArray*)arguments; /** * Terminates the application. */ + (void)terminate; /** * Terminates the application with the specified status. * * \param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status; /** * Sets argc and argv. * * You should not call this directly! Use of_application_main instead! * * \param argc The number of arguments * \param argv The argument values */ - (void)setArgumentCount: (int)argc andArgumentValues: (char**)argv; /** * \return The name of the program (argv[0]) */ - (OFString*)programName; /** * \return The arguments passed to the application */ - (OFArray*)arguments; /** * \return The delegate of the application */ - (id)delegate; /** * Sets the delegate of the application. * * \param delegate The delegate for the application */ - (void)setDelegate: (id)delegate; /** * Starts the application after everything has been initialized. */ - (void)run; /** * Terminates the application. */ - (void)terminate; /** * Terminates the application with the specified status. * * \param status The status with which the application will terminate */ - (void)terminateWithStatus: (int)status; @end @interface OFObject (OFApplicationDelegate) <OFApplicationDelegate> @end extern int of_application_main(int, char*[], Class);