Index: src/OFApplication.h ================================================================== --- src/OFApplication.h +++ src/OFApplication.h @@ -45,10 +45,16 @@ { OFString *programName; OFMutableArray *arguments; id delegate; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, retain) OFString *programName; +@property (readonly, retain) OFArray *arguments; +@property (retain) id delegate; +#endif /** * \return The only OFApplication instance in the application */ + sharedApplication; Index: src/OFDataArray.h ================================================================== --- src/OFDataArray.h +++ src/OFDataArray.h @@ -18,13 +18,18 @@ * OFBigDataArray, which allocates the memory in pages rather than in bytes. */ @interface OFDataArray: OFObject { char *data; + size_t count; size_t itemSize; - size_t count; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) size_t count; +@property (readonly) size_t itemSize; +#endif /** * Creates a new OFDataArray whose items all have the same size. * * \param is The size of each element in the OFDataArray Index: src/OFDictionary.h ================================================================== --- src/OFDictionary.h +++ src/OFDictionary.h @@ -33,10 +33,14 @@ { struct of_dictionary_bucket **data; uint32_t size; size_t count; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) size_t count; +#endif /** * Creates a new OFDictionary. * * \return A new autoreleased OFDictionary Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -53,10 +53,14 @@ { Class inClass; OFString *string; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) Class inClass; +#endif + /** * Creates a new exception. * * \param class_ The class of the object which caused the exception * \return A new exception @@ -87,10 +91,14 @@ */ @interface OFOutOfMemoryException: OFException { size_t requestedSize; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) size_t requestedSize; +#endif /** * \param class_ The class of the object which caused the exception * \param size The size of the memory that couldn't be allocated * \return A new no memory exception @@ -127,10 +135,14 @@ @interface OFMemoryNotPartOfObjectException: OFException { void *pointer; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly) void *pointer; +#endif + /** * \param class_ The class of the object which caused the exception * \param ptr A pointer to the memory that is not part of the object * \return A new memory not part of object exception */ @@ -160,10 +172,14 @@ @interface OFNotImplementedException: OFException { SEL selector; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly) SEL selector; +#endif + /** * \param class_ The class of the object which caused the exception * \param selector The selector which is not or not fully implemented * \return A new not implemented exception */ @@ -177,10 +193,15 @@ * \param selector The selector which is not or not fully implemented * \return An initialized not implemented exception */ - initWithClass: (Class)class_ selector: (SEL)selector; + +/** + * \return The selector which is not or not fully implemented + */ +- (SEL)selector; @end /** * \brief An exception indicating the given value is out of range. */ @@ -192,10 +213,14 @@ */ @interface OFInvalidArgumentException: OFException { SEL selector; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) SEL selector; +#endif /** * \param class_ The class of the object which caused the exception * \param selector The selector which doesn't accept the argument * \return A new invalid argument exception @@ -210,10 +235,15 @@ * \param selector The selector which doesn't accept the argument * \return An initialized invalid argument exception */ - initWithClass: (Class)class_ selector: (SEL)selector; + +/** + * \return The selector to which an invalid argument was passed + */ +- (SEL)selector; @end /** * \brief An exception indicating that the encoding is invalid for this object. */ @@ -246,10 +276,16 @@ { OFString *path; OFString *mode; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *path; +@property (readonly, nonatomic) OFString *mode; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param path A string with the path of the file tried to open * \param mode A string with the mode in which the file should have been opened @@ -293,10 +329,15 @@ @interface OFReadOrWriteFailedException: OFException { size_t requestedSize; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) size_t requestedSize; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param size The requested size of the data that couldn't be read / written * \return A new open file failed exception @@ -343,10 +384,14 @@ @interface OFSeekFailedException: OFException { int errNo; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly) int errNo; +#endif + /** * \return The errno from when the exception was created */ - (int)errNo; @end @@ -357,10 +402,15 @@ @interface OFCreateDirectoryFailedException: OFException { OFString *path; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *path; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param path A string with the path of the directory which couldn't be created * \return A new create directory failed exception @@ -396,10 +446,16 @@ { OFString *path; mode_t mode; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *path; +@property (readonly) mode_t mode; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param path The path of the file * \param mode The new mode for the file @@ -446,10 +502,17 @@ OFString *path; uid_t owner; gid_t group; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *path; +@property (readonly) uid_t owner; +@property (readonly) gid_t group; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param path The path of the file * \param owner The new owner for the file @@ -505,10 +568,16 @@ OFString *sourcePath; OFString *destinationPath; int errNo; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *sourcePath; +@property (readonly, nonatomic) OFString *destinationPath; +@property (readonly) int errNo; +#endif + /** * \param class_ The class of the object which caused the exception * \param src The original path * \param dst The new path * \return A new rename file failed exception @@ -552,10 +621,15 @@ { OFString *path; int errNo; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *path; +@property (readonly) int errNo; +#endif + /** * \param class_ The class of the object which caused the exception * \param path The path of the file * \return A new delete file failed exception */ @@ -591,10 +665,16 @@ { OFString *sourcePath; OFString *destinationPath; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *sourcePath; +@property (readonly, nonatomic) OFString *destinationPath; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param src The source for the link * \param dest The destination for the link @@ -639,10 +719,16 @@ { OFString *sourcePath; OFString *destinationPath; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *sourcePath; +@property (readonly, nonatomic) OFString *destinationPath; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param src The source for the symlink * \param dest The destination for the symlink @@ -708,10 +794,16 @@ OFString *node; OFString *service; int errNo; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *node; +@property (readonly, nonatomic) OFString *service; +@property (readonly) int errNo; +#endif + /** * \param class_ The class of the object which caused the exception * \param node The node for which translation was requested * \param service The service of the node for which translation was requested * \return A new address translation failed exception @@ -755,10 +847,16 @@ { OFString *node; OFString *service; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *node; +@property (readonly, nonatomic) OFString *service; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param node The node to which the connection failed * \param service The service on the node to which the connection failed @@ -804,10 +902,17 @@ OFString *node; OFString *service; int family; int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, nonatomic) OFString *node; +@property (readonly, nonatomic) OFString *service; +@property (readonly) int family; +@property (readonly) int errNo; +#endif /** * \param class_ The class of the object which caused the exception * \param node The node on which binding failed * \param service The service on which binding failed @@ -861,10 +966,15 @@ { int backLog; int errNo; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly) int backLog; +@property (readonly) int errNo; +#endif + /** * \param class_ The class of the object which caused the exception * \param backlog The requested size of the back log * \return A new listen failed exception */ @@ -897,10 +1007,14 @@ */ @interface OFAcceptFailedException: OFException { int errNo; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) int errNo; +#endif /** * \return The errno from when the exception was created */ - (int)errNo; Index: src/OFExceptions.m ================================================================== --- src/OFExceptions.m +++ src/OFExceptions.m @@ -247,10 +247,15 @@ @"The method %s of class %s is not or not fully implemented!", sel_getName(selector), [inClass className]]; return string; } + +- (SEL)selector +{ + return selector; +} @end @implementation OFOutOfRangeException - (OFString*)string { @@ -297,10 +302,15 @@ @"The argument for method %s of class %s is invalid!", sel_getName(selector), [inClass className]]; return string; } + +- (SEL)selector +{ + return selector; +} @end @implementation OFInvalidEncodingException - (OFString*)string { Index: src/OFHashes.h ================================================================== --- src/OFHashes.h +++ src/OFHashes.h @@ -23,10 +23,14 @@ @interface OFHash: OFObject { BOOL calculated; } +#ifdef OF_HAVE_PROPERTIES +@property (readonly) BOOL calculated; +#endif + /** * Adds a buffer to the hash to be calculated. * * \param buf The buffer which should be included into the calculation. * \param size The size of the buffer @@ -37,10 +41,15 @@ /** * \return A buffer containing the hash. The size of the buffer is depending * on the hash used. The buffer is part of object's memory pool. */ - (uint8_t*)digest; + +/** + * \return A boolean whether the hash has already been calculated + */ +- (BOOL)calculated; @end /** * \brief A class which provides functions to create an MD5 hash. */ Index: src/OFHashes.m ================================================================== --- src/OFHashes.m +++ src/OFHashes.m @@ -31,10 +31,15 @@ - (uint8_t*)digest { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } + +- (BOOL)calculated +{ + return calculated; +} @end /* * MD5 */ Index: src/OFList.h ================================================================== --- src/OFList.h +++ src/OFList.h @@ -33,10 +33,16 @@ { of_list_object_t *first; of_list_object_t *last; size_t count; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly) of_list_object_t *first; +@property (readonly) of_list_object_t *last; +@property (readonly) size_t count; +#endif /** * \return A new autoreleased OFList */ + list; Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -25,10 +25,17 @@ OFString *prefix; OFString *name; OFString *namespace; OFString *stringValue; } + +#ifdef OF_HAVE_PROPERTIES +@property (readonly, retain) OFString *prefix; +@property (readonly, retain) OFString *name; +@property (readonly, retain) OFString *namespace; +@property (readonly, retain) OFString *stringValue; +#endif /** * \param name The name of the attribute * \param prefix The prefix of the attribute * \param ns The namespace of the attribute Index: src/objfw-defs.h.in ================================================================== --- src/objfw-defs.h.in +++ src/objfw-defs.h.in @@ -3,12 +3,13 @@ #undef OF_BIG_ENDIAN #undef OF_GNU_RUNTIME #undef OF_HAVE_ASPRINTF #undef OF_HAVE_GCC_ATOMIC_OPS #undef OF_HAVE_LIBKERN_OSATOMIC_H +#undef OF_HAVE_PROPERTIES #undef OF_HAVE_PTHREADS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_SCHED_YIELD #undef OF_OBJFW_RUNTIME #undef OF_PLUGINS #undef OF_THREADS #undef SIZE_MAX