Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -13,11 +13,11 @@ #import "OFDataArray.h" /** * The OFArray class provides a class for storing objects in an array. */ -@interface OFArray: OFObject +@interface OFArray: OFObject { OFDataArray *array; } /** @@ -33,17 +33,10 @@ /** * \return The objects of the array as a C array */ - (id*)data; -/** - * Clones the OFArray, creating a new one. - * - * \return A new autoreleased copy of the OFArray - */ -- (id)copy; - /** * Returns a specific object of the OFDataArray. * * \param index The number of the object to return * \return The specified object of the OFArray Index: src/OFDataArray.h ================================================================== --- src/OFDataArray.h +++ src/OFDataArray.h @@ -16,11 +16,11 @@ * array. * * If you plan to store large hunks of data, you should consider using * OFBigDataArray, which allocates the memory in pages rather than in bytes. */ -@interface OFDataArray: OFObject +@interface OFDataArray: OFObject { char *data; size_t itemsize; size_t count; } @@ -64,17 +64,10 @@ /** * \return All elements of the OFDataArray */ - (void*)data; -/** - * Clones the OFDataArray, creating a new one. - * - * \return A new autoreleased copy of the OFDataArray - */ -- (id)copy; - /** * Compares the OFDataArray to another object. * * \param obj An object to compare with * \return An integer which is the result of the comparison, see for example @@ -117,10 +110,10 @@ * \param nitems The number of items to remove */ - removeNItems: (size_t)nitems; @end -@interface OFBigDataArray: OFDataArray +@interface OFBigDataArray: OFDataArray { size_t size; } @end Index: src/OFObject.h ================================================================== --- src/OFObject.h +++ src/OFObject.h @@ -116,10 +116,11 @@ */ - (BOOL)isEqual: (id)obj; /** * Calculate a hash for the object. + * * Classes containing data (like strings, arrays, lists etc.) should reimplement * this! * * \return A 32 bit hash for the object */ @@ -209,5 +210,15 @@ * Deallocates the object and also frees all memory allocated via its memory * pool. */ - (void)dealloc; @end + +/** + * Objects implementing this protocol can be copied. + */ +@protocol OFCopying +/** + * \return A copy of the object + */ +- (id)copy; +@end Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -16,11 +16,11 @@ #import "OFArray.h" /** * A class for managing strings. */ -@interface OFString: OFObject +@interface OFString: OFObject { char *string; #ifdef __objc_INCLUDE_GNU unsigned int length; #else @@ -79,17 +79,10 @@ /** * \return The length of the OFString */ - (size_t)length; -/** - * Clones the OFString, creating a new one. - * - * \return A new autoreleased copy of the OFString as a OFMutableString - */ -- (id)copy; - /** * Compares the OFString to another object. * * \param obj An object to compare with * \return An integer which is the result of the comparison, see for example