Index: src/OFConstantString.m ================================================================== --- src/OFConstantString.m +++ src/OFConstantString.m @@ -51,18 +51,18 @@ @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding; + encoding: (of_string_encoding_t)encoding; { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding length: (size_t)len { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } Index: src/OFNumber.h ================================================================== --- src/OFNumber.h +++ src/OFNumber.h @@ -16,11 +16,14 @@ #include #import "OFObject.h" -enum of_number_type { +/** + * \brief The type of a number. + */ +typedef enum of_number_type_t { OF_NUMBER_BOOL, OF_NUMBER_CHAR, OF_NUMBER_SHORT, OF_NUMBER_INT, OF_NUMBER_LONG, @@ -43,11 +46,11 @@ OF_NUMBER_PTRDIFF, OF_NUMBER_INTPTR, OF_NUMBER_UINTPTR, OF_NUMBER_FLOAT, OF_NUMBER_DOUBLE, -}; +} of_number_type_t; /** * \brief Provides a way to store a number in an object. */ @interface OFNumber: OFObject @@ -78,11 +81,11 @@ intptr_t intptr; uintptr_t uintptr; float float_; double double_; } value; - enum of_number_type type; + of_number_type_t type; } /** * \param bool_ A BOOL which the OFNumber should contain * \return A new autoreleased OFNumber @@ -446,14 +449,13 @@ * \return An initialized OFNumber */ - initWithDouble: (double)double_; /** - * \return An enum of type of_number_type indicating the type of contained - * number of the OFNumber + * \return An of_number_type_t indicating the type of the number */ -- (enum of_number_type)type; +- (of_number_type_t)type; /** * \return The OFNumber as a BOOL */ - (BOOL)boolValue; Index: src/OFNumber.m ================================================================== --- src/OFNumber.m +++ src/OFNumber.m @@ -700,11 +700,11 @@ type = OF_NUMBER_DOUBLE; return self; } -- (enum of_number_type)type +- (of_number_type_t)type { return type; } - (BOOL)boolValue Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -15,12 +15,12 @@ */ #include #import "OFObject.h" +#import "OFString.h" -@class OFString; @class OFDataArray; /** * \brief A base class for different types of streams. * @@ -183,11 +183,11 @@ * * \param encoding The encoding used by the stream * \return The line that was read, autoreleased, or nil if the end of the * stream has been reached. */ -- (OFString*)readLineWithEncoding: (enum of_string_encoding)encoding; +- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding; /** * Read until the specified string or \\0 is found or the end of stream occurs. * * \param delimiter The delimiter @@ -203,11 +203,11 @@ * \param encoding The encoding used by the stream * \return The line that was read, autoreleased, or nil if the end of the * stream has been reached. */ - (OFString*)readTillDelimiter: (OFString*)delimiter - withEncoding: (enum of_string_encoding)encoding; + withEncoding: (of_string_encoding_t)encoding; /** * \return A boolean whether writes are buffered */ - (BOOL)buffersWrites; Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -252,11 +252,11 @@ - (OFString*)readLine { return [self readLineWithEncoding: OF_STRING_ENCODING_UTF_8]; } -- (OFString*)readLineWithEncoding: (enum of_string_encoding)encoding +- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding { size_t i, len, ret_len; char *ret_c, *tmp, *tmp2; OFString *ret; @@ -400,11 +400,11 @@ return [self readTillDelimiter: delimiter withEncoding: OF_STRING_ENCODING_UTF_8]; } - (OFString*)readTillDelimiter: (OFString*)delimiter - withEncoding: (enum of_string_encoding)encoding + withEncoding: (of_string_encoding_t)encoding { const char *delim; size_t i, j, delim_len, len, ret_len; char *ret_c, *tmp, *tmp2; OFString *ret; Index: src/OFString.h ================================================================== --- src/OFString.h +++ src/OFString.h @@ -19,16 +19,19 @@ #import "OFObject.h" typedef uint32_t of_unichar_t; -enum of_string_encoding { +/** + * \brief The encoding of a string. + */ +typedef enum of_string_encoding_t { OF_STRING_ENCODING_UTF_8, OF_STRING_ENCODING_ISO_8859_1, OF_STRING_ENCODING_ISO_8859_15, OF_STRING_ENCODING_WINDOWS_1252 -}; +} of_string_encoding_t; extern int of_string_check_utf8(const char*, size_t); extern size_t of_string_unicode_to_utf8(of_unichar_t, char*); extern size_t of_string_utf8_to_unicode(const char*, size_t, of_unichar_t*); extern size_t of_string_position_to_index(const char*, size_t); @@ -68,11 +71,11 @@ * \param str A C string to initialize the OFString with * \param encoding The encoding of the C string * \return A new autoreleased OFString */ + stringWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding; + encoding: (of_string_encoding_t)encoding; /** * Creates a new OFString from a C string with the specified encoding and * length. * @@ -80,11 +83,11 @@ * \param encoding The encoding of the C string * \param len The length of the C string * \return A new autoreleased OFString */ + stringWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding length: (size_t)len; /** * Creates a new OFString from a UTF-8 encoded C string with the specified * length. @@ -136,11 +139,11 @@ * \param path The path to the file * \param encoding The encoding of the file * \return A new autoreleased OFString */ + stringWithContentsOfFile: (OFString*)path - encoding: (enum of_string_encoding)encoding; + encoding: (of_string_encoding_t)encoding; /** * Initializes an already allocated OFString from a UTF-8 encoded C string. * * \param str A UTF-8 encoded C string to initialize the OFString with @@ -155,11 +158,11 @@ * \param str A C string to initialize the OFString with * \param encoding The encoding of the C string * \return An initialized OFString */ - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding; + encoding: (of_string_encoding_t)encoding; /** * Initializes an already allocated OFString from a C string with the specified * encoding and length. * @@ -167,11 +170,11 @@ * \param encoding The encoding of the C string * \param len The length of the C string * \return An initialized OFString */ - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding length: (size_t)len; /** * Initializes an already allocated OFString from a UTF-8 encoded C string with * the specified length. @@ -247,11 +250,11 @@ * \param path The path to the file * \param encoding The encoding of the file * \return An initialized OFString */ - initWithContentsOfFile: (OFString*)path - encoding: (enum of_string_encoding)encoding; + encoding: (of_string_encoding_t)encoding; /** * \return The OFString as a UTF-8 encoded C string */ - (const char*)cString; Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -240,18 +240,18 @@ { return [[[self alloc] initWithCString: str] autorelease]; } + stringWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding { return [[[self alloc] initWithCString: str encoding: encoding] autorelease]; } + stringWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding length: (size_t)len { return [[[self alloc] initWithCString: str encoding: encoding length: len] autorelease]; @@ -299,11 +299,11 @@ { return [[[self alloc] initWithContentsOfFile: path] autorelease]; } + stringWithContentsOfFile: (OFString*)path - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding { return [[[self alloc] initWithContentsOfFile: path encoding: encoding] autorelease]; } @@ -313,19 +313,19 @@ encoding: OF_STRING_ENCODING_UTF_8 length: strlen(str)]; } - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding { return [self initWithCString: str encoding: encoding length: strlen(str)]; } - initWithCString: (const char*)str - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding length: (size_t)len { self = [super init]; @try { @@ -617,11 +617,11 @@ return [self initWithContentsOfFile: path encoding: OF_STRING_ENCODING_UTF_8]; } - initWithContentsOfFile: (OFString*)path - encoding: (enum of_string_encoding)encoding + encoding: (of_string_encoding_t)encoding { self = [super init]; @try { OFFile *file;