ADDED doxygen.cfg Index: doxygen.cfg ================================================================== --- doxygen.cfg +++ doxygen.cfg @@ -0,0 +1,6 @@ +PROJECT_NAME = "ObjFW" +OUTPUT_DIRECTORY = docs/ +INPUT = src +FILE_PATTERNS = *.h *.m +HTML_OUTPUT = . +GENERATE_LATEX = NO Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -11,34 +11,96 @@ #import #import "OFObject.h" +/** + * The OFArray class provides a class for storing dynamically sized arrays. + * If you plan to store large hunks of data, you should consider using + * OFBigArray, which allocates the memory in pages and not in bytes. + */ @interface OFArray: OFObject { char *data; size_t itemsize; size_t items; } +/** + * Creates a new OFArray whose items all have the same size. + * + * \param is The size of each element in the OFArray + * \return A new allocated and initialized OFArray + */ + newWithItemSize: (size_t)is; + +/** + * Initializes an already allocated OFArray whose items all have the same size. + * + * \param is The size of each element in the OFArray + * \return An initialized OFArray + */ - initWithItemSize: (size_t)is; + +/** + * \return The number of items in the OFArray + */ - (size_t)items; + +/** + * \return The size of each item in the OFArray in bytes + */ +- (size_t)itemsize; + +/** + * \return All elements of the OFArray + */ - (void*)data; + +/** + * Returns a specific item of the OFArray. + * + * \param item The number of the item to return + * \return The specified item of the OFArray + */ - (void*)item: (size_t)item; + +/** + * \return The last item of the OFArray + */ - (void*)last; + +/** + * Adds an item to the OFArray. + * + * \param item An arbitrary item + */ - add: (void*)item; + +/** + * Adds items from a C array to the OFArray + * + * \param nitems The number of items to add + * \param carray A C array containing the items to add + */ - addNItems: (size_t)nitems fromCArray: (void*)carray; + +/** + * Removes the last items from the OFArray + * + * \param nitems The number of items to remove + */ - removeNItems: (size_t)nitems; @end @interface OFBigArray: OFArray { size_t size; } -- initWithSize: (size_t)is; ++ newWithItemSize: (size_t)is; +- initWithItemSize: (size_t)is; - addNItems: (size_t)nitems fromCArray: (void*)carray; - removeNItems: (size_t)nitems; @end Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -103,11 +103,16 @@ return self; } @end @implementation OFBigArray -- initWithSize: (size_t)is ++ newWithItemSize: (size_t)is +{ + return [[OFBigArray alloc] initWithItemSize: is]; +} + +- initWithItemSize: (size_t)is { if ((self = [super init])) size = 0; return self; Index: src/OFCString.h ================================================================== --- src/OFCString.h +++ src/OFCString.h @@ -11,19 +11,61 @@ #import #import "OFString.h" +/** + * An OFString using a C string as internal storage. + */ @interface OFCString: OFString { char *string; size_t length; } +/** + * Initializes an already allocated OFCString. + * + * \param str A C string to initialize the OFCString with. + * \returns An initialized OFCString + */ - initAsCString: (char*)str; + +/** + * \return The OFCString as a C string. + */ - (char*)cString; + +/** + * \return The length of the OFCString. + */ - (size_t)length; + +/** + * Clones the OFCString, creating a new one. + * + * \return A copy of the OFCString + */ - (OFString*)clone; + +/** + * Compares the OFCString to another OFString. + * + * \param str An OFString in a compatible type to compare with + * \return An integer which is the result of the comparison, see strcmp. + */ - (int)compareTo: (OFString*)str; -- (OFString*)append: (OFString*)str; -- (OFString*)appendCString: (const char*)str; + +/** + * Append another OFString to the OFCString. + * + * \param str An OFString in a compatible type to append + */ +- append: (OFString*)str; + +/** + * Append a C string to the OFCString. + * + * \param str A C string to append + */ +- appendCString: (const char*)str; @end Index: src/OFCString.m ================================================================== --- src/OFCString.m +++ src/OFCString.m @@ -51,16 +51,16 @@ - (int)compareTo: (OFString*)str { return strcmp(string, [str cString]); } -- (OFString*)append: (OFString*)str +- append: (OFString*)str { return [self appendCString: [str cString]]; } -- (OFString*)appendCString: (const char*)str +- appendCString: (const char*)str { char *newstr; size_t newlen, strlength; if (string == NULL) Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -24,9 +24,9 @@ - (wchar_t*)wcString; - (size_t)length; - (OFString*)setTo: (OFString*)str; - (OFString*)clone; - (int)compareTo: (OFString*)str; -- (OFString*)append: (OFString*)str; -- (OFString*)appendCString: (const char*)str; -- (OFString*)appendWideCString: (const wchar_t*)str; +- append: (OFString*)str; +- appendCString: (const char*)str; +- appendWideCString: (const wchar_t*)str; @end Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -73,20 +73,20 @@ - (int)compareTo: (OFString*)str { OF_NOT_IMPLEMENTED(0) } -- (OFString*)append: (OFString*)str +- append: (OFString*)str { OF_NOT_IMPLEMENTED(nil) } -- (OFString*)appendCString: (const char*)str +- appendCString: (const char*)str { OF_NOT_IMPLEMENTED(nil) } -- (OFString*)appendWideCString: (const wchar_t*)str +- appendWideCString: (const wchar_t*)str { OF_NOT_IMPLEMENTED(nil) } @end Index: src/OFWideCString.h ================================================================== --- src/OFWideCString.h +++ src/OFWideCString.h @@ -23,8 +23,8 @@ - initAsWideCString: (wchar_t*)str; - (wchar_t*)wcString; - (size_t)length; - (OFString*)clone; - (int)compareTo: (OFString*)str; -- (OFString*)append: (OFString*)str; -- (OFString*)appendWideCString: (const wchar_t*)str; +- append: (OFString*)str; +- appendWideCString: (const wchar_t*)str; @end Index: src/OFWideCString.m ================================================================== --- src/OFWideCString.m +++ src/OFWideCString.m @@ -53,16 +53,16 @@ - (int)compareTo: (OFString*)str { return wcscmp(string, [str wcString]); } -- (OFString*)append: (OFString*)str +- append: (OFString*)str { return [self appendWideCString: [str wcString]]; } -- (OFString*)appendWideCString: (const wchar_t*)str +- appendWideCString: (const wchar_t*)str { wchar_t *newstr; size_t newlen, strlength; if (string == NULL)