@@ -135,71 +135,33 @@ * @param string A string to initialize the OFString with * @return A new autoreleased OFString */ + (instancetype)stringWithString: (OFString*)string; -/*! - * @brief Creates a new OFString from a unicode string. - * - * @param string The unicode string - * @return A new autoreleased OFString - */ -+ (instancetype)stringWithUnicodeString: (const of_unichar_t*)string; - -/*! - * @brief Creates a new OFString from a unicode string, assuming the specified - * byte order if no BOM is found. - * - * @param string The unicode string - * @param byteOrder The byte order to assume if there is no BOM - * @return A new autoreleased OFString - */ -+ (instancetype)stringWithUnicodeString: (const of_unichar_t*)string - byteOrder: (of_byte_order_t)byteOrder; - /*! * @brief Creates a new OFString from a unicode string with the specified * length. * - * @param string The unicode string - * @param length The length of the unicode string + * @param characters An array of unicode characters + * @param length The length of the unicode character array * @return A new autoreleased OFString */ -+ (instancetype)stringWithUnicodeString: (const of_unichar_t*)string - length: (size_t)length; ++ (instancetype)stringWithCharacters: (const of_unichar_t*)characters + length: (size_t)length; /*! * @brief Creates a new OFString from a unicode string with the specified * length, assuming the specified byte order if no BOM is found. * - * @param string The unicode string - * @param byteOrder The byte order to assume if there is no BOM - * @param length The length of the unicode string - * @return A new autoreleased OFString - */ -+ (instancetype)stringWithUnicodeString: (const of_unichar_t*)string - byteOrder: (of_byte_order_t)byteOrder - length: (size_t)length; - -/*! - * @brief Creates a new OFString from a big endian UTF-16 encoded string. - * - * @param string The UTF-16 string - * @return A new autoreleased OFString - */ -+ (instancetype)stringWithUTF16String: (const uint16_t*)string; - -/*! - * @brief Creates a new OFString from a UTF-16 encoded string, assuming the - * specified byte order if no BOM is found. - * - * @param string The UTF-16 string - * @param byteOrder The byte order to assume if there is no BOM - * @return A new autoreleased OFString - */ -+ (instancetype)stringWithUTF16String: (const uint16_t*)string - byteOrder: (of_byte_order_t)byteOrder; + * @param characters An array of unicode characters + * @param length The length of the unicode character array + * @param byteOrder The byte order to assume if there is no BOM + * @return A new autoreleased OFString + */ ++ (instancetype)stringWithCharacters: (const of_unichar_t*)characters + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Creates a new OFString from a big endian UTF-16 encoded string with * the specified length. * @@ -214,17 +176,17 @@ * @brief Creates a new OFString from a UTF-16 encoded string with the * specified length, assuming the specified byte order if no BOM is * found. * * @param string The UTF-16 string - * @param byteOrder The byte order to assume if there is no BOM * @param length The length of the unicode string + * @param byteOrder The byte order to assume if there is no BOM * @return A new autoreleased OFString */ + (instancetype)stringWithUTF16String: (const uint16_t*)string - byteOrder: (of_byte_order_t)byteOrder - length: (size_t)length; + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Creates a new OFString from a format string. * * See printf for the format syntax. As an addition, %@ is available as format @@ -352,72 +314,34 @@ * @param string A string to initialize the OFString with * @return An initialized OFString */ - initWithString: (OFString*)string; -/*! - * @brief Initializes an already allocated OFString with a unicode string. - * - * @param string The unicode string - * @return An initialized OFString - */ -- initWithUnicodeString: (const of_unichar_t*)string; - -/*! - * @brief Initializes an already allocated OFString with a unicode string, - * assuming the specified byte order if no BOM is found. - * - * @param string The unicode string - * @param byteOrder The byte order to assume if there is no BOM - * @return An initialized OFString - */ -- initWithUnicodeString: (const of_unichar_t*)string - byteOrder: (of_byte_order_t)byteOrder; - /*! * @brief Initializes an already allocated OFString with a unicode string with * the specified length. * - * @param string The unicode string - * @param length The length of the unicode string + * @param characters An array of unicode characters + * @param length The length of the unicode character array * @return An initialized OFString */ -- initWithUnicodeString: (const of_unichar_t*)string - length: (size_t)length; +- initWithCharacters: (const of_unichar_t*)characters + length: (size_t)length; /*! * @brief Initializes an already allocated OFString with a unicode string with * the specified length, assuming the specified byte order if no BOM is * found. * - * @param string The unicode string - * @param byteOrder The byte order to assume if there is no BOM - * @param length The length of the unicode string - * @return An initialized OFString - */ -- initWithUnicodeString: (const of_unichar_t*)string - byteOrder: (of_byte_order_t)byteOrder - length: (size_t)length; - -/*! - * @brief Initializes an already allocated OFString with a UTF-16 string. - * - * @param string The UTF-16 string - * @return An initialized OFString - */ -- initWithUTF16String: (const uint16_t*)string; - -/*! - * @brief Initializes an already allocated OFString with a UTF-16 string, - * assuming the specified byte order if no BOM is found. - * - * @param string The UTF-16 string - * @param byteOrder The byte order to assume if there is no BOM - * @return An initialized OFString - */ -- initWithUTF16String: (const uint16_t*)string - byteOrder: (of_byte_order_t)byteOrder; + * @param characters An array of unicode characters + * @param length The length of the unicode character array + * @param byteOrder The byte order to assume if there is no BOM + * @return An initialized OFString + */ +- initWithCharacters: (const of_unichar_t*)characters + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length. * @@ -432,17 +356,17 @@ * @brief Initializes an already allocated OFString with a UTF-16 string with * the specified length, assuming the specified byte order if no BOM is * found. * * @param string The UTF-16 string - * @param byteOrder The byte order to assume if there is no BOM * @param length The length of the UTF-16 string + * @param byteOrder The byte order to assume if there is no BOM * @return An initialized OFString */ - initWithUTF16String: (const uint16_t*)string - byteOrder: (of_byte_order_t)byteOrder - length: (size_t)length; + length: (size_t)length + byteOrder: (of_byte_order_t)byteOrder; /*! * @brief Initializes an already allocated OFString with a format string. * * See printf for the format syntax. As an addition, %@ is available as format @@ -907,11 +831,11 @@ * use the result outside the scope of the current autorelease pool, you have to * copy it. * * @return The string as an array of Unicode characters */ -- (const of_unichar_t*)unicodeString OF_RETURNS_INNER_POINTER; +- (const of_unichar_t*)characters OF_RETURNS_INNER_POINTER; /*! * @brief Returns the string in big endian UTF-16 encoding. * * The result is valid until the autorelease pool is released. If you want to @@ -956,10 +880,8 @@ #ifdef __cplusplus extern "C" { #endif extern size_t of_string_utf8_encode(of_unichar_t, char*); extern size_t of_string_utf8_decode(const char*, size_t, of_unichar_t*); -extern size_t of_string_utf16_length(const uint16_t*); -extern size_t of_string_unicode_length(const of_unichar_t*); #ifdef __cplusplus } #endif