Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -128,17 +128,25 @@ void (*_SIGUSR1Handler)(id, SEL); void (*_SIGUSR2Handler)(id, SEL); #endif } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy, nonatomic) OFString *programName; -@property (readonly, copy, nonatomic) OFArray OF_GENERIC(OFString*) *arguments; -@property (readonly, copy, nonatomic) +/*! + * The name of the program (argv[0]). + */ +@property (readonly, assign) OFString *programName; + +/*! + * The arguments passed to the application. + */ +@property (readonly, assign) OFArray OF_GENERIC(OFString*) *arguments; + +/*! + * The environment of the application. + */ +@property (readonly, assign) OFDictionary OF_GENERIC(OFString*, OFString*) *environment; -@property OF_NULLABLE_PROPERTY (assign) id delegate; -#endif /*! * @brief Returns the only OFApplication instance in the application. * * @return The only OFApplication instance in the application @@ -185,31 +193,10 @@ * @param argv A pointer where a pointer to argv should be stored */ - (void)getArgumentCount: (int *_Nonnull *_Nonnull)argc andArgumentValues: (char *_Nonnull *_Nonnull *_Nonnull[])argv; -/*! - * @brief Returns the name of the program (argv[0]). - * - * @return The name of the program (argv[0]) - */ -- (OFString*)programName; - -/*! - * @brief Returns the arguments passed to the application. - * - * @return The arguments passed to the application - */ -- (OFArray OF_GENERIC(OFString*)*)arguments; - -/*! - * @brief Returns the environment of the application. - * - * @return The environment of the application - */ -- (OFDictionary OF_GENERIC(OFString*, OFString*)*)environment; - /*! * @brief Returns the delegate of the application. * * @return The delegate of the application */ Index: src/OFApplication.m ================================================================== --- src/OFApplication.m +++ src/OFApplication.m @@ -131,10 +131,13 @@ return 0; } @implementation OFApplication +@synthesize programName = _programName, arguments = _arguments; +@synthesize environment = _environment; + + (OFApplication*)sharedApplication { return app; } @@ -395,25 +398,10 @@ { *argc = _argc; *argv = _argv; } -- (OFString*)programName -{ - OF_GETTER(_programName, false) -} - -- (OFArray*)arguments -{ - OF_GETTER(_arguments, false) -} - -- (OFDictionary*)environment -{ - OF_GETTER(_environment, false) -} - - (id )delegate { return _delegate; } Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -94,14 +94,10 @@ # endif @interface OFArray: #endif OFObject -#ifdef OF_HAVE_PROPERTIES -@property (readonly) size_t count; -#endif - /*! * @brief Creates a new OFArray. * * @return A new autoreleased OFArray */ Index: src/OFCollection.h ================================================================== --- src/OFCollection.h +++ src/OFCollection.h @@ -22,14 +22,10 @@ * @protocol OFCollection OFCollection.h ObjFW/OFCollection.h * * @brief A protocol with methods common for all collections. */ @protocol OFCollection -#ifdef OF_HAVE_PROPERTIES -@property (readonly) size_t count; -#endif - /*! * @brief Returns the number of objects in the collection. * * @return The number of objects in the collection */ Index: src/OFDataArray.h ================================================================== --- src/OFDataArray.h +++ src/OFDataArray.h @@ -39,15 +39,14 @@ { uint8_t *_items; size_t _count, _itemSize, _capacity; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly) void *items; -@property (readonly) size_t count; +/*! + * The size of a single item in the OFDataArray in bytes. + */ @property (readonly) size_t itemSize; -#endif /*! * @brief Creates a new OFDataArray with an item size of 1. * * @return A new autoreleased OFDataArray @@ -198,17 +197,10 @@ * * @return The number of items in the OFDataArray */ - (size_t)count; -/*! - * @brief Returns the size of a single item in the OFDataArray in bytes. - * - * @return The size of a single item in the OFDataArray in bytes - */ -- (size_t)itemSize; - /*! * @brief Returns all items of the OFDataArray as a C array. * * @warning The pointer is only valid until the OFDataArray is changed! * Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -54,10 +54,12 @@ _OFDataArray_MessagePackValue_reference = 1; _OFDataArray_Hashing_reference = 1; } @implementation OFDataArray +@synthesize itemSize = _itemSize; + + (instancetype)dataArray { return [[[self alloc] init] autorelease]; } @@ -359,15 +361,10 @@ - (size_t)count { return _count; } -- (size_t)itemSize -{ - return _itemSize; -} - - (void*)items { return _items; } Index: src/OFHTTPClient.h ================================================================== --- src/OFHTTPClient.h +++ src/OFHTTPClient.h @@ -107,50 +107,27 @@ OFURL *_lastURL; bool _lastWasHEAD; OFHTTPResponse *_lastResponse; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The delegate of the HTTP request. + */ @property OF_NULLABLE_PROPERTY (assign) id delegate; + +/*! + * Whether redirects from HTTPS to HTTP will be allowed. + */ @property bool insecureRedirectsAllowed; -#endif /*! * @brief Creates a new OFHTTPClient. * * @return A new, autoreleased OFHTTPClient */ + (instancetype)client; -/*! - * @brief Sets the delegate of the HTTP request. - * - * @param delegate The delegate of the HTTP request - */ -- (void)setDelegate: (nullable id )delegate; - -/*! - * @brief Returns the delegate of the HTTP reqeust. - * - * @return The delegate of the HTTP request - */ -- (nullable id )delegate; - -/*! - * @brief Sets whether redirects from HTTPS to HTTP are allowed. - * - * @param allowed Whether redirects from HTTPS to HTTP are allowed - */ -- (void)setInsecureRedirectsAllowed: (bool)allowed; - -/*! - * @brief Returns whether redirects from HTTPS to HTTP will be allowed - * - * @return Whether redirects from HTTPS to HTTP will be allowed - */ -- (bool)insecureRedirectsAllowed; - /*! * @brief Performs the specified HTTP request and returns an OFHTTPResponse. * * @return An OFHTTPResponse with the response for the HTTP request */ Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -252,10 +252,13 @@ _socket = nil; } @end @implementation OFHTTPClient +@synthesize delegate = _delegate; +@synthesize insecureRedirectsAllowed = _insecureRedirectsAllowed; + + (instancetype)client { return [[[self alloc] init] autorelease]; } @@ -264,30 +267,10 @@ [self close]; [super dealloc]; } -- (void)setDelegate: (id )delegate -{ - _delegate = delegate; -} - -- (id )delegate -{ - return _delegate; -} - -- (void)setInsecureRedirectsAllowed: (bool)allowed -{ - _insecureRedirectsAllowed = allowed; -} - -- (bool)insecureRedirectsAllowed -{ - return _insecureRedirectsAllowed; -} - - (OFHTTPResponse*)performRequest: (OFHTTPRequest*)request { return [self performRequest: request redirects: 10]; } Index: src/OFHTTPRequest.h ================================================================== --- src/OFHTTPRequest.h +++ src/OFHTTPRequest.h @@ -78,19 +78,35 @@ OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; OFDataArray *_body; OFString *_remoteAddress; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The URL of the HTTP request. + */ @property (copy) OFURL *URL; + +/*! + * The request method of the HTTP request. + */ @property of_http_request_method_t method; -@property of_http_request_protocol_version_t protocolVersion; + +/*! + * The headers for the HTTP request. + */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; + +/*! + * The entity body of the HTTP request. + */ @property OF_NULLABLE_PROPERTY (retain) OFDataArray *body; + +/*! + * The remote address from which the request originates. + */ @property OF_NULLABLE_PROPERTY (copy) OFString *remoteAddress; -#endif /*! * @brief Creates a new OFHTTPRequest. * * @return A new, autoreleased OFHTTPRequest @@ -111,38 +127,10 @@ * @param URL The URL for the request * @return An initialized OFHTTPRequest */ - initWithURL: (OFURL*)URL; -/*! - * @brief Sets the URL of the HTTP request. - * - * @param URL The URL of the HTTP request - */ -- (void)setURL: (OFURL*)URL; - -/*! - * @brief Returns the URL of the HTTP request. - * - * @return The URL of the HTTP request - */ -- (OFURL*)URL; - -/*! - * @brief Sets the request method of the HTTP request. - * - * @param method The request method of the HTTP request - */ -- (void)setMethod: (of_http_request_method_t)method; - -/*! - * @brief Returns the request method of the HTTP request. - * - * @return The request method of the HTTP request - */ -- (of_http_request_method_t)method; - /*! * @brief Sets the protocol version of the HTTP request. * * @param protocolVersion The protocol version of the HTTP request */ @@ -168,32 +156,10 @@ * * @return The protocol version of the HTTP request as a string */ - (OFString*)protocolVersionString; -/*! - * @brief Sets a dictionary with headers for the HTTP request. - * - * @param headers A dictionary with headers for the HTTP request - */ -- (void)setHeaders: - (nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers; - -/*! - * @brief Returns a dictionary with headers for the HTTP request. - * - * @return A dictionary with headers for the HTTP request. - */ -- (nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers; - -/*! - * @brief Sets the entity body of the HTTP request. - * - * @param body The entity body of the HTTP request - */ -- (void)setBody: (nullable OFDataArray*)body; - /*! * @brief Sets the entity body of the HTTP request to the specified string * encoded in UTF-8. * * @param string The string to use for the entity body @@ -207,31 +173,10 @@ * @param string The string to use for the entity body * @param encoding The encoding to encode the string with */ - (void)setBodyFromString: (nullable OFString*)string encoding: (of_string_encoding_t)encoding; - -/*! - * @brief Returns the entity body of the HTTP request. - * - * @return The entity body of the HTTP request - */ -- (nullable OFDataArray*)body; - -/*! - * @brief Sets the remote address from which the request originates. - * - * @param remoteAddress The remote address from which the request originates - */ -- (void)setRemoteAddress: (nullable OFString*)remoteAddress; - -/*! - * @brief Returns the remote address from which the request originates. - * - * @return The remote address from which the request originates - */ -- (nullable OFString*)remoteAddress; @end #ifdef __cplusplus extern "C" { #endif Index: src/OFHTTPRequest.m ================================================================== --- src/OFHTTPRequest.m +++ src/OFHTTPRequest.m @@ -76,10 +76,13 @@ @throw [OFInvalidFormatException exception]; } @implementation OFHTTPRequest +@synthesize URL = _URL, method = _method, headers = _headers, body = _body; +@synthesize remoteAddress = _remoteAddress; + + (instancetype)request { return [[[self alloc] init] autorelease]; } @@ -180,30 +183,10 @@ OF_HASH_FINALIZE(hash); return hash; } -- (void)setURL: (OFURL*)URL -{ - OF_SETTER(_URL, URL, true, 1) -} - -- (OFURL*)URL -{ - OF_GETTER(_URL, true) -} - -- (void)setMethod: (of_http_request_method_t)method -{ - _method = method; -} - -- (of_http_request_method_t)method -{ - return _method; -} - - (void)setProtocolVersion: (of_http_request_protocol_version_t)protocolVersion { if (protocolVersion.major != 1 || protocolVersion.minor > 1) @throw [OFUnsupportedVersionException exceptionWithVersion: [OFString stringWithFormat: @"%u.%u", @@ -246,25 +229,10 @@ { return [OFString stringWithFormat: @"%u.%u", _protocolVersion.major, _protocolVersion.minor]; } -- (void)setHeaders: (OFDictionary*)headers -{ - OF_SETTER(_headers, headers, true, 1) -} - -- (OFDictionary*)headers -{ - OF_GETTER(_headers, true) -} - -- (void)setBody: (OFDataArray*)body -{ - OF_SETTER(_body, body, true, 0) -} - - (void)setBodyFromString: (OFString*)string { [self setBodyFromString: string encoding: OF_STRING_ENCODING_UTF_8]; } @@ -280,25 +248,10 @@ [self setBody: body]; objc_autoreleasePoolPop(pool); } -- (OFDataArray*)body -{ - OF_GETTER(_body, true) -} - -- (void)setRemoteAddress: (OFString*)remoteAddress -{ - OF_SETTER(_remoteAddress, remoteAddress, true, 1) -} - -- (OFString*)remoteAddress -{ - OF_GETTER(_remoteAddress, true) -} - - (OFString*)description { void *pool = objc_autoreleasePoolPush(); const char *method = of_http_request_method_to_string(_method); OFString *indentedHeaders, *indentedBody, *ret; Index: src/OFHTTPResponse.h ================================================================== --- src/OFHTTPResponse.h +++ src/OFHTTPResponse.h @@ -31,16 +31,20 @@ of_http_request_protocol_version_t _protocolVersion; short _statusCode; OFDictionary OF_GENERIC(OFString*, OFString*) *_headers; } -#ifdef OF_HAVE_PROPERTIES -@property of_http_request_protocol_version_t protocolVersion; +/*! + * The status code of the reply to the HTTP request. + */ @property short statusCode; + +/*! + * The headers of the reply to the HTTP request. + */ @property OF_NULLABLE_PROPERTY (copy) OFDictionary OF_GENERIC(OFString*, OFString*) *headers; -#endif /*! * @brief Sets the protocol version of the HTTP request reply. * * @param protocolVersion The protocol version of the HTTP request reply @@ -67,39 +71,10 @@ * * @return The protocol version of the HTTP request reply as a string */ - (OFString*)protocolVersionString; -/*! - * @brief Returns the status code of the reply to the HTTP request. - * - * @return The status code of the reply to the HTTP request - */ -- (short)statusCode; - -/*! - * @brief Sets the status code of the reply to the HTTP request. - * - * @param statusCode The status code of the reply to the HTTP request - */ -- (void)setStatusCode: (short)statusCode; - -/*! - * @brief Returns the headers of the reply to the HTTP request. - * - * @return The headers of the reply to the HTTP request - */ -- (nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers; - -/*! - * @brief Returns the headers of the reply to the HTTP request. - * - * @param headers The headers of the reply to the HTTP request - */ -- (void)setHeaders: - (nullable OFDictionary OF_GENERIC(OFString*, OFString*)*)headers; - /*! * @brief Returns the reply as a string, trying to detect the encoding. * * @return The reply as a string */ Index: src/OFHTTPResponse.m ================================================================== --- src/OFHTTPResponse.m +++ src/OFHTTPResponse.m @@ -26,10 +26,12 @@ #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" @implementation OFHTTPResponse +@synthesize statusCode = _statusCode, headers = _headers; + - init { self = [super init]; _protocolVersion.major = 1; @@ -89,30 +91,10 @@ { return [OFString stringWithFormat: @"%u.%u", _protocolVersion.major, _protocolVersion.minor]; } -- (short)statusCode -{ - return _statusCode; -} - -- (void)setStatusCode: (short)statusCode -{ - _statusCode = statusCode; -} - -- (OFDictionary*)headers -{ - OF_GETTER(_headers, true) -} - -- (void)setHeaders: (OFDictionary*)headers -{ - OF_SETTER(_headers, headers, true, 1) -} - - (OFString*)string { return [self stringWithEncoding: OF_STRING_ENCODING_AUTODETECT]; } Index: src/OFHTTPServer.h ================================================================== --- src/OFHTTPServer.h +++ src/OFHTTPServer.h @@ -76,80 +76,37 @@ id _delegate; OFString *_name; OFTCPSocket *_listeningSocket; } -#ifdef OF_HAVE_PROPERTIES -@property OF_NULLABLE_PROPERTY (copy) OFString *host; +/*! + * The host on which the HTTP server will listen. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString* host; + +/*! + * The port on which the HTTP server will listen. + */ @property uint16_t port; + +/*! + * The delegate for the HTTP server. + */ @property OF_NULLABLE_PROPERTY (assign) id delegate; -@property OF_NULLABLE_PROPERTY (copy) OFString *name; -#endif + +/*! + * The server name the server presents to clients. + */ +@property (copy) OFString *name; /*! * @brief Creates a new HTTP server. * * @return A new HTTP server */ + (instancetype)server; -/*! - * @brief Sets the host on which the HTTP server will listen. - * - * @param host The host to listen on - */ -- (void)setHost: (OFString*)host; - -/*! - * @brief Returns the host on which the HTTP server will listen. - * - * @return The host on which the HTTP server will listen - */ -- (nullable OFString*)host; - -/*! - * @brief Sets the port on which the HTTP server will listen. - * - * @param port The port to listen on - */ -- (void)setPort: (uint16_t)port; - -/*! - * @brief Returns the port on which the HTTP server will listen. - * - * @return The port on which the HTTP server will listen - */ -- (uint16_t)port; - -/*! - * @brief Sets the delegate for the HTTP server. - * - * @param delegate The delegate for the HTTP server - */ -- (void)setDelegate: (nullable id )delegate; - -/*! - * @brief Returns the delegate for the HTTP server. - * - * @return The delegate for the HTTP server - */ -- (nullable id )delegate; - -/*! - * @brief Sets the server name the server presents to clients. - * - * @param name The server name to present to clients - */ -- (void)setName: (nullable OFString*)name; - -/*! - * @brief Returns the server name the server presents to clients. - * - * @return The server name the server presents to clients - */ -- (nullable OFString*)name; - /*! * @brief Starts the HTTP server in the current thread's runloop. */ - (void)start; Index: src/OFHTTPServer.m ================================================================== --- src/OFHTTPServer.m +++ src/OFHTTPServer.m @@ -387,11 +387,11 @@ } } @catch (OFWriteFailedException *e) { return false; } - abort(); + OF_ENSURE(0); } - (bool)parseProlog: (OFString*)line { OFString *method; @@ -644,10 +644,12 @@ response: response]; } @end @implementation OFHTTPServer +@synthesize host = _host, port = _port, delegate = _delegate, name = _name; + + (instancetype)server { return [[[self alloc] init] autorelease]; } @@ -668,50 +670,10 @@ [_name release]; [super dealloc]; } -- (void)setHost: (OFString*)host -{ - OF_SETTER(_host, host, true, 1) -} - -- (OFString*)host -{ - OF_GETTER(_host, true) -} - -- (void)setPort: (uint16_t)port -{ - _port = port; -} - -- (uint16_t)port -{ - return _port; -} - -- (void)setDelegate: (id )delegate -{ - _delegate = delegate; -} - -- (id )delegate -{ - return _delegate; -} - -- (void)setName: (OFString*)name -{ - OF_SETTER(_name, name, true, 1) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - - (void)start { if (_host == nil) @throw [OFInvalidArgumentException exception]; Index: src/OFHash.h ================================================================== --- src/OFHash.h +++ src/OFHash.h @@ -22,13 +22,11 @@ * @protocol OFHash OFHash.h ObjFW/OFHash.h * * @brief A protocol for classes providing hash functions. */ @protocol OFHash -#ifdef OF_HAVE_PROPERTIES @property (readonly, getter=isCalculated) bool calculated; -#endif /*! * @brief Creates a new hash. * * @return A new autoreleased OFHash Index: src/OFINICategory.h ================================================================== --- src/OFINICategory.h +++ src/OFINICategory.h @@ -33,27 +33,14 @@ { OFString *_name; OFMutableArray *_lines; } -#ifdef OF_HAVE_PROPERTIES -@property (copy) OFString *name; -#endif - -/*! - * @brief Sets the name of the INI category. - * - * @param name The name to set - */ -- (void)setName: (OFString*)name; - -/*! - * @brief Returns the name of the INI category. - * - * @return The name of the INI category - */ -- (OFString*)name; +/*! + * The name of the INI category + */ +@property (copy) OFString *name; /*! * @brief Returns the string value for the specified key, or `nil` if it does * not exist. * Index: src/OFINICategory.m ================================================================== --- src/OFINICategory.m +++ src/OFINICategory.m @@ -117,10 +117,12 @@ [super dealloc]; } @end @implementation OFINICategory +@synthesize name = _name; + - (instancetype)OF_init { self = [super init]; @try { @@ -144,20 +146,10 @@ [_lines release]; [super dealloc]; } -- (void)setName: (OFString*)name -{ - OF_SETTER(_name, name, true, true) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - - (void)OF_parseLine: (OFString*)line { if (![line hasPrefix: @";"]) { OFINICategory_Pair *pair = [[[OFINICategory_Pair alloc] init] autorelease]; Index: src/OFIntrospection.h ================================================================== --- src/OFIntrospection.h +++ src/OFIntrospection.h @@ -47,36 +47,24 @@ SEL _selector; OFString *_name; const char *_typeEncoding; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The selector of the method. + */ @property (readonly) SEL selector; + +/*! + * The name of the method. + */ @property (readonly, copy) OFString *name; -@property OF_NULLABLE_PROPERTY (assign, readonly) const char *typeEncoding; -#endif - -/*! - * @brief Returns the selector of the method. - * - * @return The selector of the method - */ -- (SEL)selector; - -/*! - * @brief Returns the name of the method. - * - * @return The name of the method - */ -- (OFString*)name; - -/*! - * @brief Returns the type encoding for the method. - * - * @return The type encoding for the method - */ -- (nullable const char*)typeEncoding; + +/*! + * The type encoding for the method. + */ +@property OF_NULLABLE_PROPERTY (readonly) const char *typeEncoding; @end /*! * @class OFProperty OFIntrospection.h ObjFW/OFIntrospection.h * @@ -87,25 +75,17 @@ OFString *_name; unsigned _attributes; OFString *_getter, *_setter; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the property. + */ @property (readonly, copy) OFString *name; -@property (readonly) unsigned attributes; -@property OF_NULLABLE_PROPERTY (copy, readonly) OFString *getter, *setter; -#endif /*! - * @brief Returns the name of the property. - * - * @return The name of the property - */ -- (OFString*)name; - -/*! - * @brief Returns the attributes of the property. + * The attributes of the property. * * The attributes are a bitmask with the following possible flags:@n * Flag | Description * ------------------------------|------------------------------------- * OF_PROPERTY_READONLY | The property is declared `readonly` @@ -116,28 +96,22 @@ * OF_PROPERTY_NONATOMIC | The property is declared `nonatomic` * OF_PROPERTY_ATOMIC | The property is declared `atomic` * OF_PROPERTY_WEAK | The property is declared `weak` * OF_PROPERTY_SYNTHESIZED | The property is synthesized * OF_PROPERTY_DYNAMIC | The property is dynamic - * - * @return The attributes of the property - */ -- (unsigned)attributes; - -/*! - * @brief Returns the name of the getter. - * - * @return The name of the getter - */ -- (nullable OFString*)getter; - -/*! - * @brief Returns the name of the setter. - * - * @return The name of the setter - */ -- (nullable OFString*)setter; + */ +@property (readonly) unsigned attributes; + +/*! + * The name of the getter. + */ +@property OF_NULLABLE_PROPERTY (readonly, copy) OFString *getter; + +/*! + * @return The name of the setter. + */ +@property OF_NULLABLE_PROPERTY (readonly, copy) OFString *setter; @end /*! * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h * @@ -148,36 +122,24 @@ OFString *_name; const char *_typeEncoding; ptrdiff_t _offset; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the instance variable. + */ @property (readonly, copy) OFString *name; + +/*! + * The offset of the instance variable. + */ @property (readonly) ptrdiff_t offset; -@property OF_NULLABLE_PROPERTY (assign, readonly) const char *typeEncoding; -#endif - -/*! - * @brief Returns the name of the instance variable. - * - * @return The name of the instance variable - */ -- (OFString*)name; - -/*! - * @brief Returns the offset of the instance variable. - * - * @return The offset of the instance variable - */ -- (ptrdiff_t)offset; - -/*! - * @brief Returns the type encoding for the instance variable. - * - * @return The type encoding for the instance variable - */ -- (nullable const char*)typeEncoding; + +/*! + * The type encoding for the instance variable. + */ +@property OF_NULLABLE_PROPERTY (readonly) const char *typeEncoding; @end /*! * @class OFIntrospection OFIntrospection.h ObjFW/OFIntrospection.h * @@ -189,49 +151,22 @@ OFMutableArray OF_GENERIC(OFMethod*) *_instanceMethods; OFMutableArray OF_GENERIC(OFProperty*) *_properties; OFMutableArray OF_GENERIC(OFInstanceVariable*) *_instanceVariables; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *classMethods; -@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *instanceMethods; -@property (readonly, copy) OFArray OF_GENERIC(OFProperty*) *properties; -@property (readonly, copy) - OFArray OF_GENERIC(OFInstanceVariable*) *instanceVariables; -#endif - -/*! - * @brief Creates a new introspection for the specified class. - * - * @return A new, autoreleased introspection for the specified class - */ -+ (instancetype)introspectionWithClass: (Class)class_; - -/*! - * @brief Initializes an already allocated OFIntrospection with the specified - * class. - * - * @return An initialized OFIntrospection - */ -- initWithClass: (Class)class_; - -/*! - * @brief Returns the class methods of the class. - * - * @return An array of objects of class @ref OFMethod - */ -- (OFArray OF_GENERIC(OFMethod*)*)classMethods; - -/*! - * @brief Returns the instance methods of the class. - * - * @return An array of objects of class @ref OFMethod - */ -- (OFArray OF_GENERIC(OFMethod*)*)instanceMethods; - -/*! - * @brief Returns the properties of the class. +/*! + * The class methods of the class. + */ +@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *classMethods; + +/*! + * The instance methods of the class. + */ +@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *instanceMethods; + +/*! + * The properties of the class. * * @warning **Do not rely on this, as this behaves differently depending on the * compiler and ABI used!** * * @warning For the ObjFW ABI, Clang only emits data for property introspection @@ -245,21 +180,33 @@ * `@``property`, even if no `@``synchronize` or `@``dynamic` has been * used. * * @warning GCC does not emit any data for property introspection for the GNU * ABI. - * - * @return An array of objects of class @ref OFProperty */ -- (OFArray OF_GENERIC(OFProperty*)*)properties; +@property (readonly, copy) OFArray OF_GENERIC(OFProperty*) *properties; /*! - * @brief Returns the instance variables of the class. - * - * @return An array of objects of class @ref OFInstanceVariable + * The instance variables of the class. */ -- (OFArray OF_GENERIC(OFInstanceVariable*)*)instanceVariables; +@property (readonly, copy) + OFArray OF_GENERIC(OFInstanceVariable*) *instanceVariables; /* TODO: protocols */ + +/*! + * @brief Creates a new introspection for the specified class. + * + * @return A new, autoreleased introspection for the specified class + */ ++ (instancetype)introspectionWithClass: (Class)class_; + +/*! + * @brief Initializes an already allocated OFIntrospection with the specified + * class. + * + * @return An initialized OFIntrospection + */ +- initWithClass: (Class)class_; @end OF_ASSUME_NONNULL_END Index: src/OFIntrospection.m ================================================================== --- src/OFIntrospection.m +++ src/OFIntrospection.m @@ -24,10 +24,12 @@ #import "OFArray.h" #import "OFInitializationFailedException.h" @implementation OFMethod +@synthesize selector = _selector, name = _name, typeEncoding = _typeEncoding; + #if defined(OF_OBJFW_RUNTIME) - (instancetype)OF_initWithMethod: (struct objc_method*)method { self = [super init]; @@ -74,25 +76,10 @@ [_name release]; [super dealloc]; } -- (SEL)selector -{ - return _selector; -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (const char*)typeEncoding -{ - return _typeEncoding; -} - - (OFString*)description { return [OFString stringWithFormat: @"<%@: %@ [%s]>", [self class], _name, _typeEncoding]; } @@ -144,10 +131,13 @@ return hash; } @end @implementation OFProperty +@synthesize name = _name, attributes = _attributes; +@synthesize getter = _getter, setter = _setter; + #if defined(OF_OBJFW_RUNTIME) - (instancetype)OF_initWithProperty: (struct objc_property*)property { self = [super init]; @@ -314,30 +304,10 @@ [_setter release]; [super dealloc]; } -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (unsigned)attributes -{ - return _attributes; -} - -- (OFString*)getter -{ - OF_GETTER(_getter, true) -} - -- (OFString*)setter -{ - OF_GETTER(_setter, true) -} - - (OFString*)description { return [OFString stringWithFormat: @"<%@: %@\n" @"\tAttributes = 0x%03X\n" @@ -386,10 +356,12 @@ return hash; } @end @implementation OFInstanceVariable +@synthesize name = _name, offset = _offset, typeEncoding = _typeEncoding; + #if defined(OF_OBJFW_RUNTIME) - (instancetype)OF_initWithIvar: (struct objc_ivar*)ivar { self = [super init]; @@ -435,34 +407,22 @@ [_name release]; [super dealloc]; } -- (OFString*)name -{ - OF_GETTER(_name, true); -} - -- (ptrdiff_t)offset -{ - return _offset; -} - -- (const char*)typeEncoding -{ - return _typeEncoding; -} - - (OFString*)description { return [OFString stringWithFormat: @"", _name, _typeEncoding, _offset]; } @end @implementation OFIntrospection +@synthesize classMethods = _classMethods, instanceMethods = _instanceMethods; +@synthesize properties = _properties, instanceVariables = _instanceVariables; + + (instancetype)introspectionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } @@ -620,26 +580,6 @@ [_instanceMethods release]; [_instanceVariables release]; [super dealloc]; } - -- (OFArray*)classMethods -{ - OF_GETTER(_classMethods, true) -} - -- (OFArray*)instanceMethods -{ - OF_GETTER(_instanceMethods, true) -} - -- (OFArray*)properties -{ - OF_GETTER(_properties, true) -} - -- (OFArray*)instanceVariables -{ - OF_GETTER(_instanceVariables, true) -} @end Index: src/OFKernelEventObserver.h ================================================================== --- src/OFKernelEventObserver.h +++ src/OFKernelEventObserver.h @@ -126,36 +126,23 @@ #ifdef OF_HAVE_THREADS OFMutex *_mutex; #endif } -#ifdef OF_HAVE_PROPERTIES +/*! + * The delegate for the OFKernelEventObserver. + */ @property OF_NULLABLE_PROPERTY (assign) id delegate; -#endif /*! * @brief Creates a new OFKernelEventObserver. * * @return A new, autoreleased OFKernelEventObserver */ + (instancetype)observer; -/*! - * @brief Returns the delegate for the OFKernelEventObserver. - * - * @return The delegate for the OFKernelEventObserver - */ -- (nullable id )delegate; - -/*! - * @brief Sets the delegate for the OFKernelEventObserver. - * - * @param delegate The delegate for the OFKernelEventObserver - */ -- (void)setDelegate: (nullable id )delegate; - /*! * @brief Adds an object to observe for reading. * * This is also used to observe a listening socket for incoming connections, * which then triggers a read event for the observed object. Index: src/OFKernelEventObserver.m ================================================================== --- src/OFKernelEventObserver.m +++ src/OFKernelEventObserver.m @@ -62,10 +62,12 @@ QUEUE_WRITE = 2 }; #define QUEUE_ACTION (QUEUE_ADD | QUEUE_REMOVE) @implementation OFKernelEventObserver +@synthesize delegate = _delegate; + + (void)initialize { if (self != [OFKernelEventObserver class]) return; @@ -177,20 +179,10 @@ #endif [super dealloc]; } -- (id )delegate -{ - return _delegate; -} - -- (void)setDelegate: (id )delegate -{ - _delegate = delegate; -} - - (void)addObjectForReading: (id )object { #ifdef OF_HAVE_THREADS [_mutex lock]; #endif Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -58,36 +58,27 @@ of_list_object_t *_lastListObject; size_t _count; unsigned long _mutations; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The first list object of the list. + */ @property OF_NULLABLE_PROPERTY (readonly) of_list_object_t *firstListObject; + +/*! + * The last list object of the list. + */ @property OF_NULLABLE_PROPERTY (readonly) of_list_object_t *lastListObject; -#endif /*! * @brief Creates a new OFList. * * @return A new autoreleased OFList */ + (instancetype)list; -/*! - * @brief Returns the first list object of the list. - * - * @return The first list object of the list - */ -- (nullable of_list_object_t*)firstListObject; - -/*! - * @brief Returns the last list object of the list. - * - * @return The last list object of the list - */ -- (nullable of_list_object_t*)lastListObject; - /*! * @brief Appends an object to the list. * * @param object The object to append * @return An of_list_object_t, needed to identify the object inside the list. Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -26,10 +26,13 @@ #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" @implementation OFList +@synthesize firstListObject = _firstListObject; +@synthesize lastListObject = _lastListObject; + + (instancetype)list { return [[[self alloc] init] autorelease]; } @@ -73,20 +76,10 @@ [iter->object release]; [super dealloc]; } -- (of_list_object_t*)firstListObject -{ - return _firstListObject; -} - -- (of_list_object_t*)lastListObject -{ - return _lastListObject; -} - - (of_list_object_t*)appendObject: (id)object { of_list_object_t *listObject; listObject = [self allocMemoryWithSize: sizeof(of_list_object_t)]; Index: src/OFLocking.h ================================================================== --- src/OFLocking.h +++ src/OFLocking.h @@ -22,13 +22,14 @@ * @protocol OFLocking OFLocking.h ObjFW/OFLocking.h * * @brief A protocol for locks. */ @protocol OFLocking -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the lock. + */ @property OF_NULLABLE_PROPERTY (copy) OFString *name; -#endif /*! * @brief Locks the lock. */ - (void)lock; Index: src/OFMD5Hash.m ================================================================== --- src/OFMD5Hash.m +++ src/OFMD5Hash.m @@ -113,10 +113,12 @@ state[2] += new[2]; state[3] += new[3]; } @implementation OFMD5Hash +@synthesize calculated = _calculated; + + (size_t)digestSize { return 16; } @@ -199,19 +201,14 @@ _calculated = true; return (const uint8_t*)_state; } -- (bool)isCalculated -{ - return _calculated; -} - - (void)reset { [self OF_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); _bufferLength = 0; _calculated = false; } @end Index: src/OFMapTable.h ================================================================== --- src/OFMapTable.h +++ src/OFMapTable.h @@ -74,10 +74,20 @@ uint32_t _count, _capacity; uint8_t _rotate; unsigned long _mutations; } +/*! + * The key functions used by the map table. + */ +@property (readonly) of_map_table_functions_t keyFunctions; + +/*! + * The value functions used by the map table. + */ +@property (readonly) of_map_table_functions_t valueFunctions; + /*! * @brief Creates a new OFMapTable with the specified key and value functions. * * @param keyFunctions A structure of functions for handling keys * @param valueFunctions A structure of functions for handling values @@ -212,24 +222,10 @@ * * @param block The block which returns a new value for each value */ - (void)replaceValuesUsingBlock: (of_map_table_replace_block_t)block; #endif - -/*! - * @brief Returns the key functions used by the map table. - * - * @return The key functions used by the map table - */ -- (of_map_table_functions_t)keyFunctions; - -/*! - * @brief Returns the value functions used by the map table. - * - * @return The value functions used by the map table - */ -- (of_map_table_functions_t)valueFunctions; @end /*! * @class OFMapTableEnumerator OFMapTable.h ObjFW/OFMapTable.h * Index: src/OFMapTable.m ================================================================== --- src/OFMapTable.m +++ src/OFMapTable.m @@ -78,10 +78,12 @@ @interface OFMapTableValueEnumerator: OFMapTableEnumerator @end @implementation OFMapTable +@synthesize keyFunctions = _keyFunctions, valueFunctions = _valueFunctions; + + (instancetype)mapTableWithKeyFunctions: (of_map_table_functions_t)keyFunctions valueFunctions: (of_map_table_functions_t) valueFunctions { return [[[self alloc] @@ -664,20 +666,10 @@ } } } } #endif - -- (of_map_table_functions_t)keyFunctions -{ - return _keyFunctions; -} - -- (of_map_table_functions_t)valueFunctions -{ - return _valueFunctions; -} @end @implementation OFMapTableEnumerator - init { Index: src/OFMessagePackExtension.h ================================================================== --- src/OFMessagePackExtension.h +++ src/OFMessagePackExtension.h @@ -32,14 +32,19 @@ { int8_t _type; OFDataArray *_data; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The MessagePack extension type. + */ @property (readonly) int8_t type; + +/*! + * @return The data of the extension. + */ @property (readonly, retain) OFDataArray *data; -#endif /*! * @brief Creates a new OFMessagePackRepresentation with the specified type and * data. * @@ -58,22 +63,8 @@ * @param data The data for the extension * @return An initialized OFMessagePackRepresentation */ - initWithType: (int8_t)type data: (OFDataArray*)data; - -/*! - * @brief Returns the MessagePack extension type. - * - * @return The MessagePack extension type - */ -- (int8_t)type; - -/*! - * @brief Returns the data of the extension. - * - * @return The data of the extension - */ -- (OFDataArray*)data; @end OF_ASSUME_NONNULL_END Index: src/OFMessagePackExtension.m ================================================================== --- src/OFMessagePackExtension.m +++ src/OFMessagePackExtension.m @@ -21,10 +21,12 @@ #import "OFString.h" #import "OFInvalidArgumentException.h" @implementation OFMessagePackExtension +@synthesize type = _type, data = _data; + + (instancetype)extensionWithType: (int8_t)type data: (OFDataArray*)data { return [[[self alloc] initWithType: type data: data] autorelease]; @@ -59,20 +61,10 @@ [_data release]; [super dealloc]; } -- (int8_t)type -{ - return _type; -} - -- (OFDataArray*)data -{ - OF_GETTER(_data, true) -} - - (OFDataArray*)messagePackRepresentation { OFDataArray *ret; uint8_t prefix; size_t count = [_data count]; Index: src/OFMutex.m ================================================================== --- src/OFMutex.m +++ src/OFMutex.m @@ -23,10 +23,12 @@ #import "OFLockFailedException.h" #import "OFStillLockedException.h" #import "OFUnlockFailedException.h" @implementation OFMutex +@synthesize name = _name; + + (instancetype)mutex { return [[[self alloc] init] autorelease]; } @@ -42,10 +44,21 @@ _initialized = true; return self; } + +- (void)dealloc +{ + if (_initialized) + if (!of_mutex_free(&_mutex)) + @throw [OFStillLockedException exceptionWithLock: self]; + + [_name release]; + + [super dealloc]; +} - (void)lock { if (!of_mutex_lock(&_mutex)) @throw [OFLockFailedException exceptionWithLock: self]; @@ -60,35 +73,14 @@ { if (!of_mutex_unlock(&_mutex)) @throw [OFUnlockFailedException exceptionWithLock: self]; } -- (void)setName: (OFString*)name -{ - OF_SETTER(_name, name, true, 1) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - - (OFString*)description { if (_name == nil) return [super description]; return [OFString stringWithFormat: @"<%@: %@>", [self className], _name]; } - -- (void)dealloc -{ - if (_initialized) - if (!of_mutex_free(&_mutex)) - @throw [OFStillLockedException exceptionWithLock: self]; - - [_name release]; - - [super dealloc]; -} @end Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -145,13 +145,14 @@ double double_; } _value; of_number_type_t _type; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The type of the number. + */ @property (readonly) of_number_type_t type; -#endif /*! * @brief Creates a new OFNumber with the specified bool. * * @param bool_ A bool which the OFNumber should contain @@ -610,17 +611,10 @@ * @param double_ A double which the OFNumber should contain * @return An initialized OFNumber */ - initWithDouble: (double)double_; -/*! - * @brief Returns the type of the number. - * - * @return An of_number_type_t indicating the type of the number - */ -- (of_number_type_t)type; - /*! * @brief Returns the OFNumber as a bool. * * @return The OFNumber as a bool */ Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -94,10 +94,12 @@ - (OFString*)OF_JSONRepresentationWithOptions: (int)options depth: (size_t)depth; @end @implementation OFNumber +@synthesize type = _type; + + (instancetype)numberWithBool: (bool)bool_ { return [[[self alloc] initWithBool: bool_] autorelease]; } @@ -584,15 +586,10 @@ } return self; } -- (of_number_type_t)type -{ - return _type; -} - - (bool)boolValue { RETURN_AS(bool) } Index: src/OFOptionsParser.h ================================================================== --- src/OFOptionsParser.h +++ src/OFOptionsParser.h @@ -74,16 +74,42 @@ of_unichar_t _lastOption; OFString *_lastLongOption, *_argument; bool _done; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The last parsed option. + * + * If @ref nextOption returned `?` or `:`, this returns the option which was + * unknown or for which the argument was missing.@n + * If this returns `-`, the last option is only available as a long option (see + * @ref lastLongOption). + */ @property (readonly) of_unichar_t lastOption; -@property OF_NULLABLE_PROPERTY (readonly) OFString *lastLongOption; -@property OF_NULLABLE_PROPERTY (readonly) OFString *argument; -@property (readonly) OFArray OF_GENERIC(OFString*) *remainingArguments; -#endif + +/*! + * The long option for the last parsed option, or `nil` if the last parsed + * option was not passed as a long option by the user. + * + * In case @ref nextOption returned `?`, this contains the unknown long + * option.@n + * In case it returned `:`, this contains the long option which is missing an + * argument.@n + * In case it returned `=`, this contains the long option for which an + * argument was specified even though the option takes no argument. + * + * @warning Unlike @ref lastOption, which returns the short option even if the + * user specified a long option, this only returns the long option if + * it was actually specified as a long option by the user. + */ +@property OF_NULLABLE_PROPERTY (readonly, copy) OFString *lastLongOption; + +/*! + * The argument for the last parsed option, or `nil` if the last parsed option + * takes no argument. + */ +@property OF_NULLABLE_PROPERTY (readonly, copy) OFString *argument; /*! * @brief Creates a new OFOptionsParser which accepts the specified options. * * @param options An array of @ref of_options_parser_option_t specifying all @@ -124,53 +150,14 @@ * * @return The next option */ - (of_unichar_t)nextOption; -/*! - * @brief Returns the last parsed option. - * - * If @ref nextOption returned `?` or `:`, this returns the option which was - * unknown or for which the argument was missing.@n - * If this returns `-`, the last option is only available as a long option (see - * @ref lastLongOption). - * - * @return The last parsed option - */ -- (of_unichar_t)lastOption; - -/*! - * @brief Returns the long option for the last parsed option, or `nil` if the - * last parsed option was not passed as a long option by the user. - * - * In case @ref nextOption returned `?`, this contains the unknown long - * option.@n - * In case it returned `:`, this contains the long option which is missing an - * argument.@n - * In case it returned `=`, this contains the long option for which an - * argument was specified even though the option takes no argument. - * - * @warning Unlike lastOption, which returns the short option even if the user - * specified a long option, this only returns the long option if it - * was actually specified as a long option by the user. - * - * @return The last parsed long option or `nil` - */ -- (nullable OFString*)lastLongOption; - -/*! - * @brief Returns the argument for the last parsed option, or `nil` if the last - * parsed option takes no argument. - * - * @return The argument for the last parsed option - */ -- (nullable OFString*)argument; - /*! * @brief Returns the arguments following the last option. * * @return The arguments following the last option */ - (OFArray OF_GENERIC(OFString*)*)remainingArguments; @end OF_ASSUME_NONNULL_END Index: src/OFOptionsParser.m ================================================================== --- src/OFOptionsParser.m +++ src/OFOptionsParser.m @@ -34,10 +34,13 @@ { return [(OFString*)value1 isEqual: (OFString*)value2]; } @implementation OFOptionsParser +@synthesize lastOption = _lastOption, lastLongOption = _lastLongOption; +@synthesize argument = _argument; + + (instancetype)parserWithOptions: (const of_options_parser_option_t*)options { return [[[self alloc] initWithOptions: options] autorelease]; } @@ -259,26 +262,11 @@ } return '?'; } -- (of_unichar_t)lastOption -{ - return _lastOption; -} - -- (OFString*)lastLongOption -{ - OF_GETTER(_lastLongOption, true) -} - -- (OFString*)argument -{ - OF_GETTER(_argument, true) -} - - (OFArray*)remainingArguments { return [_arguments objectsInRange: of_range(_index, [_arguments count] - _index)]; } @end Index: src/OFRIPEMD160Hash.m ================================================================== --- src/OFRIPEMD160Hash.m +++ src/OFRIPEMD160Hash.m @@ -127,10 +127,12 @@ state[4] = state[0] + new[1] + new2[2]; state[0] = new2[3]; } @implementation OFRIPEMD160Hash +@synthesize calculated = _calculated; + + (size_t)digestSize { return 20; } @@ -214,19 +216,14 @@ _calculated = true; return (const uint8_t*)_state; } -- (bool)isCalculated -{ - return _calculated; -} - - (void)reset { [self OF_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); _bufferLength = 0; _calculated = false; } @end Index: src/OFRecursiveMutex.m ================================================================== --- src/OFRecursiveMutex.m +++ src/OFRecursiveMutex.m @@ -23,10 +23,12 @@ #import "OFLockFailedException.h" #import "OFStillLockedException.h" #import "OFUnlockFailedException.h" @implementation OFRecursiveMutex +@synthesize name = _name; + + (instancetype)mutex { return [[[self alloc] init] autorelease]; } @@ -42,10 +44,21 @@ _initialized = true; return self; } + +- (void)dealloc +{ + if (_initialized) + if (!of_rmutex_free(&_rmutex)) + @throw [OFStillLockedException exceptionWithLock: self]; + + [_name release]; + + [super dealloc]; +} - (void)lock { if (!of_rmutex_lock(&_rmutex)) @throw [OFLockFailedException exceptionWithLock: self]; @@ -60,35 +73,14 @@ { if (!of_rmutex_unlock(&_rmutex)) @throw [OFUnlockFailedException exceptionWithLock: self]; } -- (void)setName: (OFString*)name -{ - OF_SETTER(_name, name, true, 1) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - - (OFString*)description { if (_name == nil) return [super description]; return [OFString stringWithFormat: @"<%@: %@>", [self className], _name]; } - -- (void)dealloc -{ - if (_initialized) - if (!of_rmutex_free(&_rmutex)) - @throw [OFStillLockedException exceptionWithLock: self]; - - [_name release]; - - [super dealloc]; -} @end Index: src/OFSHA1Hash.m ================================================================== --- src/OFSHA1Hash.m +++ src/OFSHA1Hash.m @@ -87,10 +87,12 @@ state[3] += new[3]; state[4] += new[4]; } @implementation OFSHA1Hash +@synthesize calculated = _calculated; + + (size_t)digestSize { return 20; } @@ -174,19 +176,14 @@ _calculated = true; return (const uint8_t*)_state; } -- (bool)isCalculated -{ - return _calculated; -} - - (void)reset { [self OF_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); _bufferLength = 0; _calculated = false; } @end Index: src/OFSHA224Or256Hash.m ================================================================== --- src/OFSHA224Or256Hash.m +++ src/OFSHA224Or256Hash.m @@ -108,10 +108,12 @@ state[6] += new[6]; state[7] += new[7]; } @implementation OFSHA224Or256Hash +@synthesize calculated = _calculated; + + (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } @@ -186,15 +188,10 @@ _calculated = true; return (const uint8_t*)_state; } -- (bool)isCalculated -{ - return _calculated; -} - - (void)reset { [self OF_resetState]; _bits = 0; memset(&_buffer, 0, sizeof(_buffer)); Index: src/OFSHA384Or512Hash.m ================================================================== --- src/OFSHA384Or512Hash.m +++ src/OFSHA384Or512Hash.m @@ -119,10 +119,12 @@ state[6] += new[6]; state[7] += new[7]; } @implementation OFSHA384Or512Hash +@synthesize calculated = _calculated; + + (size_t)digestSize { OF_UNRECOGNIZED_SELECTOR } @@ -199,15 +201,10 @@ _calculated = true; return (const uint8_t*)_state; } -- (bool)isCalculated -{ - return _calculated; -} - - (void)reset { [self OF_resetState]; memset(&_bits, 0, sizeof(_bits)); memset(&_buffer, 0, sizeof(_buffer)); Index: src/OFSettings.h ================================================================== --- src/OFSettings.h +++ src/OFSettings.h @@ -35,13 +35,14 @@ @interface OFSettings: OFObject { OFString *_applicationName; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the application whose settings are accessed by the instance. + */ @property (readonly, copy) OFString *applicationName; -#endif /*! * @brief Create a new OFSettings instance for the application with the * specified name. * @@ -59,19 +60,10 @@ * accessed * @return An initialized OFSettings instance */ - initWithApplicationName: (OFString*)applicationName; -/*! - * @brief Returns the name of the application whose settings are accessed by - * the instance - * - * @return The name of the application whose settings are accessed by the - * instance - */ -- (OFString*)applicationName; - /*! * @brief Sets the specified path to the specified string. * * @param string The string to set * @param path The path to store the string at Index: src/OFSettings.m ================================================================== --- src/OFSettings.m +++ src/OFSettings.m @@ -19,10 +19,12 @@ #import "OFSettings.h" #import "OFSettings_INIFile.h" #import "OFString.h" @implementation OFSettings +@synthesize applicationName = _applicationName; + + alloc { if (self == [OFSettings class]) return [OFSettings_INIFile alloc]; @@ -59,15 +61,10 @@ [_applicationName release]; [super dealloc]; } -- (OFString*)applicationName -{ - OF_GETTER(_applicationName, true) -} - - (void)setString: (OFString*)string forPath: (OFString*)path { OF_UNRECOGNIZED_SELECTOR } Index: src/OFStream+Private.h ================================================================== --- src/OFStream+Private.h +++ src/OFStream+Private.h @@ -17,9 +17,9 @@ #import "OFStream.h" OF_ASSUME_NONNULL_BEGIN @interface OFStream (OF_PRIVATE_CATEGORY) -- (bool)OF_isWaitingForDelimiter; +@property (readonly) bool OF_isWaitingForDelimiter; @end OF_ASSUME_NONNULL_END Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -99,16 +99,10 @@ bool _writeBuffered, _waitingForDelimiter; @protected bool _blocking; } -#ifdef OF_HAVE_PROPERTIES -@property (getter=isWriteBuffered) bool writeBuffered; -@property (getter=isBlocking) bool blocking; -@property (readonly, getter=isAtEndOfStream) bool atEndOfStream; -#endif - /*! * @brief Returns a boolean whether the end of the stream has been reached. * * @return A boolean whether the end of the stream has been reached */ Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -48,10 +48,12 @@ #import "OFSetOptionFailedException.h" #import "of_asprintf.h" @implementation OFStream +@synthesize OF_isWaitingForDelimiter = _waitingForDelimiter; + #ifndef OF_WINDOWS + (void)initialize { if (self == [OFStream class]) signal(SIGPIPE, SIG_IGN); @@ -1573,11 +1575,6 @@ - (void)close { OF_UNRECOGNIZED_SELECTOR } - -- (bool)OF_isWaitingForDelimiter -{ - return _waitingForDelimiter; -} @end Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -88,14 +88,10 @@ * * @brief A class for handling strings. */ @interface OFString: OFObject -#ifdef OF_HAVE_PROPERTIES -@property (readonly) size_t length; -#endif - /*! * @brief Creates a new OFString. * * @return A new, autoreleased OFString */ Index: src/OFTCPSocket.h ================================================================== --- src/OFTCPSocket.h +++ src/OFTCPSocket.h @@ -69,17 +69,19 @@ uint16_t _port; bool _keepAliveEnabled, _TCPNoDelayEnabled; #endif } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, getter=isListening) bool listening; +/*! + * The host to use as a SOCKS5 proxy. + */ @property OF_NULLABLE_PROPERTY (copy) OFString *SOCKS5Host; + +/*! + * The port to use on the SOCKS5 proxy. + */ @property uint16_t SOCKS5Port; -@property (getter=isKeepAliveEnabled) bool keepAliveEnabled; -@property (getter=isTCPNoDelayEnabled) bool TCPNoDelayEnabled; -#endif /*! * @brief Sets the global SOCKS5 proxy host to use when creating a new socket * * @param SOCKS5Host The host to use as a SOCKS5 proxy when creating a new @@ -106,40 +108,10 @@ * * @return The port to use as a SOCKS5 proxy when creating a new socket */ + (uint16_t)SOCKS5Port; -/*! - * @brief Sets the host to use as a SOCKS5 proxy. - * - * @param host The host to use as a SOCKS5 proxy - */ -- (void)setSOCKS5Host: (nullable OFString*)host; - -/*! - * @brief Returns the host to use as a SOCKS5 proxy. - * - * @return The host to use as a SOCKS5 proxy - */ -- (nullable OFString*)SOCKS5Host; - -/*! - * @brief Sets the port to use on the SOCKS5 proxy. - * - * The default port is 1080. - * - * @param port The port to use on the SOCKS5 proxy - */ -- (void)setSOCKS5Port: (uint16_t)port; - -/*! - * @brief Returns the port to use on the SOCKS5 proxy. - * - * @return The port to use on the SOCKS5 proxy - */ -- (uint16_t)SOCKS5Port; - /*! * @brief Connect the OFTCPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to Index: src/OFTCPSocket.m ================================================================== --- src/OFTCPSocket.m +++ src/OFTCPSocket.m @@ -195,10 +195,12 @@ } @end #endif @implementation OFTCPSocket +@synthesize SOCKS5Host = _SOCKS5Host, SOCKS5Port = _SOCKS5Port; + + (void)setSOCKS5Host: (OFString*)host { id old = defaultSOCKS5Host; defaultSOCKS5Host = [host copy]; [old release]; @@ -232,10 +234,17 @@ @throw e; } return self; } + +- (void)dealloc +{ + [_SOCKS5Host release]; + + [super dealloc]; +} - (void)close { [super close]; @@ -245,37 +254,10 @@ _port = 0; } #endif } -- (void)dealloc -{ - [_SOCKS5Host release]; - - [super dealloc]; -} - -- (void)setSOCKS5Host: (OFString*)SOCKS5Host -{ - OF_SETTER(_SOCKS5Host, SOCKS5Host, true, 1) -} - -- (OFString*)SOCKS5Host -{ - OF_GETTER(_SOCKS5Host, true) -} - -- (void)setSOCKS5Port: (uint16_t)SOCKS5Port -{ - _SOCKS5Port = SOCKS5Port; -} - -- (uint16_t)SOCKS5Port -{ - return _SOCKS5Port; -} - - (void)connectToHost: (OFString*)host port: (uint16_t)port { OFString *destinationHost = host; uint16_t destinationPort = port; Index: src/OFTLSSocket.h ================================================================== --- src/OFTLSSocket.h +++ src/OFTLSSocket.h @@ -54,19 +54,10 @@ * * @brief A protocol that should be implemented by 3rd-party libraries * implementing TLS. */ @protocol OFTLSSocket -#ifdef OF_HAVE_PROPERTIES -@property OF_NULLABLE_PROPERTY (assign) id delegate; -@property OF_NULLABLE_PROPERTY (copy) - OFString *certificateFile, *privateKeyFile; -@property OF_NULLABLE_PROPERTY (assign) const char *privateKeyPassphrase; -@property (getter=isCertificateVerificationEnabled) - bool certificateVerificationEnabled; -#endif - /*! * @brief Initializes the TLS socket with the specified TCP socket as its * underlying socket. * * @param socket The TCP socket to use as underlying socket Index: src/OFThread.h ================================================================== --- src/OFThread.h +++ src/OFThread.h @@ -75,18 +75,16 @@ OFMutableDictionary *_threadDictionary; @private OFString *_name; } -# ifdef OF_HAVE_PROPERTIES -# ifdef OF_HAVE_BLOCKS -@property (copy) of_thread_block_t threadBlock; -# endif -@property (copy) OFString *name; -@property float priority; -@property size_t stackSize; -# endif +#ifdef OF_HAVE_BLOCKS +/*! + * The block to execute in the thread. + */ +@property (readonly, copy) of_thread_block_t threadBlock; +#endif /*! * @brief Creates a new thread. * * @return A new, autoreleased thread Index: src/OFThread.m ================================================================== --- src/OFThread.m +++ src/OFThread.m @@ -124,11 +124,11 @@ } #endif @implementation OFThread #ifdef OF_HAVE_THREADS -# if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) +# ifdef OF_HAVE_BLOCKS @synthesize threadBlock = _threadBlock; # endif + (void)initialize { @@ -378,24 +378,22 @@ return [[_runLoop retain] autorelease]; } - (OFString*)name { - OF_GETTER(_name, true) + return [[_name copy] autorelease]; } - (void)setName: (OFString*)name { - OF_SETTER(_name, name, true, 1) - - if (_running == OF_THREAD_RUNNING) { - if (_name != nil) - of_thread_set_name(_thread, [_name UTF8String]); - else - of_thread_set_name(_thread, - class_getName([self class])); - } + OFString *old = name; + _name = [name copy]; + [old release]; + + if (_running == OF_THREAD_RUNNING) + of_thread_set_name(_thread, (_name != nil + ? [_name UTF8String] : class_getName([self class]))); } - (float)priority { return _attr.priority; Index: src/OFTimer+Private.h ================================================================== --- src/OFTimer+Private.h +++ src/OFTimer+Private.h @@ -17,9 +17,10 @@ #import "OFTimer.h" OF_ASSUME_NONNULL_BEGIN @interface OFTimer (OF_PRIVATE_CATEGORY) -- (void)OF_setInRunLoop: (nullable OFRunLoop*)inRunLoop; +@property OF_NULLABLE_PROPERTY (retain, setter=OF_setInRunLoop:) + OFRunLoop *OF_inRunLoop; @end OF_ASSUME_NONNULL_END Index: src/OFTimer.h ================================================================== --- src/OFTimer.h +++ src/OFTimer.h @@ -58,13 +58,20 @@ bool _done; #endif OFRunLoop *_inRunLoop; } -#ifdef OF_HAVE_PROPERTIES -@property (retain) OFDate *fireDate; -#endif +/*! + * Whether the timer is valid. + */ +@property (readonly) bool isValid; + +/*! + * The time interval in which the timer will repeat, if it is a repeating + * timer. + */ +@property (readonly) of_time_interval_t timeInterval; /*! * @brief Creates and schedules a new timer with the specified time interval. * * @param timeInterval The time interval after which the timer should be fired @@ -300,30 +307,14 @@ /*! * @brief Invalidates the timer, preventing it from firing. */ - (void)invalidate; -/*! - * @brief Returns whether the timer is valid. - * - * @return Whether the timer is valid - */ -- (bool)isValid; - -/*! - * @brief Returns the time interval in which the timer will repeat, if it is a - * repeating timer. - * - * @return The time interval in which the timer will repeat, if it is a - * repeating timer - */ -- (of_time_interval_t)timeInterval; - #ifdef OF_HAVE_THREADS /*! * @brief Waits until the timer fired. */ - (void)waitUntilDone; #endif @end OF_ASSUME_NONNULL_END Index: src/OFTimer.m ================================================================== --- src/OFTimer.m +++ src/OFTimer.m @@ -30,10 +30,13 @@ #endif #import "OFInvalidArgumentException.h" @implementation OFTimer +@synthesize timeInterval = _interval, isValid = _valid; +@synthesize OF_inRunLoop = _inRunLoop; + + (instancetype)scheduledTimerWithTimeInterval: (of_time_interval_t)timeInterval target: (id)target selector: (SEL)selector repeats: (bool)repeats { @@ -407,34 +410,33 @@ objc_autoreleasePoolPop(pool); } - (OFDate*)fireDate { - OF_GETTER(_fireDate, true) + return [[_fireDate copy] autorelease]; } - (void)setFireDate: (OFDate*)fireDate { [self retain]; @try { @synchronized (self) { + OFDate *old; + [_inRunLoop OF_removeTimer: self]; - OF_SETTER(_fireDate, fireDate, true, 0) + old = _fireDate; + _fireDate = [fireDate copy]; + [old release]; [_inRunLoop addTimer: self]; } } @finally { [self release]; } } -- (of_time_interval_t)timeInterval -{ - return _interval; -} - - (void)invalidate { _valid = false; [_target release]; @@ -443,15 +445,10 @@ _target = nil; _object1 = nil; _object2 = nil; } -- (bool)isValid -{ - return _valid; -} - #ifdef OF_HAVE_THREADS - (void)waitUntilDone { [_condition lock]; @try { @@ -464,11 +461,6 @@ } @finally { [_condition unlock]; } } #endif - -- (void)OF_setInRunLoop: (OFRunLoop*)inRunLoop -{ - OF_SETTER(_inRunLoop, inRunLoop, true, 0) -} @end Index: src/OFURL.h ================================================================== --- src/OFURL.h +++ src/OFURL.h @@ -31,17 +31,54 @@ OFString *_scheme, *_host; uint16_t _port; OFString *_user, *_password, *_path, *_parameters, *_query, *_fragment; } -#ifdef OF_HAVE_PROPERTIES -@property (copy) OFString *scheme, *host; +/*! + * The scheme part of the URL. + */ +@property (copy) OFString *scheme; + +/*! + * The host part of the URL. + */ +@property (copy) OFString *host; + +/*! + * The port part of the URL. + */ @property uint16_t port; -@property OF_NULLABLE_PROPERTY (copy) OFString *user, *password; + +/*! + * The user part of the URL. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString *user; + +/*! + * The password part of the URL. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString *password; + +/*! + * The path part of the URL. + */ @property (copy) OFString *path; -@property OF_NULLABLE_PROPERTY (copy) OFString *parameters, *query, *fragment; -#endif + +/*! + * The parameters part of the URL. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString *parameters; + +/*! + * The query part of the URL. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString *query; + +/*! + * The fragment part of the URL. + */ +@property OF_NULLABLE_PROPERTY (copy) OFString *fragment; /*! * Creates a new URL. * * @return A new, autoreleased OFURL @@ -83,140 +120,14 @@ * @return An initialized OFURL */ - initWithString: (OFString*)string relativeToURL: (OFURL*)URL; -/*! - * @brief Returns the scheme part of the URL. - * - * @return The scheme part of the URL - */ -- (OFString*)scheme; - -/*! - * @brief Set the scheme part of the URL. - * - * @param scheme The scheme part of the URL to set - */ -- (void)setScheme: (OFString*)scheme; - -/*! - * @brief Returns the host part of the URL. - * - * @return The host part of the URL - */ -- (OFString*)host; - -/*! - * @brief Set the host part of the URL. - * - * @param host The host part of the URL to set - */ -- (void)setHost: (OFString*)host; - -/*! - * @brief Returns the port part of the URL. - * - * @return The port part of the URL - */ -- (uint16_t)port; - -/*! - * @brief Set the port part of the URL. - * - * @param port The port part of the URL to set - */ -- (void)setPort: (uint16_t)port; - -/*! - * @brief Returns the user part of the URL. - * - * @return The user part of the URL - */ -- (nullable OFString*)user; - -/*! - * @brief Set the user part of the URL. - * - * @param user The user part of the URL to set - */ -- (void)setUser: (nullable OFString*)user; - -/*! - * @brief Returns the password part of the URL. - * - * @return The password part of the URL - */ -- (nullable OFString*)password; - -/*! - * @brief Set the password part of the URL. - * - * @param password The password part of the URL to set - */ -- (void)setPassword: (nullable OFString*)password; - -/*! - * @brief Returns the path part of the URL. - * - * @return The path part of the URL - */ -- (OFString*)path; - -/*! - * @brief Set the path part of the URL. - * - * @param path The path part of the URL to set - */ -- (void)setPath: (OFString*)path; - -/*! - * @brief Returns the parameters part of the URL. - * - * @return The parameters part of the URL - */ -- (nullable OFString*)parameters; - -/*! - * @brief Set the parameters part of the URL. - * - * @param parameters The parameters part of the URL to set - */ -- (void)setParameters: (nullable OFString*)parameters; - -/*! - * @brief Returns the query part of the URL. - * - * @return The query part of the URL - */ -- (nullable OFString*)query; - -/*! - * @brief Set the query part of the URL. - * - * @param query The query part of the URL to set - */ -- (void)setQuery: (nullable OFString*)query; - -/*! - * @brief Returns the fragment part of the URL. - * - * @return The fragment part of the URL - */ -- (nullable OFString*)fragment; - -/*! - * @brief Set the fragment part of the URL. - * - * @param fragment The fragment part of the URL to set - */ -- (void)setFragment: (nullable OFString*)fragment; - /*! * @brief Returns the URL as a string. * * @return The URL as a string */ - (OFString*)string; @end OF_ASSUME_NONNULL_END Index: src/OFURL.m ================================================================== --- src/OFURL.m +++ src/OFURL.m @@ -28,10 +28,14 @@ #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFOutOfMemoryException.h" @implementation OFURL +@synthesize scheme = _scheme, host = _host, port = _port, user = _user; +@synthesize password = _password, path = _path, parameters = _parameters; +@synthesize query = _query, fragment = _fragment; + + (instancetype)URL { return [[[self alloc] init] autorelease]; } @@ -364,100 +368,10 @@ } return copy; } -- (OFString*)scheme -{ - OF_GETTER(_scheme, true) -} - -- (void)setScheme: (OFString*)scheme -{ - OF_SETTER(_scheme, scheme, true, 1) -} - -- (OFString*)host -{ - OF_GETTER(_host, true) -} - -- (void)setHost: (OFString*)host -{ - OF_SETTER(_host, host, true, 1) -} - -- (uint16_t)port -{ - return _port; -} - -- (void)setPort: (uint16_t)port -{ - _port = port; -} - -- (OFString*)user -{ - OF_GETTER(_user, true) -} - -- (void)setUser: (OFString*)user -{ - OF_SETTER(_user, user, true, 1) -} - -- (OFString*)password -{ - OF_GETTER(_password, true) -} - -- (void)setPassword: (OFString*)password -{ - OF_SETTER(_password, password, true, 1) -} - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (void)setPath: (OFString*)path -{ - OF_SETTER(_path, path, true, 1) -} - -- (OFString*)parameters -{ - OF_GETTER(_parameters, true) -} - -- (void)setParameters: (OFString*)parameters -{ - OF_SETTER(_parameters, parameters, true, 1) -} - -- (OFString*)query -{ - OF_GETTER(_query, true) -} - -- (void)setQuery: (OFString*)query -{ - OF_SETTER(_query, query, true, 1) -} - -- (OFString*)fragment -{ - OF_GETTER(_fragment, true) -} - -- (void)setFragment: (OFString*)fragment -{ - OF_SETTER(_fragment, fragment, true, 1) -} - - (OFString*)string { OFMutableString *ret = [OFMutableString string]; void *pool = objc_autoreleasePoolPush(); Index: src/OFXMLAttribute.h ================================================================== --- src/OFXMLAttribute.h +++ src/OFXMLAttribute.h @@ -29,19 +29,19 @@ { @public OFString *_name, *_namespace, *_stringValue; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the attribute. + */ @property (readonly, copy) OFString *name; -# ifdef __cplusplus -@property OF_NULLABLE_PROPERTY (readonly, copy, getter=namespace) - OFString *namespace_; -# else + +/*! + * The namespace of the attribute. + */ @property OF_NULLABLE_PROPERTY (readonly, copy) OFString *namespace; -# endif -#endif /*! * @brief Creates a new XML attribute. * * @param name The name of the attribute @@ -82,22 +82,8 @@ * @return An initialized OFXMLAttribute with the specified parameters */ - initWithName: (OFString*)name namespace: (nullable OFString*)namespace_ stringValue: (OFString*)stringValue; - -/*! - * @brief Returns the name of the attribute as an autoreleased OFString. - * - * @return The name of the attribute as an autoreleased OFString - */ -- (OFString*)name; - -/*! - * @brief Returns the namespace of the attribute as an autoreleased OFString. - * - * @return The namespace of the attribute as an autoreleased OFString - */ -- (nullable OFString*)namespace; @end OF_ASSUME_NONNULL_END Index: src/OFXMLAttribute.m ================================================================== --- src/OFXMLAttribute.m +++ src/OFXMLAttribute.m @@ -22,10 +22,12 @@ #import "OFXMLElement.h" #import "OFInvalidArgumentException.h" @implementation OFXMLAttribute +@synthesize name = _name, namespace = _namespace; + + (instancetype)attributeWithName: (OFString*)name namespace: (OFString*)namespace stringValue: (OFString*)stringValue { return [[[self alloc] initWithName: name @@ -100,20 +102,10 @@ [_stringValue release]; [super dealloc]; } -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (OFString*)namespace -{ - OF_GETTER(_namespace, true) -} - - (OFString*)stringValue { return [[_stringValue copy] autorelease]; } Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -38,23 +38,24 @@ OFMutableArray OF_GENERIC(OFXMLAttribute*) *_attributes; OFMutableDictionary OF_GENERIC(OFString*, OFString*) *_namespaces; OFMutableArray OF_GENERIC(OFXMLNode*) *_children; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the element. + */ @property (copy) OFString *name; -# ifdef __cplusplus -@property OF_NULLABLE_PROPERTY (copy, getter=namespace, setter=setNamespace:) - OFString *namespace_; -# else + +/*! + * The namespace of the element. + */ @property OF_NULLABLE_PROPERTY (copy) OFString *namespace; -# endif + +/*! + * The default namespace for the element to be used if there is no parent. + */ @property OF_NULLABLE_PROPERTY (copy) OFString *defaultNamespace; -@property OF_NULLABLE_PROPERTY (copy, readonly) - OFArray OF_GENERIC(OFXMLAttribute*) *attributes; -@property OF_NULLABLE_PROPERTY (copy) OFArray OF_GENERIC(OFXMLNode*) *children; -#endif /*! * @brief Creates a new XML element with the specified name. * * @param name The name for the element @@ -200,38 +201,10 @@ * @return An initialized OFXMLElement with the contents of the specified file */ - initWithFile: (OFString*)path; #endif -/*! - * @brief Sets the name of the element. - * - * @param name The new name - */ -- (void)setName: (OFString*)name; - -/*! - * @brief Returns the name of the element. - * - * @return The name of the element - */ -- (OFString*)name; - -/*! - * @brief Sets the namespace of the element. - * - * @param namespace_ The new namespace - */ -- (void)setNamespace: (nullable OFString*)namespace_; - -/*! - * @brief Returns the namespace of the element. - * - * @return The namespace of the element - */ -- (nullable OFString*)namespace; - /*! * @brief Sets a prefix for a namespace. * * @param prefix The prefix for the namespace * @param namespace_ The namespace for which the prefix is set @@ -246,27 +219,10 @@ * @param namespace_ The namespace for which the prefix is bound */ - (void)bindPrefix: (OFString*)prefix forNamespace: (OFString*)namespace_; -/*! - * @brief Sets the default namespace for the element to be used if there is no - * parent. - * - * @param defaultNamespace The default namespace for the element - */ -- (void)setDefaultNamespace: (nullable OFString*)defaultNamespace; - -/*! - * @brief Returns the default namespace for the element to be used if there is - * no parent. - * - * @return The default namespace for the element to be used if there is no - * parent. - */ -- (nullable OFString*)defaultNamespace; - /*! * @brief Returns an OFArray with the attributes of the element. * * @return An OFArray with the attributes of the element */ Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -68,10 +68,13 @@ [super dealloc]; } @end @implementation OFXMLElement +@synthesize name = _name, namespace = _namespace; +@synthesize defaultNamespace = _defaultNamespace; + + (void)initialize { if (self == [OFXMLElement class]) { charactersClass = [OFXMLCharacters class]; CDATAClass = [OFXMLCDATA class]; @@ -223,11 +226,11 @@ [parser setDelegate: builder]; [builder setDelegate: delegate]; [parser parseString: string]; - if (![parser finishedParsing]) + if (![parser hasFinishedParsing]) @throw [OFMalformedXMLException exceptionWithParser: parser]; self = [delegate->_element retain]; objc_autoreleasePoolPop(pool); @@ -255,11 +258,11 @@ [parser setDelegate: builder]; [builder setDelegate: delegate]; [parser parseFile: path]; - if (![parser finishedParsing]) + if (![parser hasFinishedParsing]) @throw [OFMalformedXMLException exceptionWithParser: parser]; self = [delegate->_element retain]; objc_autoreleasePoolPop(pool); @@ -367,46 +370,25 @@ [_children release]; [super dealloc]; } -- (void)setName: (OFString*)name -{ - if (name == nil) - @throw [OFInvalidArgumentException exception]; - - OF_SETTER(_name, name, true, 1) -} - -- (OFString*)name -{ - OF_GETTER(_name, true) -} - -- (void)setNamespace: (OFString*)namespace -{ - OF_SETTER(_namespace, namespace, true, 1) -} - -- (OFString*)namespace -{ - OF_GETTER(_namespace, true) -} - - (OFArray*)attributes { - OF_GETTER(_attributes, true) + return [[_attributes copy] autorelease]; } - (void)setChildren: (OFArray*)children { - OF_SETTER(_children, children, true, 2) + OFArray *old = _children; + _children = [children copy]; + [old release]; } - (OFArray*)children { - OF_GETTER(_children, true) + return [[_children copy] autorelease]; } - (void)setStringValue: (OFString*)stringValue { void *pool = objc_autoreleasePoolPush(); @@ -909,20 +891,10 @@ [self addAttributeWithName: prefix namespace: @"http://www.w3.org/2000/xmlns/" stringValue: namespace]; } -- (OFString*)defaultNamespace -{ - OF_GETTER(_defaultNamespace, true) -} - -- (void)setDefaultNamespace: (OFString*)defaultNamespace -{ - OF_SETTER(_defaultNamespace, defaultNamespace, true, 1) -} - - (void)addChild: (OFXMLNode*)child { if ([child isKindOfClass: [OFXMLAttribute class]]) @throw [OFInvalidArgumentException exception]; Index: src/OFXMLElementBuilder.h ================================================================== --- src/OFXMLElementBuilder.h +++ src/OFXMLElementBuilder.h @@ -110,36 +110,23 @@ { OFMutableArray OF_GENERIC(OFXMLElement*) *_stack; id _delegate; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The delegate for the OFXMLElementBuilder. + */ @property OF_NULLABLE_PROPERTY (assign) id delegate; -#endif /*! * @brief Creates a new element builder. * * @return A new, autoreleased OFXMLElementBuilder */ + (instancetype)elementBuilder; - -/*! - * @brief Sets the delegate for the OFXMLElementBuilder. - * - * @param delegate The delegate for the OFXMLElementBuilder - */ -- (void)setDelegate: (nullable id )delegate; - -/*! - * @brief Returns the delegate for the OFXMLElementBuilder. - * - * @return The delegate for the OFXMLElementBuilder - */ -- (nullable id )delegate; @end @interface OFObject (OFXMLElementBuilderDelegate) @end OF_ASSUME_NONNULL_END Index: src/OFXMLElementBuilder.m ================================================================== --- src/OFXMLElementBuilder.m +++ src/OFXMLElementBuilder.m @@ -27,10 +27,12 @@ #import "OFArray.h" #import "OFMalformedXMLException.h" @implementation OFXMLElementBuilder +@synthesize delegate = _delegate; + + (instancetype)elementBuilder { return [[[self alloc] init] autorelease]; } @@ -53,20 +55,10 @@ [_stack release]; [super dealloc]; } -- (id )delegate -{ - return _delegate; -} - -- (void)setDelegate: (id )delegate -{ - _delegate = delegate; -} - - (void)parser: (OFXMLParser*)parser foundProcessingInstructions: (OFString*)pi { OFXMLProcessingInstructions *node = [OFXMLProcessingInstructions processingInstructionsWithString: pi]; Index: src/OFXMLParser.h ================================================================== --- src/OFXMLParser.h +++ src/OFXMLParser.h @@ -175,54 +175,31 @@ bool _lastCarriageReturn, _finishedParsing; of_string_encoding_t _encoding; size_t _depthLimit; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The delegate that is used by the XML parser. + */ @property OF_NULLABLE_PROPERTY (assign) id delegate; + +/*! + * The depth limit for the XML parser. + * + * If the depth limit is exceeded, an OFMalformedXMLException is thrown. + * + * The default is 32. 0 means unlimited (insecure!). + */ @property size_t depthLimit; -#endif /*! * @brief Creates a new XML parser. * * @return A new, autoreleased OFXMLParser */ + (instancetype)parser; -/*! - * @brief Sets the delegate the XML parser should use. - * - * @param delegate The delegate to use - */ -- (void)setDelegate: (nullable id )delegate; - -/*! - * @brief Returns the delegate that is used by the XML parser. - * - * @return The delegate that is used by the XML parser - */ -- (nullable id )delegate; - -/*! - * @brief Returns the depth limit for the XML parser. - * - * @return The depth limit for the XML parser - */ -- (size_t)depthLimit; - -/*! - * @brief Sets the depth limit for the XML parser. - * - * If the depth limit is exceeded, an OFMalformedXMLException is thrown. - * - * The default is 32. 0 means unlimited (insecure!). - * - * @param depthLimit The depth limit for the XML parser - */ -- (void)setDepthLimit: (size_t)depthLimit; - /*! * @brief Parses the specified buffer with the specified size. * * @param buffer The buffer to parse * @param length The length of the buffer @@ -263,12 +240,12 @@ /*! * @brief Returns whether the XML parser has finished parsing. * * @return Whether the XML parser has finished parsing */ -- (bool)finishedParsing; +- (bool)hasFinishedParsing; @end @interface OFObject (OFXMLParserDelegate) @end OF_ASSUME_NONNULL_END Index: src/OFXMLParser.m ================================================================== --- src/OFXMLParser.m +++ src/OFXMLParser.m @@ -144,10 +144,12 @@ [attribute->_namespace release]; attribute->_namespace = [attributeNS retain]; } @implementation OFXMLParser +@synthesize delegate = _delegate, depthLimit = _depthLimit; + + (void)initialize { size_t i; const SEL selectors_[OF_XMLPARSER_NUM_STATES] = { @@ -234,30 +236,10 @@ [_previous release]; [super dealloc]; } -- (id )delegate -{ - return _delegate; -} - -- (void)setDelegate: (id )delegate -{ - _delegate = delegate; -} - -- (size_t)depthLimit -{ - return _depthLimit; -} - -- (void)setDepthLimit: (size_t)depthLimit -{ - _depthLimit = depthLimit; -} - - (void)parseBuffer: (const char*)buffer length: (size_t)length { _data = buffer; @@ -1041,11 +1023,11 @@ - (size_t)lineNumber { return _lineNumber; } -- (bool)finishedParsing +- (bool)hasFinishedParsing { return _finishedParsing; } - (OFString*)string: (OFString*)string Index: src/OFZIPArchive.h ================================================================== --- src/OFZIPArchive.h +++ src/OFZIPArchive.h @@ -44,14 +44,14 @@ OFMutableDictionary OF_GENERIC(OFString*, OFZIPArchiveEntry*) *_pathToEntryMap; OFStream *_lastReturnedStream; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The archive comment. + */ @property (readonly, copy) OFString *archiveComment; -@property (readonly, copy) OFArray OF_GENERIC(OFZIPArchiveEntry*) *entries; -#endif /*! * @brief Creates a new OFZIPArchive object with the specified seekable stream. * * @param stream A seekable stream from which the ZIP archive will be read @@ -95,17 +95,10 @@ * * @return The entries of the central directory of the archive as an array */ - (OFArray OF_GENERIC(OFZIPArchiveEntry*)*)entries; -/*! - * @brief Returns the archive comment. - * - * @return The archive comment - */ -- (OFString*)archiveComment; - /*! * @brief Returns a stream for reading the specified file from the archive. * * @warning Calling @ref streamForReadingFile: will invalidate all streams * previously returned by @ref streamForReadingFile:! Reading from an Index: src/OFZIPArchive.m ================================================================== --- src/OFZIPArchive.m +++ src/OFZIPArchive.m @@ -149,10 +149,12 @@ @throw e; } } @implementation OFZIPArchive +@synthesize archiveComment = _archiveComment; + + (instancetype)archiveWithSeekableStream: (OFSeekableStream*)stream { return [[[self alloc] initWithSeekableStream: stream] autorelease]; } @@ -331,16 +333,11 @@ objc_autoreleasePoolPop(pool); } - (OFArray*)entries { - OF_GETTER(_entries, true) -} - -- (OFString*)archiveComment -{ - OF_GETTER(_archiveComment, true) + return [[_entries copy] autorelease]; } - (OFStream*)streamForReadingFile: (OFString*)path { void *pool = objc_autoreleasePoolPush(); Index: src/OFZIPArchiveEntry+Private.h ================================================================== --- src/OFZIPArchiveEntry+Private.h +++ src/OFZIPArchiveEntry+Private.h @@ -17,13 +17,13 @@ #import "OFZIPArchive.h" OF_ASSUME_NONNULL_BEGIN @interface OFZIPArchiveEntry (OF_PRIVATE_CATEGORY) +@property (readonly) uint16_t OF_generalPurposeBitFlag, OF_lastModifiedFileTime; +@property (readonly) uint16_t OF_lastModifiedFileDate; +@property (readonly) uint64_t OF_localFileHeaderOffset; + - (instancetype)OF_initWithStream: (OFStream*)stream; -- (uint16_t)OF_generalPurposeBitFlag; -- (uint16_t)OF_lastModifiedFileTime; -- (uint16_t)OF_lastModifiedFileDate; -- (uint64_t)OF_localFileHeaderOffset; @end OF_ASSUME_NONNULL_END Index: src/OFZIPArchiveEntry.h ================================================================== --- src/OFZIPArchiveEntry.h +++ src/OFZIPArchiveEntry.h @@ -101,111 +101,82 @@ uint16_t _internalAttributes; uint32_t _versionSpecificAttributes; uint64_t _localFileHeaderOffset; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *fileName, *fileComment; -@property (readonly) uint16_t versionMadeBy, minVersionNeeded; -@property (readonly) uint16_t compressionMethod; -@property (readonly) uint64_t compressedSize, uncompressedSize; -@property (readonly, retain) OFDate *modificationDate; -@property (readonly) uint32_t CRC32; -@property (readonly) uint32_t versionSpecificAttributes; -@property (readonly, copy) OFDataArray *extraField; -#endif - -/*! - * @brief Returns the file name of the entry. - * - * @return The file name of the entry - */ -- (OFString*)fileName; - -/*! - * @brief Returns the comment of the entry's file. - * - * @return The comment of the entry's file - */ -- (OFString*)fileComment; - -/*! - * @brief Returns the version which made the entry. - * - * The lower 8 bits are the ZIP specification version.@n - * The upper 8 bits are the attribute compatibility. - * See @ref of_zip_archive_entry_attribute_compatibility. - * - * @return The version which made the entry - */ -- (uint16_t)versionMadeBy; - -/*! - * @brief Returns the minimum version required to extract the file. - * - * The lower 8 bits are the ZIP specification version.@n - * The upper 8 bits are the attribute compatibility. - * See @ref of_zip_archive_entry_attribute_compatibility. - * - * @return The minimum version required to extract the file - */ -- (uint16_t)minVersionNeeded; - -/*! - * @brief Returns the compression method of the entry +/*! + * The file name of the entry. + */ +@property (readonly, copy) OFString *fileName; + +/*! + * The comment of the entry's file. + */ +@property (readonly, copy) OFString *fileComment; + +/*! + * The version which made the entry. + * + * The lower 8 bits are the ZIP specification version.@n + * The upper 8 bits are the attribute compatibility. + * See @ref of_zip_archive_entry_attribute_compatibility. + */ +@property (readonly) uint16_t versionMadeBy; + +/*! + * The minimum version required to extract the file. + * + * The lower 8 bits are the ZIP specification version.@n + * The upper 8 bits are the attribute compatibility. + * See @ref of_zip_archive_entry_attribute_compatibility. + */ +@property (readonly) uint16_t minVersionNeeded; + +/*! + * The compression method of the entry. * * Supported values are: * Value | Description * --------------------------------------------------|--------------- * OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_NONE | No compression * OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE | Deflate * OF_ZIP_ARCHIVE_ENTRY_COMPRESSION_METHOD_DEFLATE64 | Deflate64 * * Other values may be returned, but the file cannot be extracted then. - * - * @return The compression method of the entry - */ -- (uint16_t)compressionMethod; - -/*! - * @brief Returns the compressed size of the entry's file. - * - * @return The compressed size of the entry's file - */ -- (uint64_t)compressedSize; - -/*! - * @brief Returns the uncompressed size of the entry's file. - * - * @return The uncompressed size of the entry's file - */ -- (uint64_t)uncompressedSize; + */ +@property (readonly) uint16_t compressionMethod; + +/*! + * The compressed size of the entry's file. + */ +@property (readonly) uint64_t compressedSize; + +/*! + * The uncompressed size of the entry's file. + */ +@property (readonly) uint64_t uncompressedSize; + +/*! + * The CRC32 checksum of the entry's file. + */ +@property (readonly) uint32_t CRC32; + +/*! + * The version specific attributes. + * + * The meaning of the version specific attributes depends on the attribute + * compatibility part of the version that made the entry. + */ +@property (readonly) uint32_t versionSpecificAttributes; /*! * @brief Returns the last modification date of the entry's file. * * @return The last modification date of the entry's file */ - (OFDate*)modificationDate; -/*! - * @brief Returns the CRC32 checksum of the entry's file. - * - * @return The CRC32 checksum of the entry's file - */ -- (uint32_t)CRC32; - -/*! - * @brief Returns the version specific attributes. - * - * The meaning of the version specific attributes depends on the attribute - * compatibility part of the version that made the entry. - * - * @return The version specific attributes - */ -- (uint32_t)versionSpecificAttributes; - /*! * @brief Returns the extra field of the entry. * * @return The extra field of the entry */ Index: src/OFZIPArchiveEntry.m ================================================================== --- src/OFZIPArchiveEntry.m +++ src/OFZIPArchiveEntry.m @@ -141,10 +141,23 @@ *data = NULL; *size = 0; } @implementation OFZIPArchiveEntry +@synthesize fileName = _fileName, fileComment = _fileComment; +@synthesize versionMadeBy = _versionMadeBy; +@synthesize minVersionNeeded = _minVersionNeeded; +@synthesize compressionMethod = _compressionMethod; +@synthesize compressedSize = _compressedSize; +@synthesize uncompressedSize = _uncompressedSize; +@synthesize CRC32 = _CRC32; +@synthesize versionSpecificAttributes = _versionSpecificAttributes; +@synthesize OF_generalPurposeBitFlag = _generalPurposeBitFlag; +@synthesize OF_lastModifiedFileTime = _lastModifiedFileTime; +@synthesize OF_lastModifiedFileDate = _lastModifiedFileDate; +@synthesize OF_localFileHeaderOffset = _localFileHeaderOffset; + - (instancetype)OF_initWithStream: (OFStream*)stream { self = [super init]; @try { @@ -223,45 +236,10 @@ [_fileComment release]; [super dealloc]; } -- (OFString*)fileName -{ - OF_GETTER(_fileName, true) -} - -- (OFString*)fileComment -{ - OF_GETTER(_fileComment, true) -} - -- (uint16_t)versionMadeBy -{ - return _versionMadeBy; -} - -- (uint16_t)minVersionNeeded -{ - return _minVersionNeeded; -} - -- (uint16_t)compressionMethod -{ - return _compressionMethod; -} - -- (uint64_t)compressedSize -{ - return _compressedSize; -} - -- (uint64_t)uncompressedSize -{ - return _uncompressedSize; -} - - (OFDate*)modificationDate { void *pool = objc_autoreleasePoolPush(); uint_fast16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980; uint_fast8_t month = (_lastModifiedFileDate & 0x1E0) >> 5; @@ -282,20 +260,10 @@ objc_autoreleasePoolPop(pool); return [date autorelease]; } -- (uint32_t)CRC32 -{ - return _CRC32; -} - -- (uint32_t)versionSpecificAttributes -{ - return _versionSpecificAttributes; -} - - (OFDataArray*)extraField { return [[_extraField copy] autorelease]; } @@ -322,26 +290,6 @@ objc_autoreleasePoolPop(pool); return [ret autorelease]; } - -- (uint16_t)OF_generalPurposeBitFlag -{ - return _generalPurposeBitFlag; -} - -- (uint16_t)OF_lastModifiedFileTime -{ - return _lastModifiedFileTime; -} - -- (uint16_t)OF_lastModifiedFileDate -{ - return _lastModifiedFileDate; -} - -- (uint64_t)OF_localFileHeaderOffset -{ - return _localFileHeaderOffset; -} @end Index: src/exceptions/OFAcceptFailedException.h ================================================================== --- src/exceptions/OFAcceptFailedException.h +++ src/exceptions/OFAcceptFailedException.h @@ -30,14 +30,19 @@ { id _socket; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The socket which could not accept a connection. + */ @property (readonly, retain) id socket; + +/*! + * @return The errno from when the exception was created. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased accept failed exception. * * @param socket The socket which could not accept a connection @@ -54,20 +59,6 @@ * @param errNo The errno for the error * @return An initialized accept failed exception */ - initWithSocket: (id)socket errNo: (int)errNo; - -/*! - * @brief Returns the socket which could not accept a connection. - * - * @return The socket which could not accept a connection - */ -- (id)socket; - -/*! - * @brief Returns the errno from when the exception was created. - * - * @return The errno from when the exception was created - */ -- (int)errNo; @end Index: src/exceptions/OFAcceptFailedException.m ================================================================== --- src/exceptions/OFAcceptFailedException.m +++ src/exceptions/OFAcceptFailedException.m @@ -18,10 +18,12 @@ #import "OFAcceptFailedException.h" #import "OFString.h" @implementation OFAcceptFailedException +@synthesize socket = _socket, errNo = _errNo; + + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo { return [[[self alloc] initWithSocket: socket errNo: errNo] autorelease]; @@ -54,16 +56,6 @@ { return [OFString stringWithFormat: @"Failed to accept connection in socket of class %@: %@", [_socket class], of_strerror(_errNo)]; } - -- (id)socket -{ - OF_GETTER(_socket, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFAddressTranslationFailedException.h ================================================================== --- src/exceptions/OFAddressTranslationFailedException.h +++ src/exceptions/OFAddressTranslationFailedException.h @@ -31,13 +31,14 @@ { OFString *_host; int _error; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The host for which the address translation was requested. + */ @property (readonly, copy) OFString *host; -#endif /*! * @brief Creates a new, autoreleased address translation failed exception. * * @param host The host for which translation was requested @@ -55,16 +56,9 @@ * @param host The host for which translation was requested * @return An initialized address translation failed exception */ - initWithHost: (OFString*)host; -- initWithHost: (OFString*)host - error: (int)error; -- initWithError: (int)error; - -/*! - * @brief Returns the host for which the address translation was requested. - * - * @return The host for which the address translation was requested - */ -- (OFString*)host; +- (instancetype)initWithHost: (OFString*)host + error: (int)error; +- (instancetype)initWithError: (int)error; @end Index: src/exceptions/OFAddressTranslationFailedException.m ================================================================== --- src/exceptions/OFAddressTranslationFailedException.m +++ src/exceptions/OFAddressTranslationFailedException.m @@ -30,10 +30,12 @@ static of_mutex_t mutex; #endif @implementation OFAddressTranslationFailedException +@synthesize host = _host; + #if !defined(HAVE_THREADSAFE_GETADDRINFO) && defined(OF_HAVE_THREADS) + (void)initialize { if (self != [OFAddressTranslationFailedException class]) return; @@ -72,12 +74,12 @@ } return self; } -- initWithHost: (OFString*)host - error: (int)error +- (instancetype)initWithHost: (OFString*)host + error: (int)error { self = [super init]; @try { _host = [host copy]; @@ -88,11 +90,11 @@ } return self; } -- initWithError: (int)error +- (instancetype)initWithError: (int)error { self = [super init]; _error = error; @@ -167,11 +169,6 @@ } # endif # endif #endif } - -- (OFString*)host -{ - OF_GETTER(_host, true) -} @end Index: src/exceptions/OFAlreadyConnectedException.h ================================================================== --- src/exceptions/OFAlreadyConnectedException.h +++ src/exceptions/OFAlreadyConnectedException.h @@ -30,13 +30,14 @@ @interface OFAlreadyConnectedException: OFException { id _socket; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The socket which is already connected. + */ @property (readonly, retain) id socket; -#endif /*! * @brief Creates a new, autoreleased already connected exception. * * @param socket The socket which is already connected @@ -49,13 +50,6 @@ * * @param socket The socket which is already connected * @return An initialized already connected exception */ - initWithSocket: (id)socket; - -/*! - * @brief Returns the socket which is already connected. - * - * @return The socket which is already connected - */ -- (id)socket; @end Index: src/exceptions/OFAlreadyConnectedException.m ================================================================== --- src/exceptions/OFAlreadyConnectedException.m +++ src/exceptions/OFAlreadyConnectedException.m @@ -18,10 +18,12 @@ #import "OFAlreadyConnectedException.h" #import "OFString.h" @implementation OFAlreadyConnectedException +@synthesize socket = _socket; + + (instancetype)exceptionWithSocket: (id)socket { return [[[self alloc] initWithSocket: socket] autorelease]; } @@ -49,11 +51,6 @@ @"thus can't be connected or bound again!", [_socket class]]; else return @"A connection has already been established!"; } - -- (id)socket -{ - OF_GETTER(_socket, true) -} @end Index: src/exceptions/OFBindFailedException.h ================================================================== --- src/exceptions/OFBindFailedException.h +++ src/exceptions/OFBindFailedException.h @@ -32,16 +32,29 @@ OFString *_host; uint16_t _port; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The host on which binding failed. + */ @property (readonly, copy) OFString *host; + +/*! + * The port on which binding failed. + */ @property (readonly) uint16_t port; + +/*! + * The socket which could not be bound. + */ @property (readonly, retain) id socket; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased bind failed exception. * * @param host The host on which binding failed @@ -66,34 +79,6 @@ */ - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; - -/*! - * @brief Returns the host on which binding failed. - * - * @return The host on which binding failed - */ -- (OFString*)host; - -/*! - * @brief Return the port on which binding failed. - * - * @return The port on which binding failed - */ -- (uint16_t)port; - -/*! - * @brief Returns the socket which could not be bound. - * - * @return The socket which could not be bound - */ -- (id)socket; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFBindFailedException.m ================================================================== --- src/exceptions/OFBindFailedException.m +++ src/exceptions/OFBindFailedException.m @@ -18,10 +18,12 @@ #import "OFBindFailedException.h" #import "OFString.h" @implementation OFBindFailedException +@synthesize host = _host, port = _port, socket = _socket, errNo = _errNo; + + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo { @@ -69,26 +71,6 @@ return [OFString stringWithFormat: @"Binding to port %" @PRIu16 @" on host %@ failed in socket of " @"type %@: %@", _port, _host, [_socket class], of_strerror(_errNo)]; } - -- (OFString*)host -{ - OF_GETTER(_host, true) -} - -- (uint16_t)port -{ - return _port; -} - -- (id)socket -{ - OF_GETTER(_socket, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.h ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.h +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.h @@ -28,14 +28,19 @@ { OFString *_path; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The path of the directory to which the current path could not be changed. + */ @property (readonly, copy) OFString *path; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased change current directory path failed * exception. * @@ -55,22 +60,6 @@ * @param errNo The errno of the error that occurred * @return An initialized change current directory path failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; - -/*! - * @brief Returns the path of the directory to which the current path could not - * be changed. - * - * @return The path of the directory to which the current path could not be - * changed - */ -- (OFString*)path; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFChangeCurrentDirectoryPathFailedException.m ================================================================== --- src/exceptions/OFChangeCurrentDirectoryPathFailedException.m +++ src/exceptions/OFChangeCurrentDirectoryPathFailedException.m @@ -18,10 +18,12 @@ #import "OFChangeCurrentDirectoryPathFailedException.h" #import "OFString.h" @implementation OFChangeCurrentDirectoryPathFailedException +@synthesize path = _path, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path errNo: (int)errNo { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; @@ -59,16 +61,6 @@ { return [OFString stringWithFormat: @"Failed to change the current directory path to %@: %@", _path, of_strerror(_errNo)]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFChangeOwnerFailedException.h ================================================================== --- src/exceptions/OFChangeOwnerFailedException.h +++ src/exceptions/OFChangeOwnerFailedException.h @@ -27,14 +27,29 @@ { OFString *_path, *_owner, *_group; int _errNo; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *path, *owner, *group; +/*! + * The path of the item. + */ +@property (readonly, copy) OFString *path; + +/*! + * The new owner for the item. + */ +@property (readonly, copy) OFString *owner; + +/*! + * The new group for the item. + */ +@property (readonly, copy) OFString *group; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased change owner failed exception. * * @param path The path of the item @@ -59,35 +74,7 @@ */ - initWithPath: (OFString*)path owner: (OFString*)owner group: (OFString*)group errNo: (int)errNo; - -/*! - * @brief Returns the path of the item. - * - * @return The path of the item - */ -- (OFString*)path; - -/*! - * @brief Returns the new owner for the item. - * - * @return The new owner for the item - */ -- (OFString*)owner; - -/*! - * @brief Returns the new group for the item. - * - * @return The new group for the item - */ -- (OFString*)group; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end #endif Index: src/exceptions/OFChangeOwnerFailedException.m ================================================================== --- src/exceptions/OFChangeOwnerFailedException.m +++ src/exceptions/OFChangeOwnerFailedException.m @@ -19,10 +19,12 @@ #import "OFChangeOwnerFailedException.h" #import "OFString.h" #ifdef OF_HAVE_CHOWN @implementation OFChangeOwnerFailedException +@synthesize path = _path, owner = _owner, group = _group, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path owner: (OFString*)owner group: (OFString*)group errNo: (int)errNo { @@ -79,27 +81,7 @@ else return [OFString stringWithFormat: @"Failed to change owner of item at path %@ to %@:%@: %@", _path, _owner, _group, of_strerror(_errNo)]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (OFString*)owner -{ - OF_GETTER(_owner, true) -} - -- (OFString*)group -{ - OF_GETTER(_group, true) -} - -- (int)errNo -{ - return _errNo; -} @end #endif Index: src/exceptions/OFChangePermissionsFailedException.h ================================================================== --- src/exceptions/OFChangePermissionsFailedException.h +++ src/exceptions/OFChangePermissionsFailedException.h @@ -31,15 +31,24 @@ OFString *_path; mode_t _permissions; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The path of the item. + */ @property (readonly, copy) OFString *path; + +/*! + * The new permissions for the item. + */ @property (readonly) mode_t permissions; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased change permissions failed exception. * * @param path The path of the item @@ -60,27 +69,6 @@ * @return An initialized change permissions failed exception */ - initWithPath: (OFString*)path permissions: (mode_t)permissions errNo: (int)errNo; - -/*! - * @brief Returns the path of the item. - * - * @return The path of the item - */ -- (OFString*)path; - -/*! - * @brief Returns the new permissions for the item. - * - * @return The new permissions for the item - */ -- (mode_t)permissions; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFChangePermissionsFailedException.m ================================================================== --- src/exceptions/OFChangePermissionsFailedException.m +++ src/exceptions/OFChangePermissionsFailedException.m @@ -18,10 +18,12 @@ #import "OFChangePermissionsFailedException.h" #import "OFString.h" @implementation OFChangePermissionsFailedException +@synthesize path = _path, permissions = _permissions, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path permissions: (mode_t)permissions errNo: (int)errNo { return [[[self alloc] initWithPath: path @@ -63,21 +65,6 @@ { return [OFString stringWithFormat: @"Failed to change permissions of item at path %@ to %d: %@", _path, _permissions, of_strerror(_errNo)]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (mode_t)permissions -{ - return _permissions; -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFConditionBroadcastFailedException.h ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.h +++ src/exceptions/OFConditionBroadcastFailedException.h @@ -32,13 +32,14 @@ @interface OFConditionBroadcastFailedException: OFException { OFCondition *_condition; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The condition which could not be broadcasted. + */ @property (readonly, retain) OFCondition *condition; -#endif /*! * @brief Returns a new, autoreleased condition broadcast failed exception. * * @param condition The condition which could not be broadcasted @@ -51,13 +52,6 @@ * * @param condition The condition which could not be broadcasted * @return An initialized condition broadcast failed exception */ - initWithCondition: (OFCondition*)condition; - -/*! - * @brief Returns the condition which could not be broadcasted. - * - * @return The condition which could not be broadcasted - */ -- (OFCondition*)condition; @end Index: src/exceptions/OFConditionBroadcastFailedException.m ================================================================== --- src/exceptions/OFConditionBroadcastFailedException.m +++ src/exceptions/OFConditionBroadcastFailedException.m @@ -19,10 +19,12 @@ #import "OFConditionBroadcastFailedException.h" #import "OFString.h" #import "OFCondition.h" @implementation OFConditionBroadcastFailedException +@synthesize condition = _condition; + + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } @@ -50,11 +52,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Broadcasting a condition of type %@ failed!", [_condition class]]; } - -- (OFCondition*)condition -{ - OF_GETTER(_condition, true) -} @end Index: src/exceptions/OFConditionSignalFailedException.h ================================================================== --- src/exceptions/OFConditionSignalFailedException.h +++ src/exceptions/OFConditionSignalFailedException.h @@ -32,13 +32,14 @@ @interface OFConditionSignalFailedException: OFException { OFCondition *_condition; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The condition which could not be signaled. + */ @property (readonly, retain) OFCondition *condition; -#endif /*! * @brief Creates a new, autoreleased condition signal failed exception. * * @param condition The condition which could not be signaled @@ -51,13 +52,6 @@ * * @param condition The condition which could not be signaled * @return An initialized condition signal failed exception */ - initWithCondition: (OFCondition*)condition; - -/*! - * @brief Return the condition which could not be signaled. - * - * @return The condition which could not be signaled - */ -- (OFCondition*)condition; @end Index: src/exceptions/OFConditionSignalFailedException.m ================================================================== --- src/exceptions/OFConditionSignalFailedException.m +++ src/exceptions/OFConditionSignalFailedException.m @@ -19,10 +19,12 @@ #import "OFConditionSignalFailedException.h" #import "OFString.h" #import "OFCondition.h" @implementation OFConditionSignalFailedException +@synthesize condition = _condition; + + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } @@ -50,11 +52,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Signaling a condition of type %@ failed!", [_condition class]]; } - -- (OFCondition*)condition -{ - OF_GETTER(_condition, true) -} @end Index: src/exceptions/OFConditionStillWaitingException.h ================================================================== --- src/exceptions/OFConditionStillWaitingException.h +++ src/exceptions/OFConditionStillWaitingException.h @@ -33,13 +33,14 @@ @interface OFConditionStillWaitingException: OFException { OFCondition *_condition; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The condition for which is still being waited. + */ @property (readonly, retain) OFCondition *condition; -#endif /*! * @brief Creates a new, autoreleased condition still waiting exception. * * @param condition The condition for which is still being waited @@ -52,13 +53,6 @@ * * @param condition The condition for which is still being waited * @return An initialized condition still waiting exception */ - initWithCondition: (OFCondition*)condition; - -/*! - * @brief Return the condition for which is still being waited. - * - * @return The condition for which is still being waited - */ -- (OFCondition*)condition; @end Index: src/exceptions/OFConditionStillWaitingException.m ================================================================== --- src/exceptions/OFConditionStillWaitingException.m +++ src/exceptions/OFConditionStillWaitingException.m @@ -19,10 +19,12 @@ #import "OFConditionStillWaitingException.h" #import "OFString.h" #import "OFCondition.h" @implementation OFConditionStillWaitingException +@synthesize condition = _condition; + + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } @@ -51,11 +53,6 @@ { return [OFString stringWithFormat: @"Deallocation of a condition of type %@ was tried, even though a " @"thread was still waiting for it!", [_condition class]]; } - -- (OFCondition*)condition -{ - OF_GETTER(_condition, true) -} @end Index: src/exceptions/OFConditionWaitFailedException.h ================================================================== --- src/exceptions/OFConditionWaitFailedException.h +++ src/exceptions/OFConditionWaitFailedException.h @@ -32,13 +32,14 @@ @interface OFConditionWaitFailedException: OFException { OFCondition *_condition; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The condition for which could not be waited. + */ @property (readonly, retain) OFCondition *condition; -#endif /*! * @brief Creates a new, autoreleased condition wait failed exception. * * @param condition The condition for which could not be waited @@ -51,13 +52,6 @@ * * @param condition The condition for which could not be waited * @return An initialized condition wait failed exception */ - initWithCondition: (OFCondition*)condition; - -/*! - * @brief Return the condition for which could not be waited. - * - * @return The condition for which could not be waited - */ -- (OFCondition*)condition; @end Index: src/exceptions/OFConditionWaitFailedException.m ================================================================== --- src/exceptions/OFConditionWaitFailedException.m +++ src/exceptions/OFConditionWaitFailedException.m @@ -19,10 +19,12 @@ #import "OFConditionWaitFailedException.h" #import "OFString.h" #import "OFCondition.h" @implementation OFConditionWaitFailedException +@synthesize condition = _condition; + + (instancetype)exceptionWithCondition: (OFCondition*)condition { return [[[self alloc] initWithCondition: condition] autorelease]; } @@ -50,11 +52,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Waiting for a condition of type %@ failed!", [_condition class]]; } - -- (OFCondition*)condition -{ - OF_GETTER(_condition, true) -} @end Index: src/exceptions/OFConnectionFailedException.h ================================================================== --- src/exceptions/OFConnectionFailedException.h +++ src/exceptions/OFConnectionFailedException.h @@ -32,16 +32,29 @@ OFString *_host; uint16_t _port; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The socket which could not connect. + */ @property (readonly, retain) id socket; + +/*! + * The host to which the connection failed. + */ @property (readonly, copy) OFString *host; + +/*! + * The port on the host to which the connection failed. + */ @property (readonly) uint16_t port; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased connection failed exception. * * @param host The host to which the connection failed @@ -90,34 +103,6 @@ */ - initWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; - -/*! - * @brief Returns the socket which could not connect. - * - * @return The socket which could not connect - */ -- (id)socket; - -/*! - * @brief Returns the host to which the connection failed. - * - * @return The host to which the connection failed - */ -- (OFString*)host; - -/*! - * @brief Returns the port on the host to which the connection failed. - * - * @return The port on the host to which the connection failed - */ -- (uint16_t)port; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFConnectionFailedException.m ================================================================== --- src/exceptions/OFConnectionFailedException.m +++ src/exceptions/OFConnectionFailedException.m @@ -18,10 +18,12 @@ #import "OFConnectionFailedException.h" #import "OFString.h" @implementation OFConnectionFailedException +@synthesize host = _host, port = _port, socket = _socket, errNo = _errNo; + + (instancetype)exceptionWithHost: (OFString*)host port: (uint16_t)port socket: (id)socket { return [[[self alloc] initWithHost: host @@ -102,26 +104,6 @@ return [OFString stringWithFormat: @"A connection to %@ on port %" @PRIu16 @" could not be " @"established in socket of type %@!", _host, _port, [_socket class]]; } - -- (OFString*)host -{ - OF_GETTER(_host, true) -} - -- (uint16_t)port -{ - return _port; -} - -- (id)socket -{ - OF_GETTER(_socket, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFCopyItemFailedException.h ================================================================== --- src/exceptions/OFCopyItemFailedException.h +++ src/exceptions/OFCopyItemFailedException.h @@ -26,15 +26,24 @@ { OFString *_sourcePath, *_destinationPath; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The path of the source item. + */ @property (readonly, copy) OFString *sourcePath; + +/*! + * The destination path. + */ @property (readonly, copy) OFString *destinationPath; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased copy item failed exception. * * @param sourcePath The original path @@ -55,27 +64,6 @@ * @return An initialized copy item failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; - -/*! - * @brief Returns the path of the source item. - * - * @return The path of the source item - */ -- (OFString*)sourcePath; - -/*! - * @brief Returns the destination path. - * - * @return The destination path - */ -- (OFString*)destinationPath; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFCopyItemFailedException.m ================================================================== --- src/exceptions/OFCopyItemFailedException.m +++ src/exceptions/OFCopyItemFailedException.m @@ -18,10 +18,13 @@ #import "OFCopyItemFailedException.h" #import "OFString.h" @implementation OFCopyItemFailedException +@synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath @@ -63,21 +66,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Failed to copy item %@ to %@: %@", _sourcePath, _destinationPath, of_strerror(_errNo)]; } - -- (OFString*)sourcePath -{ - OF_GETTER(_sourcePath, true) -} - -- (OFString*)destinationPath -{ - OF_GETTER(_destinationPath, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFCreateDirectoryFailedException.h ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.h +++ src/exceptions/OFCreateDirectoryFailedException.h @@ -27,14 +27,19 @@ { OFString *_path; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The path of the directory which couldn't be created. + */ @property (readonly, copy) OFString *path; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased create directory failed exception. * * @param path A string with the path of the directory which could not be @@ -53,21 +58,6 @@ * @param errNo The errno of the error that occurred * @return An initialized create directory failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; - -/*! - * @brief Returns a string with the path of the directory which couldn't be - * created. - * - * @return A string with the path of the directory which couldn't be created - */ -- (OFString*)path; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFCreateDirectoryFailedException.m ================================================================== --- src/exceptions/OFCreateDirectoryFailedException.m +++ src/exceptions/OFCreateDirectoryFailedException.m @@ -18,10 +18,12 @@ #import "OFCreateDirectoryFailedException.h" #import "OFString.h" @implementation OFCreateDirectoryFailedException +@synthesize path = _path, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path errNo: (int)errNo { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; @@ -59,16 +61,6 @@ { return [OFString stringWithFormat: @"Failed to create directory %@: %@", _path, of_strerror(_errNo)]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFCreateSymbolicLinkFailedException.h ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.h +++ src/exceptions/OFCreateSymbolicLinkFailedException.h @@ -28,14 +28,24 @@ { OFString *_sourcePath, *_destinationPath; int _errNo; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *sourcePath, *destinationPath; +/*! + * The source for the symlink. + */ +@property (readonly, copy) OFString *sourcePath; + +/*! + * The destination for the symlink. + */ +@property (readonly, copy) OFString *destinationPath; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased create symbolic link failed exception. * * @param sourcePath The source for the symbolic link @@ -57,28 +67,7 @@ * @return An initialized create symbolic link failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; - -/*! - * @brief Returns a string with the source for the symlink. - * - * @return A string with the source for the symlink - */ -- (OFString*)sourcePath; - -/*! - * @brief Returns a string with the destination for the symlink. - * - * @return A string with the destination for the symlink - */ -- (OFString*)destinationPath; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end #endif Index: src/exceptions/OFCreateSymbolicLinkFailedException.m ================================================================== --- src/exceptions/OFCreateSymbolicLinkFailedException.m +++ src/exceptions/OFCreateSymbolicLinkFailedException.m @@ -19,10 +19,13 @@ #import "OFCreateSymbolicLinkFailedException.h" #import "OFString.h" #ifdef OF_HAVE_SYMLINK @implementation OFCreateSymbolicLinkFailedException +@synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath @@ -65,22 +68,7 @@ { return [OFString stringWithFormat: @"Failed to symlink file %@ to %@: %@", _sourcePath, _destinationPath, of_strerror(_errNo)]; } - -- (OFString*)sourcePath -{ - OF_GETTER(_sourcePath, true) -} - -- (OFString*)destinationPath -{ - OF_GETTER(_destinationPath, true) -} - -- (int)errNo -{ - return _errNo; -} @end #endif Index: src/exceptions/OFEnumerationMutationException.h ================================================================== --- src/exceptions/OFEnumerationMutationException.h +++ src/exceptions/OFEnumerationMutationException.h @@ -27,13 +27,14 @@ @interface OFEnumerationMutationException: OFException { id _object; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The object which was mutated during enumeration. + */ @property (readonly, retain) id object; -#endif /*! * @brief Creates a new, autoreleased enumeration mutation exception. * * @param object The object which was mutated during enumeration @@ -46,13 +47,6 @@ * * @param object The object which was mutated during enumeration * @return An initialized enumeration mutation exception */ - initWithObject: (id)object; - -/*! - * @brief Returns the object which was mutated during enumeration. - * - * @return The object which was mutated during enumeration - */ -- (id)object; @end Index: src/exceptions/OFEnumerationMutationException.m ================================================================== --- src/exceptions/OFEnumerationMutationException.m +++ src/exceptions/OFEnumerationMutationException.m @@ -18,10 +18,12 @@ #import "OFEnumerationMutationException.h" #import "OFString.h" @implementation OFEnumerationMutationException +@synthesize object = _object; + + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } @@ -50,11 +52,6 @@ { return [OFString stringWithFormat: @"Object of class %@ was mutated during enumeration!", [_object class]]; } - -- (id)object -{ - OF_GETTER(_object, true) -} @end Index: src/exceptions/OFGetOptionFailedException.h ================================================================== --- src/exceptions/OFGetOptionFailedException.h +++ src/exceptions/OFGetOptionFailedException.h @@ -28,14 +28,19 @@ { OFStream *_stream; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The stream for which the option could not be retrieved. + */ @property (readonly, retain) OFStream *stream; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased get option failed exception. * * @param stream The stream for which the option could not be gotten @@ -52,20 +57,6 @@ * @param errNo The errno of the error that occurred * @return An initialized get option failed exception */ - initWithStream: (OFStream*)stream errNo: (int)errNo; - -/*! - * @brief Returns the stream for which the option could not be gotten. - * - * @return The stream for which the option could not be gotten - */ -- (OFStream*)stream; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFGetOptionFailedException.m ================================================================== --- src/exceptions/OFGetOptionFailedException.m +++ src/exceptions/OFGetOptionFailedException.m @@ -19,10 +19,12 @@ #import "OFGetOptionFailedException.h" #import "OFString.h" #import "OFStream.h" @implementation OFGetOptionFailedException +@synthesize stream = _stream, errNo = _errNo; + + (instancetype)exceptionWithStream: (OFStream*)stream errNo: (int)errNo { return [[[self alloc] initWithStream: stream errNo: errNo] autorelease]; @@ -55,16 +57,6 @@ { return [OFString stringWithFormat: @"Getting an option in a stream of type %@ failed: %@", [_stream class], of_strerror(_errNo)]; } - -- (OFStream*)stream -{ - OF_GETTER(_stream, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFHTTPRequestFailedException.h ================================================================== --- src/exceptions/OFHTTPRequestFailedException.h +++ src/exceptions/OFHTTPRequestFailedException.h @@ -34,14 +34,19 @@ { OFHTTPRequest *_request; OFHTTPResponse *_response; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The HTTP request which failed. + */ @property (readonly, retain) OFHTTPRequest *request; + +/*! + * The response for the failed HTTP request. + */ @property (readonly, retain) OFHTTPResponse *response; -#endif /*! * @brief Creates a new, autoreleased HTTP request failed exception. * * @param request The HTTP request which failed @@ -58,20 +63,6 @@ * @param response The response for the failed HTTP request * @return A new HTTP request failed exception */ - initWithRequest: (OFHTTPRequest*)request response: (OFHTTPResponse*)response; - -/*! - * @brief Returns the HTTP request which failed. - * - * @return The HTTP request which failed - */ -- (OFHTTPRequest*)request; - -/*! - * @brief Returns the response for the failed HTTP request. - * - * @return The response for the failed HTTP request - */ -- (OFHTTPResponse*)response; @end Index: src/exceptions/OFHTTPRequestFailedException.m ================================================================== --- src/exceptions/OFHTTPRequestFailedException.m +++ src/exceptions/OFHTTPRequestFailedException.m @@ -20,10 +20,12 @@ #import "OFString.h" #import "OFHTTPRequest.h" #import "OFHTTPResponse.h" @implementation OFHTTPRequestFailedException +@synthesize request = _request, response = _response; + + (instancetype)exceptionWithRequest: (OFHTTPRequest*)request response: (OFHTTPResponse*)response { return [[[self alloc] initWithRequest: request response: response] autorelease]; @@ -60,16 +62,6 @@ return [OFString stringWithFormat: @"An HTTP %s request with URL %@ failed with code %d!", method, [_request URL], [_response statusCode]]; } - -- (OFHTTPRequest*)request -{ - OF_GETTER(_request, true) -} - -- (OFHTTPResponse*)response -{ - OF_GETTER(_response, true) -} @end Index: src/exceptions/OFHashAlreadyCalculatedException.h ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.h +++ src/exceptions/OFHashAlreadyCalculatedException.h @@ -27,13 +27,14 @@ @interface OFHashAlreadyCalculatedException: OFException { id _hashObject; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The hash which has already been calculated. + */ @property (readonly, retain) id hashObject; -#endif /*! * @brief Creates a new, autoreleased hash already calculated exception. * * @param hash The hash which has already been calculated @@ -46,13 +47,6 @@ * * @param hash The hash which has already been calculated * @return An initialized hash already calculated exception */ - initWithHash: (id )hash; - -/*! - * @brief Returns the hash which has already been calculated. - * - * @return The hash which has already been calculated - */ -- (id )hashObject; @end Index: src/exceptions/OFHashAlreadyCalculatedException.m ================================================================== --- src/exceptions/OFHashAlreadyCalculatedException.m +++ src/exceptions/OFHashAlreadyCalculatedException.m @@ -18,10 +18,12 @@ #import "OFHashAlreadyCalculatedException.h" #import "OFString.h" @implementation OFHashAlreadyCalculatedException +@synthesize hashObject = _hashObject; + + (instancetype)exceptionWithHash: (id )hash { return [[[self alloc] initWithHash: hash] autorelease]; } @@ -50,11 +52,6 @@ { return [OFString stringWithFormat: @"The hash of type %@ has already been calculated and thus no new " @"data can be added!", [_hashObject class]]; } - -- (id )hashObject -{ - OF_GETTER(_hashObject, true) -} @end Index: src/exceptions/OFInitializationFailedException.h ================================================================== --- src/exceptions/OFInitializationFailedException.h +++ src/exceptions/OFInitializationFailedException.h @@ -26,13 +26,14 @@ @interface OFInitializationFailedException: OFException { Class _inClass; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly) Class inClass; -#endif +/*! + * The class for which initialization failed. + */ +@property (readonly, assign) Class inClass; /*! * @brief Creates a new, autoreleased initialization failed exception. * * @param class_ The class for which initialization failed @@ -45,13 +46,6 @@ * * @param class_ The class for which initialization failed * @return An initialized initialization failed exception */ - initWithClass: (Class)class_; - -/*! - * @brief Returns the class for which initialization failed. - * - * @return The class for which initialization failed - */ -- (Class)inClass; @end Index: src/exceptions/OFInitializationFailedException.m ================================================================== --- src/exceptions/OFInitializationFailedException.m +++ src/exceptions/OFInitializationFailedException.m @@ -18,10 +18,12 @@ #import "OFInitializationFailedException.h" #import "OFString.h" @implementation OFInitializationFailedException +@synthesize inClass = _inClass; + + (instancetype)exceptionWithClass: (Class)class { return [[[self alloc] initWithClass: class] autorelease]; } @@ -42,11 +44,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Initialization failed for or in class %@!", _inClass]; } - -- (Class)inClass -{ - return _inClass; -} @end Index: src/exceptions/OFInvalidJSONException.h ================================================================== --- src/exceptions/OFInvalidJSONException.h +++ src/exceptions/OFInvalidJSONException.h @@ -26,14 +26,19 @@ { OFString *_string; size_t _line; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The string containing the invalid JSON representation. + */ @property (readonly, copy) OFString *string; + +/*! + * The line in which parsing the JSON representation failed. + */ @property (readonly) size_t line; -#endif /*! * @brief Creates a new, autoreleased invalid JSON exception. * * @param string The string containing the invalid JSON representation @@ -50,20 +55,6 @@ * @param line The line in which the parsing error encountered * @return An initialized invalid JSON exception */ - initWithString: (OFString*)string line: (size_t)line; - -/*! - * @brief Returns the string containing the invalid JSON representation. - * - * @return The string containing the invalid JSON representation - */ -- (OFString*)string; - -/*! - * @brief Returns the line in which parsing the JSON representation failed. - * - * @return The line in which parsing the JSON representation failed - */ -- (size_t)line; @end Index: src/exceptions/OFInvalidJSONException.m ================================================================== --- src/exceptions/OFInvalidJSONException.m +++ src/exceptions/OFInvalidJSONException.m @@ -18,10 +18,12 @@ #import "OFInvalidJSONException.h" #import "OFString.h" @implementation OFInvalidJSONException +@synthesize string = _string, line = _line; + + (instancetype)exceptionWithString: (OFString*)string line: (size_t)line { return [[[self alloc] initWithString: string line: line] autorelease]; @@ -58,16 +60,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"The JSON representation is invalid in line %zu!", _line]; } - -- (OFString*)string -{ - OF_GETTER(_string, true) -} - -- (size_t)line -{ - return _line; -} @end Index: src/exceptions/OFLinkFailedException.h ================================================================== --- src/exceptions/OFLinkFailedException.h +++ src/exceptions/OFLinkFailedException.h @@ -27,14 +27,24 @@ { OFString *_sourcePath, *_destinationPath; int _errNo; } -# ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *sourcePath, *destinationPath; +/*! + * A string with the source for the link. + */ +@property (readonly, copy) OFString *sourcePath; + +/*! + * A string with the destination for the link. + */ +@property (readonly, copy) OFString *destinationPath; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -# endif /*! * @brief Creates a new, autoreleased link failed exception. * * @param sourcePath The source for the link @@ -55,28 +65,7 @@ * @return An initialized link failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; - -/*! - * @brief Returns a string with the source for the link. - * - * @return A string with the source for the link - */ -- (OFString*)sourcePath; - -/*! - * @brief Returns a string with the destination for the link. - * - * @return A string with the destination for the link - */ -- (OFString*)destinationPath; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end #endif Index: src/exceptions/OFLinkFailedException.m ================================================================== --- src/exceptions/OFLinkFailedException.m +++ src/exceptions/OFLinkFailedException.m @@ -19,10 +19,13 @@ #import "OFLinkFailedException.h" #import "OFString.h" #ifdef OF_HAVE_LINK @implementation OFLinkFailedException +@synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath @@ -65,22 +68,7 @@ { return [OFString stringWithFormat: @"Failed to link file %@ to %@: %@", _sourcePath, _destinationPath, of_strerror(_errNo)]; } - -- (OFString*)sourcePath -{ - OF_GETTER(_sourcePath, true) -} - -- (OFString*)destinationPath -{ - OF_GETTER(_destinationPath, true) -} - -- (int)errNo -{ - return _errNo; -} @end #endif Index: src/exceptions/OFListenFailedException.h ================================================================== --- src/exceptions/OFListenFailedException.h +++ src/exceptions/OFListenFailedException.h @@ -30,14 +30,24 @@ { id _socket; int _backLog, _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The socket which failed to listen. + */ @property (readonly, retain) id socket; -@property (readonly) int backLog, errNo; -#endif + +/*! + * The requested back log. + */ +@property (readonly) int backLog; + +/*! + * The errno of the error that occurred. + */ +@property (readonly) int errNo; /*! * @brief Creates a new, autoreleased listen failed exception. * * @param socket The socket which failed to listen @@ -58,27 +68,6 @@ * @return An initialized listen failed exception */ - initWithSocket: (id)socket backLog: (int)backLog errNo: (int)errNo; - -/*! - * @brief Returns the socket which failed to listen. - * - * @return The socket which failed to listen - */ -- (id)socket; - -/*! - * @brief Returns the requested back log. - * - * @return The requested back log - */ -- (int)backLog; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFListenFailedException.m ================================================================== --- src/exceptions/OFListenFailedException.m +++ src/exceptions/OFListenFailedException.m @@ -18,10 +18,12 @@ #import "OFListenFailedException.h" #import "OFString.h" @implementation OFListenFailedException +@synthesize socket = _socket, backLog = _backLog, errNo = _errNo; + + (instancetype)exceptionWithSocket: (id)socket backLog: (int)backLog errNo: (int)errNo { return [[[self alloc] initWithSocket: socket @@ -58,21 +60,6 @@ { return [OFString stringWithFormat: @"Failed to listen in socket of type %@ with a back log of %d: %@", [_socket class], _backLog, of_strerror(_errNo)]; } - -- (id)socket -{ - OF_GETTER(_socket, true) -} - -- (int)backLog -{ - return _backLog; -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFLockFailedException.h ================================================================== --- src/exceptions/OFLockFailedException.h +++ src/exceptions/OFLockFailedException.h @@ -26,13 +26,14 @@ @interface OFLockFailedException: OFException { id _lock; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The lock which could not be locked. + */ @property (readonly, retain) id lock; -#endif /*! * @brief Creates a new, autoreleased lock failed exception. * * @param lock The lock which could not be locked @@ -45,13 +46,6 @@ * * @param lock The lock which could not be locked * @return An initialized lock failed exception */ - initWithLock: (id )lock; - -/*! - * @brief Returns the lock which could not be locked. - * - * @return The lock which could not be locked - */ -- (id )lock; @end Index: src/exceptions/OFLockFailedException.m ================================================================== --- src/exceptions/OFLockFailedException.m +++ src/exceptions/OFLockFailedException.m @@ -18,10 +18,12 @@ #import "OFLockFailedException.h" #import "OFString.h" @implementation OFLockFailedException +@synthesize lock = _lock; + + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } @@ -47,11 +49,6 @@ return [OFString stringWithFormat: @"A lock of type %@ could not be locked!", [_lock class]]; else return @"A lock could not be locked!"; } - -- (id )lock -{ - OF_GETTER(_lock, true) -} @end Index: src/exceptions/OFMalformedXMLException.h ================================================================== --- src/exceptions/OFMalformedXMLException.h +++ src/exceptions/OFMalformedXMLException.h @@ -27,13 +27,14 @@ @interface OFMalformedXMLException: OFException { OFXMLParser *_parser; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The parser which encountered malformed XML. + */ @property (readonly, retain) OFXMLParser *parser; -#endif /*! * @brief Creates a new, autoreleased malformed XML exception. * * @param parser The parser which encountered malformed XML @@ -46,13 +47,6 @@ * * @param parser The parser which encountered malformed XML * @return An initialized malformed XML exception */ - initWithParser: (OFXMLParser*)parser; - -/*! - * @brief Returns the parser which encountered malformed XML. - * - * @return The parser which encountered malformed XML - */ -- (OFXMLParser*)parser; @end Index: src/exceptions/OFMalformedXMLException.m ================================================================== --- src/exceptions/OFMalformedXMLException.m +++ src/exceptions/OFMalformedXMLException.m @@ -19,10 +19,12 @@ #import "OFMalformedXMLException.h" #import "OFString.h" #import "OFXMLParser.h" @implementation OFMalformedXMLException +@synthesize parser = _parser; + + (instancetype)exceptionWithParser: (OFXMLParser*)parser { return [[[self alloc] initWithParser: parser] autorelease]; } @@ -49,11 +51,6 @@ @"An XML parser of type %@ encountered malformed XML in " @"line %zu!", [_parser class], [_parser lineNumber]]; else return @"An XML parser encountered malformed XML!"; } - -- (OFXMLParser*)parser -{ - OF_GETTER(_parser, true) -} @end Index: src/exceptions/OFMemoryNotPartOfObjectException.h ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.h +++ src/exceptions/OFMemoryNotPartOfObjectException.h @@ -27,14 +27,19 @@ { void *_pointer; id _object; } -#ifdef OF_HAVE_PROPERTIES +/*! + * A pointer to the memory which is not part of the object. + */ @property (readonly) void *pointer; + +/*! + * The object which the memory is not part of. + */ @property (readonly, retain) id object; -#endif /*! * @brief Creates a new, autoreleased memory not part of object exception. * * @param pointer A pointer to the memory that is not part of the object @@ -51,20 +56,6 @@ * @param object The object which the memory is not part of * @return An initialized memory not part of object exception */ - initWithPointer: (void*)pointer object: (id)object; - -/*! - * @brief Returns a pointer to the memory which is not part of the object. - * - * @return A pointer to the memory which is not part of the object - */ -- (void*)pointer; - -/*! - * @brief Returns the object which the memory is not part of. - * - * @return The object which the memory is not part of - */ -- (id)object; @end Index: src/exceptions/OFMemoryNotPartOfObjectException.m ================================================================== --- src/exceptions/OFMemoryNotPartOfObjectException.m +++ src/exceptions/OFMemoryNotPartOfObjectException.m @@ -18,10 +18,12 @@ #import "OFMemoryNotPartOfObjectException.h" #import "OFString.h" @implementation OFMemoryNotPartOfObjectException +@synthesize pointer = _pointer, object = _object; + + (instancetype)exceptionWithPointer: (void*)pointer object: (id)object { return [[[self alloc] initWithPointer: pointer object: object] autorelease]; @@ -56,16 +58,6 @@ @"Memory at %p was not allocated as part of object of type %@, " @"thus the memory allocation was not changed! It is also possible " @"that there was an attempt to free the same memory twice.", _pointer, [_object class]]; } - -- (void*)pointer -{ - return _pointer; -} - -- (id)object -{ - OF_GETTER(_object, true) -} @end Index: src/exceptions/OFMoveItemFailedException.h ================================================================== --- src/exceptions/OFMoveItemFailedException.h +++ src/exceptions/OFMoveItemFailedException.h @@ -26,14 +26,24 @@ { OFString *_sourcePath, *_destinationPath; int _errNo; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *sourcePath, *destinationPath; +/*! + * The original path. + */ +@property (readonly, copy) OFString *sourcePath; + +/*! + * The new path. + */ +@property (readonly, copy) OFString *destinationPath; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased move item failed exception. * * @param sourcePath The original path @@ -54,27 +64,6 @@ * @return An initialized move item failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; - -/*! - * @brief Returns the original path. - * - * @return The original path - */ -- (OFString*)sourcePath; - -/*! - * @brief Returns the new path. - * - * @return The new path - */ -- (OFString*)destinationPath; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFMoveItemFailedException.m ================================================================== --- src/exceptions/OFMoveItemFailedException.m +++ src/exceptions/OFMoveItemFailedException.m @@ -18,10 +18,13 @@ #import "OFMoveItemFailedException.h" #import "OFString.h" @implementation OFMoveItemFailedException +@synthesize sourcePath = _sourcePath, destinationPath = _destinationPath; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo { return [[[self alloc] initWithSourcePath: sourcePath @@ -64,21 +67,6 @@ { return [OFString stringWithFormat: @"Failed to move item at path %@ to %@: %@", _sourcePath, _destinationPath, of_strerror(_errNo)]; } - -- (OFString*)sourcePath -{ - OF_GETTER(_sourcePath, true) -} - -- (OFString*)destinationPath -{ - OF_GETTER(_destinationPath, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFNotImplementedException.h ================================================================== --- src/exceptions/OFNotImplementedException.h +++ src/exceptions/OFNotImplementedException.h @@ -27,14 +27,19 @@ { SEL _selector; id _object; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The selector which is not or not fully implemented. + */ @property (readonly) SEL selector; + +/*! + * The object which does not (fully) implement the selector. + */ @property (readonly, retain) id object; -#endif /*! * @brief Creates a new, autoreleased not implemented exception. * * @param selector The selector which is not or not fully implemented @@ -51,20 +56,6 @@ * @param object The object which does not (fully) implement the selector * @return An initialized not implemented exception */ - initWithSelector: (SEL)selector object: (id)object; - -/*! - * @brief Returns the selector which is not or not fully implemented. - * - * @return The selector which is not or not fully implemented - */ -- (SEL)selector; - -/*! - * @brief Returns the object which does not (fully) implement the selector. - * - * @return The object which does not (fully) implement the selector - */ -- (id)object; @end Index: src/exceptions/OFNotImplementedException.m ================================================================== --- src/exceptions/OFNotImplementedException.m +++ src/exceptions/OFNotImplementedException.m @@ -18,10 +18,12 @@ #import "OFNotImplementedException.h" #import "OFString.h" @implementation OFNotImplementedException +@synthesize selector = _selector, object = _object; + + (instancetype)exceptionWithSelector: (SEL)selector object: (id)object { return [[[self alloc] initWithSelector: selector object: object] autorelease]; @@ -54,16 +56,6 @@ { return [OFString stringWithFormat: @"The selector %s is not understood by an object of type %@ or not " @"(fully) implemented!", sel_getName(_selector), [_object class]]; } - -- (SEL)selector -{ - return _selector; -} - -- (id)object -{ - OF_GETTER(_object, true) -} @end Index: src/exceptions/OFNotOpenException.h ================================================================== --- src/exceptions/OFNotOpenException.h +++ src/exceptions/OFNotOpenException.h @@ -24,13 +24,14 @@ @interface OFNotOpenException: OFException { id _object; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The object which is not open, connected or bound. + */ @property (readonly, retain) id object; -#endif /*! * @brief Creates a new, autoreleased not open exception. * * @param object The object which is not open, connected or bound @@ -43,13 +44,6 @@ * * @param object The object which is not open, connected or bound * @return An initialized not open exception */ - initWithObject: (id)object; - -/*! - * @brief Returns the object which is not open, connected or bound. - * - * @return The object which is not open, connected or bound - */ -- (id)object; @end Index: src/exceptions/OFNotOpenException.m ================================================================== --- src/exceptions/OFNotOpenException.m +++ src/exceptions/OFNotOpenException.m @@ -18,10 +18,12 @@ #import "OFNotOpenException.h" #import "OFString.h" @implementation OFNotOpenException +@synthesize object = _object; + + (instancetype)exceptionWithObject: (id)object { return [[[self alloc] initWithObject: object] autorelease]; } @@ -50,11 +52,6 @@ { return [OFString stringWithFormat: @"The object of type %@ is not open, connected or bound!", [_object class]]; } - -- (id)object -{ - OF_GETTER(_object, true) -} @end Index: src/exceptions/OFObserveFailedException.h ================================================================== --- src/exceptions/OFObserveFailedException.h +++ src/exceptions/OFObserveFailedException.h @@ -28,14 +28,19 @@ { OFKernelEventObserver *_observer; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The observer which failed to observe. + */ @property (readonly, retain) OFKernelEventObserver *observer; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased observe failed exception. * * @param observer The observer which failed to observe @@ -52,20 +57,6 @@ * @param errNo The errno of the error that occurred * @return An initialized observe failed exception */ - initWithObserver: (OFKernelEventObserver*)observer errNo: (int)errNo; - -/*! - * @brief Returns the observer which failed to observe. - * - * @return The observer which failed to observe - */ -- (OFKernelEventObserver*)observer; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFObserveFailedException.m ================================================================== --- src/exceptions/OFObserveFailedException.m +++ src/exceptions/OFObserveFailedException.m @@ -19,10 +19,12 @@ #import "OFObserveFailedException.h" #import "OFString.h" #import "OFKernelEventObserver.h" @implementation OFObserveFailedException +@synthesize observer = _observer, errNo = _errNo; + + (instancetype)exceptionWithObserver: (OFKernelEventObserver*)observer errNo: (int)errNo { return [[[self alloc] initWithObserver: observer errNo: errNo] autorelease]; @@ -60,16 +62,6 @@ { return [OFString stringWithFormat: @"An observer of class %@ failed to observe: %@", [_observer className], of_strerror(_errNo)]; } - -- (OFKernelEventObserver*)observer -{ - OF_GETTER(_observer, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFOpenItemFailedException.h ================================================================== --- src/exceptions/OFOpenItemFailedException.h +++ src/exceptions/OFOpenItemFailedException.h @@ -18,22 +18,32 @@ /*! * @class OFOpenItemFailedException \ * OFOpenItemFailedException.h ObjFW/OFOpenItemFailedException.h * - * @brief An exception indicating an item couldn't be opened. + * @brief An exception indicating an item could not be opened. */ @interface OFOpenItemFailedException: OFException { OFString *_path, *_mode; int _errNo; } -#ifdef OF_HAVE_PROPERTIES -@property (readonly, copy) OFString *path, *mode; +/*! + * The path of the item which could not be opened. + */ +@property (readonly, copy) OFString *path; + +/*! + * The mode in which the item should have been opened. + */ +@property (readonly, copy) OFString *mode; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased open item failed exception. * * @param path A string with the path of the item tried to open @@ -74,64 +84,42 @@ errNo: (int)errNo; /*! * @brief Initializes an already allocated open item failed exception. * - * @param path A string with the path of the item which couldn't be opened + * @param path A string with the path of the item which could not be opened * @return An initialized open item failed exception */ - initWithPath: (OFString*)path; /*! * @brief Initializes an already allocated open item failed exception. * - * @param path A string with the path of the item which couldn't be opened + * @param path A string with the path of the item which could not be opened * @param mode A string with the mode in which the item should have been opened * @return An initialized open item failed exception */ - initWithPath: (OFString*)path mode: (OFString*)mode; /*! * @brief Initializes an already allocated open item failed exception. * - * @param path A string with the path of the item which couldn't be opened + * @param path A string with the path of the item which could not be opened * @param errNo The errno of the error that occurred * @return An initialized open item failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; /*! * @brief Initializes an already allocated open item failed exception. * - * @param path A string with the path of the item which couldn't be opened + * @param path A string with the path of the item which could not be opened * @param mode A string with the mode in which the item should have been opened * @param errNo The errno of the error that occurred * @return An initialized open item failed exception */ - initWithPath: (OFString*)path mode: (OFString*)mode errNo: (int)errNo; - -/*! - * @brief Returns a string with the path of the item which couldn't be opened. - * - * @return A string with the path of the item which couldn't be opened - */ -- (OFString*)path; - -/*! - * @brief Returns a string with the mode in which the item should have been - * opened. - * - * @return A string with the mode in which the item should have been opened - */ -- (OFString*)mode; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFOpenItemFailedException.m ================================================================== --- src/exceptions/OFOpenItemFailedException.m +++ src/exceptions/OFOpenItemFailedException.m @@ -18,10 +18,12 @@ #import "OFOpenItemFailedException.h" #import "OFString.h" @implementation OFOpenItemFailedException +@synthesize path = _path, mode = _mode, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path { return [[[self alloc] initWithPath: path] autorelease]; } @@ -144,21 +146,6 @@ else return [OFString stringWithFormat: @"Failed to open item %@!", _path]; } } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (OFString*)mode -{ - OF_GETTER(_mode, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFOutOfMemoryException.h ================================================================== --- src/exceptions/OFOutOfMemoryException.h +++ src/exceptions/OFOutOfMemoryException.h @@ -25,32 +25,26 @@ @interface OFOutOfMemoryException: OFException { size_t _requestedSize; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The size of the memory that could not be allocated. + */ @property (readonly) size_t requestedSize; -#endif /*! * @brief Creates a new, autoreleased no memory exception. * - * @param requestedSize The size of the memory that couldn't be allocated + * @param requestedSize The size of the memory that could not be allocated * @return A new, autoreleased no memory exception */ + (instancetype)exceptionWithRequestedSize: (size_t)requestedSize; /*! * @brief Initializes an already allocated no memory exception. * - * @param requestedSize The size of the memory that couldn't be allocated + * @param requestedSize The size of the memory that could not be allocated * @return An initialized no memory exception */ - initWithRequestedSize: (size_t)requestedSize; - -/*! - * @brief Returns the size of the memoory that couldn't be allocated. - * - * @return The size of the memoory that couldn't be allocated - */ -- (size_t)requestedSize; @end Index: src/exceptions/OFOutOfMemoryException.m ================================================================== --- src/exceptions/OFOutOfMemoryException.m +++ src/exceptions/OFOutOfMemoryException.m @@ -18,10 +18,12 @@ #import "OFOutOfMemoryException.h" #import "OFString.h" @implementation OFOutOfMemoryException +@synthesize requestedSize = _requestedSize; + + (instancetype)exceptionWithRequestedSize: (size_t)requestedSize { return [[[self alloc] initWithRequestedSize: requestedSize] autorelease]; } @@ -41,11 +43,6 @@ return [OFString stringWithFormat: @"Could not allocate %zu bytes!", _requestedSize]; else return @"Could not allocate enough memory!"; } - -- (size_t)requestedSize -{ - return _requestedSize; -} @end Index: src/exceptions/OFReadOrWriteFailedException.h ================================================================== --- src/exceptions/OFReadOrWriteFailedException.h +++ src/exceptions/OFReadOrWriteFailedException.h @@ -28,21 +28,30 @@ id _object; size_t _requestedLength; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The stream which caused the read or write failed exception. + */ @property (readonly, retain) id object; + +/*! + * The requested length of the data that could not be read / written. + */ @property (readonly) size_t requestedLength; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased read or write failed exception. * * @param object The object from which reading or to which writing failed - * @param requestedLength The requested length of the data that couldn't be + * @param requestedLength The requested length of the data that could not be * read / written * @return A new, autoreleased read or write failed exception */ + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength; @@ -49,11 +58,11 @@ /*! * @brief Creates a new, autoreleased read or write failed exception. * * @param object The object from which reading or to which writing failed - * @param requestedLength The requested length of the data that couldn't be + * @param requestedLength The requested length of the data that could not be * read / written * @param errNo The errno of the error that occurred * @return A new, autoreleased read or write failed exception */ + (instancetype)exceptionWithObject: (id)object @@ -62,11 +71,11 @@ /*! * @brief Initializes an already allocated read or write failed exception. * * @param object The object from which reading or to which writing failed - * @param requestedLength The requested length of the data that couldn't be + * @param requestedLength The requested length of the data that could not be * read / written * @return A new open file failed exception */ - initWithObject: (id)object requestedLength: (size_t)requestedLength; @@ -73,36 +82,14 @@ /*! * @brief Initializes an already allocated read or write failed exception. * * @param object The object from which reading or to which writing failed - * @param requestedLength The requested length of the data that couldn't be + * @param requestedLength The requested length of the data that could not be * read / written * @param errNo The errno of the error that occurred * @return A new open file failed exception */ - initWithObject: (id)object requestedLength: (size_t)requestedLength errNo: (int)errNo; - -/*! - * @brief Returns the object from which reading or to which writing failed - * - * @return The stream which caused the read or write failed exception - */ -- (id)object; - -/*! - * @brief Returns the requested length of the data that couldn't be read / - * written. - * - * @return The requested length of the data that couldn't be read / written - */ -- (size_t)requestedLength; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFReadOrWriteFailedException.m ================================================================== --- src/exceptions/OFReadOrWriteFailedException.m +++ src/exceptions/OFReadOrWriteFailedException.m @@ -18,10 +18,13 @@ #import "OFReadOrWriteFailedException.h" #import "OFString.h" @implementation OFReadOrWriteFailedException +@synthesize object = _object, requestedLength = _requestedLength; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithObject: (id)object requestedLength: (size_t)requestedLength { return [[[self alloc] initWithObject: object requestedLength: requestedLength] autorelease]; @@ -83,21 +86,6 @@ return [OFString stringWithFormat: @"Failed to read or write %zu bytes from / to an object of " @"type %@!", _requestedLength, [_object class]]; } - -- (id)object -{ - OF_GETTER(_object, true) -} - -- (size_t)requestedLength -{ - return _requestedLength; -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFRemoveItemFailedException.h ================================================================== --- src/exceptions/OFRemoveItemFailedException.h +++ src/exceptions/OFRemoveItemFailedException.h @@ -26,14 +26,19 @@ { OFString *_path; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The path of the item which could not be removed. + */ @property (readonly, copy) OFString *path; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased remove failed exception. * * @param path The path of the item which could not be removed @@ -50,20 +55,6 @@ * @param errNo The errno of the error that occurred * @return An initialized remove item failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; - -/*! - * @brief Returns the path of the item which could not be removed. - * - * @return The path of the item which could not be removed - */ -- (OFString*)path; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFRemoveItemFailedException.m ================================================================== --- src/exceptions/OFRemoveItemFailedException.m +++ src/exceptions/OFRemoveItemFailedException.m @@ -18,10 +18,12 @@ #import "OFRemoveItemFailedException.h" #import "OFString.h" @implementation OFRemoveItemFailedException +@synthesize path = _path, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path errNo: (int)errNo { return [[[self alloc] initWithPath: path errNo: errNo] autorelease]; @@ -59,16 +61,6 @@ { return [OFString stringWithFormat: @"Failed to remove item at path %@: %@", _path, of_strerror(_errNo)]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFSeekFailedException.h ================================================================== --- src/exceptions/OFSeekFailedException.h +++ src/exceptions/OFSeekFailedException.h @@ -28,15 +28,29 @@ OFSeekableStream *_stream; of_offset_t _offset; int _whence, _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The stream for which seeking failed. + */ @property (readonly, retain) OFSeekableStream *stream; + +/*! + * The offset to which seeking failed. + */ @property (readonly) of_offset_t offset; -@property (readonly) int whence, errNo; -#endif + +/*! + * To what the offset is relative. + */ +@property (readonly) int whence; + +/*! + * The errno of the error that occurred. + */ +@property (readonly) int errNo; /*! * @brief Creates a new, autoreleased seek failed exception. * * @param stream The stream for which seeking failed @@ -61,34 +75,6 @@ */ - initWithStream: (OFSeekableStream*)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo; - -/*! - * @brief Returns the stream for which seeking failed. - * - * @return The stream for which seeking failed - */ -- (OFSeekableStream*)stream; - -/*! - * @brief Returns the offset to which seeking failed. - * - * @return The offset to which seeking failed - */ -- (of_offset_t)offset; - -/*! - * @brief Returns to what the offset is relative. - * - * @return To what the offset is relative - */ -- (int)whence; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFSeekFailedException.m ================================================================== --- src/exceptions/OFSeekFailedException.m +++ src/exceptions/OFSeekFailedException.m @@ -19,10 +19,13 @@ #import "OFSeekFailedException.h" #import "OFString.h" #import "OFSeekableStream.h" @implementation OFSeekFailedException +@synthesize stream = _stream, offset = _offset, whence = _whence; +@synthesize errNo = _errNo; + + (instancetype)exceptionWithStream: (OFSeekableStream*)stream offset: (of_offset_t)offset whence: (int)whence errNo: (int)errNo { @@ -63,26 +66,6 @@ { return [OFString stringWithFormat: @"Seeking failed in stream of type %@: %@", [_stream class], of_strerror(_errNo)]; } - -- (OFSeekableStream*)stream -{ - OF_GETTER(_stream, true) -} - -- (of_offset_t)offset -{ - return _offset; -} - -- (int)whence -{ - return _whence; -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFSetOptionFailedException.h ================================================================== --- src/exceptions/OFSetOptionFailedException.h +++ src/exceptions/OFSetOptionFailedException.h @@ -28,14 +28,19 @@ { OFStream *_stream; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The stream for which the option could not be set. + */ @property (readonly, retain) OFStream *stream; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased set option failed exception. * * @param stream The stream for which the option could not be set @@ -52,20 +57,6 @@ * @param errNo The errno of the error that occurred * @return An initialized set option failed exception */ - initWithStream: (OFStream*)stream errNo: (int)errNo; - -/*! - * @brief Returns the stream for which the option could not be set. - * - * @return The stream for which the option could not be set - */ -- (OFStream*)stream; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFSetOptionFailedException.m ================================================================== --- src/exceptions/OFSetOptionFailedException.m +++ src/exceptions/OFSetOptionFailedException.m @@ -19,10 +19,12 @@ #import "OFSetOptionFailedException.h" #import "OFString.h" #import "OFStream.h" @implementation OFSetOptionFailedException +@synthesize stream = _stream, errNo = _errNo; + + (instancetype)exceptionWithStream: (OFStream*)stream errNo: (int)errNo { return [[[self alloc] initWithStream: stream errNo: errNo] autorelease]; @@ -55,16 +57,6 @@ { return [OFString stringWithFormat: @"Setting an option in a stream of type %@ failed: %@", [_stream class], of_strerror(_errNo)]; } - -- (OFStream*)stream -{ - OF_GETTER(_stream, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFStatItemFailedException.h ================================================================== --- src/exceptions/OFStatItemFailedException.h +++ src/exceptions/OFStatItemFailedException.h @@ -26,14 +26,19 @@ { OFString *_path; int _errNo; } -#ifdef OF_HAVE_PROPERTIES +/*! + * A string with the path of the item whose status could not be retrieved. + */ @property (readonly, copy) OFString *path; + +/*! + * The errno of the error that occurred. + */ @property (readonly) int errNo; -#endif /*! * @brief Creates a new, autoreleased stat item failed exception. * * @param path A string with the path of the item whose status could not be @@ -70,22 +75,6 @@ * @param errNo The errno of the error that occurred * @return An initialized stat item failed exception */ - initWithPath: (OFString*)path errNo: (int)errNo; - -/*! - * @brief Returns a string with the path of the item whose status could not be - * retrieved. - * - * @return A string with the path of the item whose status could not be - * retrieved - */ -- (OFString*)path; - -/*! - * @brief Returns the errno of the error that occurred. - * - * @return The errno of the error that occurred - */ -- (int)errNo; @end Index: src/exceptions/OFStatItemFailedException.m ================================================================== --- src/exceptions/OFStatItemFailedException.m +++ src/exceptions/OFStatItemFailedException.m @@ -18,10 +18,12 @@ #import "OFStatItemFailedException.h" #import "OFString.h" @implementation OFStatItemFailedException +@synthesize path = _path, errNo = _errNo; + + (instancetype)exceptionWithPath: (OFString*)path { return [[[self alloc] initWithPath: path] autorelease]; } @@ -81,16 +83,6 @@ @"Failed to stat item %@: %@", _path, of_strerror(_errNo)]; else return [OFString stringWithFormat: @"Failed to stat item %@!", _path]; } - -- (OFString*)path -{ - OF_GETTER(_path, true) -} - -- (int)errNo -{ - return _errNo; -} @end Index: src/exceptions/OFStillLockedException.h ================================================================== --- src/exceptions/OFStillLockedException.h +++ src/exceptions/OFStillLockedException.h @@ -26,13 +26,14 @@ @interface OFStillLockedException: OFException { id _lock; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The lock which is still locked. + */ @property (readonly, retain) id lock; -#endif /*! * @brief Creates a new, autoreleased still locked exception. * * @param lock The lock which is still locked @@ -45,13 +46,6 @@ * * @param lock The lock which is still locked * @return An initialized still locked exception */ - initWithLock: (id )lock; - -/*! - * @brief Returns the lock which is still locked. - * - * @return The lock which is still locked - */ -- (id )lock; @end Index: src/exceptions/OFStillLockedException.m ================================================================== --- src/exceptions/OFStillLockedException.m +++ src/exceptions/OFStillLockedException.m @@ -18,10 +18,12 @@ #import "OFStillLockedException.h" #import "OFString.h" @implementation OFStillLockedException +@synthesize lock = _lock; + + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } @@ -49,11 +51,6 @@ @"still locked!", [_lock class]]; else return @"Deallocation of a lock even though it was still " @"locked!"; } - -- (id )lock -{ - OF_GETTER(_lock, true) -} @end Index: src/exceptions/OFThreadJoinFailedException.h ================================================================== --- src/exceptions/OFThreadJoinFailedException.h +++ src/exceptions/OFThreadJoinFailedException.h @@ -31,13 +31,14 @@ @interface OFThreadJoinFailedException: OFException { OFThread *_thread; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The thread which could not be joined. + */ @property (readonly, retain) OFThread *thread; -#endif /*! * @brief Creates a new, autoreleased thread join failed exception. * * @param thread The thread which could not be joined @@ -50,13 +51,6 @@ * * @param thread The thread which could not be joined * @return An initialized thread join failed exception */ - initWithThread: (OFThread*)thread; - -/*! - * @brief Returns the thread which could not be joined. - * - * @return The thread which could not be joined - */ -- (OFThread*)thread; @end Index: src/exceptions/OFThreadJoinFailedException.m ================================================================== --- src/exceptions/OFThreadJoinFailedException.m +++ src/exceptions/OFThreadJoinFailedException.m @@ -19,10 +19,12 @@ #import "OFThreadJoinFailedException.h" #import "OFString.h" #import "OFThread.h" @implementation OFThreadJoinFailedException +@synthesize thread = _thread; + + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } @@ -51,11 +53,6 @@ { return [OFString stringWithFormat: @"Joining a thread of type %@ failed! Most likely, another thread " @"already waits for the thread to join.", [_thread class]]; } - -- (OFThread*)thread -{ - OF_GETTER(_thread, true) -} @end Index: src/exceptions/OFThreadStartFailedException.h ================================================================== --- src/exceptions/OFThreadStartFailedException.h +++ src/exceptions/OFThreadStartFailedException.h @@ -31,13 +31,14 @@ @interface OFThreadStartFailedException: OFException { OFThread *_thread; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The thread which could not be started. + */ @property (readonly, retain) OFThread *thread; -#endif /*! * @brief Creates a new, autoreleased thread start failed exception. * * @param thread The thread which could not be started @@ -50,13 +51,6 @@ * * @param thread The thread which could not be started * @return An initialized thread start failed exception */ - initWithThread: (OFThread*)thread; - -/*! - * @brief Returns the thread which could not be started. - * - * @return The thread which could not be started - */ -- (OFThread*)thread; @end Index: src/exceptions/OFThreadStartFailedException.m ================================================================== --- src/exceptions/OFThreadStartFailedException.m +++ src/exceptions/OFThreadStartFailedException.m @@ -19,10 +19,12 @@ #import "OFThreadStartFailedException.h" #import "OFString.h" #import "OFThread.h" @implementation OFThreadStartFailedException +@synthesize thread = _thread; + + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } @@ -50,11 +52,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"Starting a thread of type %@ failed!", [_thread class]]; } - -- (OFThread*)thread -{ - OF_GETTER(_thread, true) -} @end Index: src/exceptions/OFThreadStillRunningException.h ================================================================== --- src/exceptions/OFThreadStillRunningException.h +++ src/exceptions/OFThreadStillRunningException.h @@ -31,13 +31,14 @@ @interface OFThreadStillRunningException: OFException { OFThread *_thread; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The thread which is still running. + */ @property (readonly, retain) OFThread *thread; -#endif /*! * @brief Creates a new, autoreleased thread still running exception. * * @param thread The thread which is still running @@ -50,13 +51,6 @@ * * @param thread The thread which is still running * @return An initialized thread still running exception */ - initWithThread: (OFThread*)thread; - -/*! - * @brief Returns the thread which is still running. - * - * @return The thread which is still running - */ -- (OFThread*)thread; @end Index: src/exceptions/OFThreadStillRunningException.m ================================================================== --- src/exceptions/OFThreadStillRunningException.m +++ src/exceptions/OFThreadStillRunningException.m @@ -19,10 +19,12 @@ #import "OFThreadStillRunningException.h" #import "OFString.h" #import "OFThread.h" @implementation OFThreadStillRunningException +@synthesize thread = _thread; + + (instancetype)exceptionWithThread: (OFThread*)thread { return [[[self alloc] initWithThread: thread] autorelease]; } @@ -51,11 +53,6 @@ { return [OFString stringWithFormat: @"Deallocation of a thread of type %@ was tried, even though it " @"was still running!", [_thread class]]; } - -- (OFThread*)thread -{ - OF_GETTER(_thread, true) -} @end Index: src/exceptions/OFUnboundNamespaceException.h ================================================================== --- src/exceptions/OFUnboundNamespaceException.h +++ src/exceptions/OFUnboundNamespaceException.h @@ -28,18 +28,19 @@ { OFString *_namespace; OFXMLElement *_element; } -#ifdef OF_HAVE_PROPERTIES -# ifdef __cplusplus -@property (readonly, copy, getter=namespace) OFString *namespace_; -# else +/*! + * The unbound namespace. + */ @property (readonly, copy) OFString *namespace; -# endif + +/*! + * The element in which the namespace was not bound. + */ @property (readonly, retain) OFXMLElement *element; -#endif /*! * @brief Creates a new, autoreleased unbound namespace exception. * * @param namespace_ The namespace which is unbound @@ -56,20 +57,6 @@ * @param element The element in which the namespace was not bound * @return An initialized unbound namespace exception */ - initWithNamespace: (OFString*)namespace_ element: (OFXMLElement*)element; - -/*! - * @brief Returns the unbound namespace. - * - * @return The unbound namespace - */ -- (OFString*)namespace; - -/*! - * @brief Returns the element in which the namespace was not bound. - * - * @return The element in which the namespace was not bound - */ -- (OFXMLElement*)element; @end Index: src/exceptions/OFUnboundNamespaceException.m ================================================================== --- src/exceptions/OFUnboundNamespaceException.m +++ src/exceptions/OFUnboundNamespaceException.m @@ -19,10 +19,12 @@ #import "OFUnboundNamespaceException.h" #import "OFString.h" #import "OFXMLElement.h" @implementation OFUnboundNamespaceException +@synthesize namespace = _namespace, element = _element; + + (instancetype)exceptionWithNamespace: (OFString*)namespace element: (OFXMLElement*)element { return [[[self alloc] initWithNamespace: namespace element: element] autorelease]; @@ -61,16 +63,6 @@ { return [OFString stringWithFormat: @"The namespace %@ is not bound in an element of type %@!", _namespace, [_element class]]; } - -- (OFString*)namespace -{ - OF_GETTER(_namespace, true) -} - -- (OFXMLElement*)element -{ - OF_GETTER(_element, true) -} @end Index: src/exceptions/OFUnboundPrefixException.h ================================================================== --- src/exceptions/OFUnboundPrefixException.h +++ src/exceptions/OFUnboundPrefixException.h @@ -28,14 +28,19 @@ { OFString *_prefix; OFXMLParser *_parser; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The unbound prefix. + */ @property (readonly, copy) OFString *prefix; + +/*! + * The parser which encountered the unbound prefix. + */ @property (readonly, retain) OFXMLParser *parser; -#endif /*! * @brief Creates a new, autoreleased unbound prefix exception. * * @param prefix The prefix which is unbound @@ -52,20 +57,6 @@ * @param parser The parser which encountered the unbound prefix * @return An initialized unbound prefix exception */ - initWithPrefix: (OFString*)prefix parser: (OFXMLParser*)parser; - -/*! - * @brief Returns the unbound prefix. - * - * @return The unbound prefix - */ -- (OFString*)prefix; - -/*! - * @brief Returns the parser which encountered the unbound prefix. - * - * @return The parser which encountered the unbound prefix - */ -- (OFXMLParser*)parser; @end Index: src/exceptions/OFUnboundPrefixException.m ================================================================== --- src/exceptions/OFUnboundPrefixException.m +++ src/exceptions/OFUnboundPrefixException.m @@ -19,10 +19,12 @@ #import "OFUnboundPrefixException.h" #import "OFString.h" #import "OFXMLParser.h" @implementation OFUnboundPrefixException +@synthesize prefix = _prefix, parser = _parser; + + (instancetype)exceptionWithPrefix: (OFString*)prefix parser: (OFXMLParser*)parser { return [[[self alloc] initWithPrefix: prefix parser: parser] autorelease]; @@ -61,16 +63,6 @@ { return [OFString stringWithFormat: @"An XML parser of type %@ encountered the unbound prefix %@ in " @"line %zu!", [_parser class], _prefix, [_parser lineNumber]]; } - -- (OFString*)prefix -{ - OF_GETTER(_prefix, true) -} - -- (OFXMLParser*)parser -{ - OF_GETTER(_parser, true) -} @end Index: src/exceptions/OFUnknownXMLEntityException.h ================================================================== --- src/exceptions/OFUnknownXMLEntityException.h +++ src/exceptions/OFUnknownXMLEntityException.h @@ -26,13 +26,14 @@ @interface OFUnknownXMLEntityException: OFException { OFString *_entityName; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The name of the unknown XML entity. + */ @property (readonly, copy) OFString *entityName; -#endif /*! * @brief Creates a new, autoreleased unknown XML entity exception. * * @param entityName The name of the unknown XML entity @@ -45,13 +46,6 @@ * * @param entityName The name of the unknown XML entity * @return An initialized unknown XML entity exception */ - initWithEntityName: (OFString*)entityName; - -/*! - * @brief Returns the name of the unknown XML entity - * - * @return The name of the unknown XML entity - */ -- (OFString*)entityName; @end Index: src/exceptions/OFUnknownXMLEntityException.m ================================================================== --- src/exceptions/OFUnknownXMLEntityException.m +++ src/exceptions/OFUnknownXMLEntityException.m @@ -18,10 +18,12 @@ #import "OFUnknownXMLEntityException.h" #import "OFString.h" @implementation OFUnknownXMLEntityException +@synthesize entityName = _entityName; + + (instancetype)exceptionWithEntityName: (OFString*)entityName { return [[[self alloc] initWithEntityName: entityName] autorelease]; } @@ -50,11 +52,6 @@ { return [OFString stringWithFormat: @"A parser encountered an unknown XML entity named %@!", _entityName]; } - -- (OFString*)entityName -{ - OF_GETTER(_entityName, true) -} @end Index: src/exceptions/OFUnlockFailedException.h ================================================================== --- src/exceptions/OFUnlockFailedException.h +++ src/exceptions/OFUnlockFailedException.h @@ -26,13 +26,14 @@ @interface OFUnlockFailedException: OFException { id _lock; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The lock which could not be unlocked. + */ @property (readonly, retain) id lock; -#endif /*! * @brief Creates a new, autoreleased unlock failed exception. * * @param lock The lock which could not be unlocked @@ -45,13 +46,6 @@ * * @param lock The lock which could not be unlocked * @return An initialized unlock failed exception */ - initWithLock: (id )lock; - -/*! - * @brief Returns the lock which could not be unlocked. - * - * @return The lock which could not be unlocked - */ -- (id )lock; @end Index: src/exceptions/OFUnlockFailedException.m ================================================================== --- src/exceptions/OFUnlockFailedException.m +++ src/exceptions/OFUnlockFailedException.m @@ -18,10 +18,12 @@ #import "OFUnlockFailedException.h" #import "OFString.h" @implementation OFUnlockFailedException +@synthesize lock = _lock; + + (instancetype)exceptionWithLock: (id )lock { return [[[self alloc] initWithLock: lock] autorelease]; } @@ -47,11 +49,6 @@ return [OFString stringWithFormat: @"A lock of type %@ could not be unlocked!", [_lock class]]; else return @"A lock could not be unlocked!"; } - -- (id )lock -{ - OF_GETTER(_lock, true) -} @end Index: src/exceptions/OFUnsupportedProtocolException.h ================================================================== --- src/exceptions/OFUnsupportedProtocolException.h +++ src/exceptions/OFUnsupportedProtocolException.h @@ -29,13 +29,14 @@ @interface OFUnsupportedProtocolException: OFException { OFURL *_URL; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The URL whose protocol is unsupported. + */ @property (readonly, retain) OFURL *URL; -#endif /*! * @brief Creates a new, autoreleased unsupported protocol exception. * * @param URL The URL whose protocol is unsupported @@ -48,13 +49,6 @@ * * @param URL The URL whose protocol is unsupported * @return An initialized unsupported protocol exception */ - initWithURL: (OFURL*)URL; - -/*! - * @brief Returns the URL whose protocol is unsupported. - * - * @return The URL whose protocol is unsupported - */ -- (OFURL*)URL; @end Index: src/exceptions/OFUnsupportedProtocolException.m ================================================================== --- src/exceptions/OFUnsupportedProtocolException.m +++ src/exceptions/OFUnsupportedProtocolException.m @@ -19,10 +19,12 @@ #import "OFUnsupportedProtocolException.h" #import "OFString.h" #import "OFURL.h" @implementation OFUnsupportedProtocolException +@synthesize URL = _URL; + + (instancetype)exceptionWithURL: (OFURL*)url { return [[[self alloc] initWithURL: url] autorelease]; } @@ -33,16 +35,11 @@ - initWithURL: (OFURL*)URL { self = [super init]; - @try { - _URL = [URL copy]; - } @catch (id e) { - [self release]; - @throw e; - } + _URL = [URL retain]; return self; } - (void)dealloc @@ -55,11 +52,6 @@ - (OFString*)description { return [OFString stringWithFormat: @"The protocol of URL %@ is not supported!", _URL]; } - -- (OFURL*)URL -{ - OF_GETTER(_URL, true) -} @end Index: src/exceptions/OFUnsupportedVersionException.h ================================================================== --- src/exceptions/OFUnsupportedVersionException.h +++ src/exceptions/OFUnsupportedVersionException.h @@ -26,13 +26,14 @@ @interface OFUnsupportedVersionException: OFException { OFString *_version; } -#ifdef OF_HAVE_PROPERTIES +/*! + * The version which is unsupported. + */ @property (readonly, copy) OFString *version; -#endif /*! * @brief Creates a new, autoreleased unsupported version exception. * * @param version The version which is unsupported @@ -45,13 +46,6 @@ * * @param version The version which is unsupported * @return An initialized unsupported version exception */ - initWithVersion: (OFString*)version; - -/*! - * @brief Returns the version which is unsupported. - * - * @return The version which is unsupported - */ -- (OFString*)version; @end Index: src/exceptions/OFUnsupportedVersionException.m ================================================================== --- src/exceptions/OFUnsupportedVersionException.m +++ src/exceptions/OFUnsupportedVersionException.m @@ -18,10 +18,12 @@ #import "OFUnsupportedVersionException.h" #import "OFString.h" @implementation OFUnsupportedVersionException +@synthesize version = _version; + + (instancetype)exceptionWithVersion: (OFString*)version { return [[[self alloc] initWithVersion: version] autorelease]; } @@ -55,11 +57,6 @@ { return [OFString stringWithFormat: @"Version %@ of the format or protocol is not supported!", _version]; } - -- (OFString*)version -{ - OF_GETTER(_version, true) -} @end Index: src/macros.h ================================================================== --- src/macros.h +++ src/macros.h @@ -316,16 +316,10 @@ extern void objc_setProperty(id, SEL, ptrdiff_t, id, BOOL, signed char); #ifdef __cplusplus } #endif -#define OF_IVAR_OFFSET(ivar) ((intptr_t)&ivar - (intptr_t)self) -#define OF_GETTER(ivar, atomic) \ - return objc_getProperty(self, _cmd, OF_IVAR_OFFSET(ivar), atomic); -#define OF_SETTER(ivar, value, atomic, copy) \ - objc_setProperty(self, _cmd, OF_IVAR_OFFSET(ivar), value, atomic, copy); - static OF_INLINE uint16_t OF_CONST_FUNC OF_BSWAP16_CONST(uint16_t i) { return (i & UINT16_C(0xFF00)) >> 8 | (i & UINT16_C(0x00FF)) << 8; Index: tests/OFXMLParserTests.m ================================================================== --- tests/OFXMLParserTests.m +++ tests/OFXMLParserTests.m @@ -346,11 +346,11 @@ /* Simulate a stream where we only get chunks */ len = strlen(str); for (j = 0; j < len; j+= 2) { - if ([parser finishedParsing]) + if ([parser hasFinishedParsing]) abort(); if (j + 2 > len) [parser parseBuffer: str + j length: 1]; @@ -360,11 +360,11 @@ } TEST(@"Checking if everything was parsed", i == 32 && [parser lineNumber] == 18) - TEST(@"-[finishedParsing]", [parser finishedParsing]) + TEST(@"-[hasFinishedParsing]", [parser hasFinishedParsing]) TEST(@"Parsing whitespaces after the document", R([parser parseString: @" \t\r\n "])) TEST(@"Parsing comments after the document",