Index: src/OFArray.h ================================================================== --- src/OFArray.h +++ src/OFArray.h @@ -75,20 +75,20 @@ * \param item An arbitrary item */ - add: (void*)item; /** - * Adds items from a C array to the OFArray + * 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 + * Removes a specified amount of the last items from the OFArray. * * \param nitems The number of items to remove */ - removeNItems: (size_t)nitems; @end @@ -120,20 +120,20 @@ * \return An initialized OFBigArray */ - initWithItemSize: (size_t)is; /** - * Adds items from a C array to the OFBigArray + * Adds items from a C array to the OFBigArray. * * \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 OFBigArray + * Removes a specified amount of the last items from the OFBigArray. * * \param nitems The number of items to remove */ - removeNItems: (size_t)nitems; @end Index: src/OFCString.h ================================================================== --- src/OFCString.h +++ src/OFCString.h @@ -23,22 +23,22 @@ } /** * Initializes an already allocated OFCString. * - * \param str A C string to initialize the OFCString with. - * \returns An initialized OFCString + * \param str A C string to initialize the OFCString with + * \return An initialized OFCString */ - initAsCString: (char*)str; /** - * \return The OFCString as a C string. + * \return The OFCString as a C string */ - (char*)cString; /** - * \return The length of the OFCString. + * \return The length of the OFCString */ - (size_t)length; /** * Clones the OFCString, creating a new one. @@ -49,11 +49,11 @@ /** * 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. + * \return An integer which is the result of the comparison, see strcmp */ - (int)compareTo: (OFString*)str; /** * Append another OFString to the OFCString. Index: src/OFConstCString.h ================================================================== --- src/OFConstCString.h +++ src/OFConstCString.h @@ -21,22 +21,22 @@ } /** * Initializes an already allocated OFConstCString. * - * \param str A constant C string to initialize the OFConstCString with. - * \returns An initialized OFConstCString + * \param str A constant C string to initialize the OFConstCString with + * \return An initialized OFConstCString */ - initAsConstCString: (const char*)str; /** - * \return The OFConstCString as a constant C string. + * \return The OFConstCString as a constant C strin */ - (const char*)cString; /** - * \return The length of the OFConstCString. + * \return The length of the OFConstCString */ - (size_t)length; /** * Clones the OFConstCString, creating a new one. @@ -47,9 +47,9 @@ /** * Compares the OFConstCString 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. + * \return An integer which is the result of the comparison, see strcmp */ - (int)compareTo: (OFString*)str; @end Index: src/OFConstWideCString.h ================================================================== --- src/OFConstWideCString.h +++ src/OFConstWideCString.h @@ -24,22 +24,22 @@ /** * Initializes an already allocated OFConstWideCString. * * \param str A constant wide C string to initialize the OFConstWideCString - * with. - * \returns An initialized OFConstWideCString + * with + * \return An initialized OFConstWideCString */ -- initAsConstWideCString: (const wchar_t*)wstr; +- initAsConstWideCString: (const wchar_t*)str; /** - * \return The OFConstWideCString as a constant wide C string. + * \return The OFConstWideCString as a constant wide C string */ - (const wchar_t*)wcString; /** - * \return The length of the OFConstWideCString. + * \return The length of the OFConstWideCString */ - (size_t)length; /** * Clones the OFConstWideCString, creating a new one. @@ -50,9 +50,9 @@ /** * Compares the OFConstWideCString 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 wcscmp. + * \return An integer which is the result of the comparison, see wcscmp */ - (int)compareTo: (OFString*)str; @end Index: src/OFExceptions.h ================================================================== --- src/OFExceptions.h +++ src/OFExceptions.h @@ -10,35 +10,90 @@ */ #import #import "OFObject.h" -// FIXME: Exceptions should include which type of error occoured (fopen etc.) +/* FIXME: Exceptions should include which type of error occoured (fopen etc.) */ +/** + * The OFException class is the base class for all exceptions in ObjFW. + */ @interface OFException: OFObject { id object; char *string; } +/** + * Creates a new exception. + * + * \param obj The object which caused the exception + * \return A new exception + */ + newWithObject: (id)obj; + +/** + * Initializes an already allocated OFException. + * + * \param obj The object which caused the exception + * \return An initialized OFException + */ - initWithObject: (id)obj; + +/** + * Frees an OFException and the memory it allocated. + */ - free; + +/** + * Raises an OFException and aborts execution if the exception is not caught. + */ + - raise; + +/** + * \return An error message for the exception as a C String + */ - (char*)cString; @end +/** + * An OFException indicating there is not enough memory available. + */ @interface OFNoMemException: OFException { size_t req_size; } +/** + * Creates a new no memory exception. + * + * \param obj The object which caused the exception + * \param size The size of the memory that couldn't be allocated + * \return A new no memory exception + */ + newWithObject: (id)obj andSize: (size_t)size; + +/** + * Initializes an already allocated no memory exception. + * + * \param obj The object which caused the exception + * \param size The size of the memory that couldn't be allocated + * \return An initialized new no memory exception + */ - initWithObject: (id)obj andSize: (size_t)size; + +/** + * \return An error message for the exception as a C String + */ - (char*)cString; + +/** + * \return The size of the memoory that couldn't be allocated + */ - (size_t)requestedSize; @end @interface OFNotImplementedException: OFException { Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -12,21 +12,93 @@ #import #import #import "OFObject.h" +/** + * The OFString class can store and modify string of different types. + */ @interface OFString: OFObject +/** + * \param str A constant C string from which the new OFConstCString will be + * created + * \return A new OFConstCString + */ + newAsConstCString: (const char*)str; + +/** + * \param str A constant wide C string from which the new OFConstCString will be + * created + * \return A new OFConstWideCString + */ + newAsConstWideCString: (const wchar_t*)str; + +/** + * \param str A C string from which the new OFConstCString will be created + * \return A new OFCString + */ + newAsCString: (char*)str; + +/** + * \param str A wide C string from which the new OFConstCString will be created + * \return A new OFWideCString + */ + newAsWideCString: (wchar_t*)str; +/** + * \return The OFString as a C-type string of the type it was created as + */ - (char*)cString; + +/** + * \return The OFString as a C-type wide string of the type it was created as + */ - (wchar_t*)wcString; + +/** + * \return The length of the OFString + */ - (size_t)length; + +/** + * Sets the OFString to the specified OFString. + * + * \param str The OFString to set the current OFString to + */ - (OFString*)setTo: (OFString*)str; + +/** + * Clones the OFString, creating a new one. + * + * \return A copy of the OFString + */ - (OFString*)clone; + +/** + * Compares the OFString 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; + +/** + * Append another OFString to the OFString. + * + * \param str An OFString in a compatible type to append + */ - append: (OFString*)str; + +/** + * Append a C string to the OFString. + * + * \param str A C string to append + */ - appendCString: (const char*)str; + +/** + * Append a wide C string to the OFString. + * + * \param str A wide C string to append + */ - appendWideCString: (const wchar_t*)str; @end Index: src/OFWideCString.h ================================================================== --- src/OFWideCString.h +++ src/OFWideCString.h @@ -24,22 +24,22 @@ } /** * Initializes an already allocated OFWideCString. * - * \param str A wide C string to initialize the OFWideCString with. - * \returns An initialized OFWideCString + * \param str A wide C string to initialize the OFWideCString with + * \return An initialized OFWideCString */ - initAsWideCString: (wchar_t*)str; /** - * \return The OFWideCString as a wide C string. + * \return The OFWideCString as a wide C string */ - (wchar_t*)wcString; /** - * \return The length of the OFWideCString. + * \return The length of the OFWideCString */ - (size_t)length; /** * Clones the OFWideCString, creating a new one. @@ -50,11 +50,11 @@ /** * Compares the OFWideCString 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 wcscmp. + * \return An integer which is the result of the comparison, see wcscmp */ - (int)compareTo: (OFString*)str; /** * Append another OFString to the OFWideCString.