ObjFW  Diff

Differences From Artifact [fad2ce5911]:

To Artifact [5e6b1ff86f]:


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







-
-













-
+


+
+
+
+
+
+
+
+
+
+
-
+
+







	 * Unused in OFString, however, OFConstantString sets this to SIZE_MAX
	 * once it allocated and initialized the struct.
	 */
	size_t initialized;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) const char *cString;
@property (readonly) size_t cStringLength;
@property (readonly) size_t length;
#endif

/**
 * \brief Creates a new OFString.
 *
 * \return A new, autoreleased OFString
 */
+ string;

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

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

/**
 * \brief 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
142
143
144
145
146
147
148











149
150
151
152
153
154
155







-
-
-
-
-
-
-
-
-
-
-







 * \param cStringLength The length of the C string
 * \return A new autoreleased OFString
 */
+ stringWithCString: (const char*)cString
	   encoding: (of_string_encoding_t)encoding
	     length: (size_t)cStringLength;

/**
 * \brief Creates a new OFString from a UTF-8 encoded C string with the
 *	  specified length.
 *
 * \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*)cString
	     length: (size_t)cStringLength;

/**
 * \brief Creates a new OFString from another string.
 *
 * \param string A string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithString: (OFString*)string;
307
308
309
310
311
312
313
314

315
316










317


318
319
320
321
322
323
324
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







-
+


+
+
+
+
+
+
+
+
+
+
-
+
+







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

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

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

/**
 * \brief Initializes an already allocated OFString from a C string with the
 *	  specified encoding.
 *
 * \param cString A C string to initialize the OFString with
 * \param encoding The encoding of the C string
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
345
346
347
348
349
350
351











352
353
354
355
356
357
358







-
-
-
-
-
-
-
-
-
-
-







 * \param cStringLength The length of the C string
 * \return An initialized OFString
 */
- initWithCString: (const char*)cString
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)cStringLength;

/**
 * \brief Initializes an already allocated OFString from a UTF-8 encoded C
 *	  string with the specified length.
 *
 * \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*)cString
	   length: (size_t)cStringLength;

/**
 * \brief Initializes an already allocated OFString with another string.
 *
 * \param string A string to initialize the OFString with
 * \return An initialized OFString
 */
- initWithString: (OFString*)string;
538
539
540
541
542
543
544
545

546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563

564
565

566
567

568
569
570
571
572
573
574
536
537
538
539
540
541
542

543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560

561
562

563
564

565
566
567
568
569
570
571
572







-
+

















-
+

-
+

-
+







	       encoding: (of_string_encoding_t)encoding;

/**
 * \brief Returns the OFString as a UTF-8 encoded C string.
 *
 * \return The OFString as a UTF-8 encoded C string
 */
- (const char*)cString;
- (const char*)UTF8String;

/**
 * \brief Returns the OFString as a C string in the specified encoding.
 *
 * \param encoding The encoding for the C string
 * \return The OFString as a C string in the specified encoding
 */
- (const char*)cStringWithEncoding: (of_string_encoding_t)encoding;;

/**
 * \brief Returns the length of the string in Unicode characters.
 *
 * \return The length of the string in Unicode characters
 */
- (size_t)length;

/**
 * \brief Returns the length of the string which cString would return.
 * \brief Returns the number of bytes the string needs in UTF-8 encoding.
 *
 * \return The length of the string which cString would return
 * \return The number of bytes the string needs in UTF-8 encoding.
 */
- (size_t)cStringLength;
- (size_t)UTF8StringLength;

/**
 * \brief Returns the number of bytes the string needs in the specified
 *	  encoding.
 *
 * \param encoding The encoding for the string
 * \return The number of bytes the string needs in the specified encoding.