ObjFW  Diff

Differences From Artifact [78f3465255]:

To Artifact [4d41d466d8]:


71
72
73
74
75
76
77
78
79


80
81
82
83
84
85
86
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
71
72
73
74
75
76
77


78
79
80
81
82
83
84
85
86
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







-
-
+
+

















-
+


-
+








-
+






-
+

-
+


-
+

-
+





-
-
+
+


-
-
+
+







	 *
	 * The compiler generates an instance with a const char* and a size_t
	 * for each constant string. We change the const char* to point to our
	 * struct on the first call to a constant string so we can have more
	 * than those two ivars.
	 */
	struct of_string_ivars {
		char   *string;
		size_t length;
		char   *cString;
		size_t cStringLength;
		BOOL   isUTF8;
	} *restrict s;
	/*
	 * Unused in OFString, however, OFConstantString sets this to SIZE_MAX
	 * once it allocated and initialized the struct.
	 */
	size_t initialized;
}

/**
 * \return A new autoreleased OFString
 */
+ string;

/**
 * Creates a new OFString from a UTF-8 encoded C string.
 *
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param cString A UTF-8 encoded C string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)string;
+ stringWithCString: (const char*)cString;

/**
 * Creates a new OFString from a C string with the specified encoding.
 *
 * \param string A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)string
+ stringWithCString: (const char*)cString
	   encoding: (of_string_encoding_t)encoding;

/**
 * Creates a new OFString from a C string with the specified encoding and
 * length.
 *
 * \param string A C string to initialize the OFString with
 * \param cString A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param length The length of the C string
 * \param cStringLength The length of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)string
+ stringWithCString: (const char*)cString
	   encoding: (of_string_encoding_t)encoding
	     length: (size_t)length;
	     length: (size_t)cStringLength;

/**
 * Creates a new OFString from a UTF-8 encoded C string with the specified
 * length.
 *
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param length The length of the UTF-8 encoded C string
 * \param cString A UTF-8 encoded C string to initialize the OFString with
 * \param cStringLength The length of the UTF-8 encoded C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)string
	     length: (size_t)length;
+ stringWithCString: (const char*)cString
	     length: (size_t)cStringLength;

/**
 * Creates a new OFString from another string.
 *
 * \param string A string to initialize the OFString with
 * \return A new autoreleased OFString
 */
288
289
290
291
292
293
294
295

296
297
298

299
300
301
302
303
304

305
306
307
308

309
310
311
312
313
314
315

316
317

318
319
320

321
322

323
324
325
326
327
328
329


330
331
332
333


334
335
336
337
338
339
340
288
289
290
291
292
293
294

295
296
297

298
299
300
301
302
303

304
305
306
307

308
309
310
311
312
313
314

315
316

317
318
319

320
321

322
323
324
325
326
327


328
329
330
331


332
333
334
335
336
337
338
339
340







-
+


-
+





-
+



-
+






-
+

-
+


-
+

-
+





-
-
+
+


-
-
+
+







 */
+ stringWithContentsOfURL: (OFURL*)URL
		 encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string.
 *
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param cString A UTF-8 encoded C string to initialize the OFString with
 * \return An initialized OFString
 */
- initWithCString: (const char*)string;
- initWithCString: (const char*)cString;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding.
 *
 * \param string A C string to initialize the OFString with
 * \param cString A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)string
- initWithCString: (const char*)cString
	 encoding: (of_string_encoding_t)encoding;

/**
 * Initializes an already allocated OFString from a C string with the specified
 * encoding and length.
 *
 * \param string A C string to initialize the OFString with
 * \param cString A C string to initialize the OFString with
 * \param encoding The encoding of the C string
 * \param length The length of the C string
 * \param cStringLength The length of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)string
- initWithCString: (const char*)cString
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)length;
	   length: (size_t)cStringLength;

/**
 * Initializes an already allocated OFString from a UTF-8 encoded C string with
 * the specified length.
 *
 * \param string A UTF-8 encoded C string to initialize the OFString with
 * \param length The length of the UTF-8 encoded C string
 * \param cString A UTF-8 encoded C string to initialize the OFString with
 * \param cStringLength The length of the UTF-8 encoded C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)string
	   length: (size_t)length;
- initWithCString: (const char*)cString
	   length: (size_t)cStringLength;

/**
 * Initializes an already allocated OFString with another string.
 *
 * \param string A string to initialize the OFString with
 * \return An initialized OFString
 */