@@ -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;