ObjFW  Diff

Differences From Artifact [086c316216]:

  • File src/OFMutableString.m — part of check-in [50916b8dbe] at 2013-01-11 12:41:54 on branch trunk — OFString: Improve API for characters / UTF-32.

    With this change, there is a clear separation between characters and
    UTF-32 strings now. Characters are just an array of characters in the
    native endianess, with no BOM prepended. UTF-32 on the other hand may
    have a BOM and can be swapped and is optionally zero-terminated.

    This also fixes a few missing UTF-16 init methods in OFMutableString. (user: js, size: 13084) [annotate] [blame] [check-ins using]

To Artifact [bfd221d698]:

  • File src/OFMutableString.m — part of check-in [545b6f740e] at 2013-01-13 13:07:52 on branch trunk — Add of_char{16,32}_t.

    For ObjC++, these are defined to char{16,32}_t if C++11 is used. This
    means passing e.g. a C++11 UTF-16 string to -[initWithUTF16String:]
    works without a warning.

    For C11, this is not necessary, as char{16,32}_t are just typedef'd to
    uint_least{16,32}_t in <uchar.h> and thus compatible to the definition
    of of_char{16,32}_t. The reason for not defining of_char{16,32}_t to
    char{16,32}_t when using C11 is that <uchar.h> might be missing and that
    char{16,32}_t are not required to be UTF-{16,32}, whereas in C++, they
    are required to be UTF-{16,32}. (user: js, size: 13108) [annotate] [blame] [check-ins using]


87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
- initWithCharacters: (const of_unichar_t*)characters
	      length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithCharacters: characters
							     length: length];
}

- initWithUTF16String: (const uint16_t*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string];
}

- initWithUTF16String: (const uint16_t*)string
	       length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string
							      length: length];
}

- initWithUTF16String: (const uint16_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
		      byteOrder: byteOrder];
}

- initWithUTF16String: (const uint16_t*)string
	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
			 length: length
		      byteOrder: byteOrder];
}

- initWithUTF32String: (const uint32_t*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string];
}

- initWithUTF32String: (const uint32_t*)string
	       length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string
							      length: length];
}

- initWithUTF32String: (const uint32_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF32String: string
		      byteOrder: byteOrder];
}

- initWithUTF32String: (const uint32_t*)string
	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF32String: string
			 length: length
		      byteOrder: byteOrder];







|




|






|







|









|




|






|







|







87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
- initWithCharacters: (const of_unichar_t*)characters
	      length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithCharacters: characters
							     length: length];
}

- initWithUTF16String: (const of_char16_t*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string];
}

- initWithUTF16String: (const of_char16_t*)string
	       length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF16String: string
							      length: length];
}

- initWithUTF16String: (const of_char16_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
		      byteOrder: byteOrder];
}

- initWithUTF16String: (const of_char16_t*)string
	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF16String: string
			 length: length
		      byteOrder: byteOrder];
}

- initWithUTF32String: (const of_char32_t*)string
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string];
}

- initWithUTF32String: (const of_char32_t*)string
	       length: (size_t)length
{
	return (id)[[OFMutableString_UTF8 alloc] initWithUTF32String: string
							      length: length];
}

- initWithUTF32String: (const of_char32_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF32String: string
		      byteOrder: byteOrder];
}

- initWithUTF32String: (const of_char32_t*)string
	       length: (size_t)length
	    byteOrder: (of_byte_order_t)byteOrder
{
	return (id)[[OFMutableString_UTF8 alloc]
	    initWithUTF32String: string
			 length: length
		      byteOrder: byteOrder];