@@ -23,17 +23,22 @@ @class OFArray OF_GENERIC(ObjectType); @class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFMutableArray OF_GENERIC(ObjectType); @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType); #endif +@class OFSandbox; #define OF_APPLICATION_DELEGATE(cls) \ int \ main(int argc, char *argv[]) \ { \ return of_application_main(&argc, &argv, [cls class]); \ } + +#ifdef OF_HAVE_PLEDGE +# define OF_HAVE_SANDBOX +#endif /*! * @protocol OFApplicationDelegate OFApplication.h ObjFW/OFApplication.h * * @brief A protocol for delegates of OFApplication. @@ -182,10 +187,21 @@ * * @param status The status with which the application will terminate */ + (void)terminateWithStatus: (int)status OF_NO_RETURN; +#ifdef OF_HAVE_SANDBOX +/*! + * @brief Activates the specified sandbox for the application. + * + * This is only available if `OF_HAVE_SANDBOX` is defined. + * + * @param sandbox The sandbox to activate + */ ++ (void)activateSandbox: (OFSandbox*)sandbox; +#endif + /*! * @brief Gets argc and argv. * * @param argc A pointer where a pointer to argc should be stored * @param argv A pointer where a pointer to argv should be stored @@ -216,10 +232,21 @@ * @brief Terminates the application with the specified status. * * @param status The status with which the application will terminate */ - (void)terminateWithStatus: (int)status OF_NO_RETURN; + +#ifdef OF_HAVE_SANDBOX +/*! + * @brief Activates the specified sandbox for the application. + * + * This is only available if `OF_HAVE_SANDBOX` is defined. + * + * @param sandbox The sandbox to activate + */ +- (void)activateSandbox: (OFSandbox*)sandbox; +#endif @end #ifdef __cplusplus extern "C" { #endif