ObjFW  Check-in [5405bd5c5f]

Overview
Comment:OFStream: Rename -[write*:usingEncoding:].

It is now -[write*:encoding:].

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5405bd5c5f43ddb0d63cfdb75c7cf31a0929adec123a471f129e015fab4fc630
User & Date: js on 2013-01-14 23:56:43
Other Links: manifest | tags
Context
2013-01-14
23:57
OFString: Add -[writeToFile:encoding:]. check-in: 18ad960654 user: js tags: trunk
23:56
OFStream: Rename -[write*:usingEncoding:]. check-in: 5405bd5c5f user: js tags: trunk
23:22
OFObject: Cosmetic changes. check-in: 6d438629e2 user: js tags: trunk
Changes

Modified src/OFStream.h from [aa6a3707b4] to [7c8c68988a].

934
935
936
937
938
939
940
941

942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960

961
962
963
964
965
966
967
934
935
936
937
938
939
940

941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959

960
961
962
963
964
965
966
967







-
+


















-
+







 *	  the trailing zero.
 *
 * @param string The string from which the data is written to the stream
 * @param encoding The encoding in which to write the string to the stream
 * @return The number of bytes written
 */
- (size_t)writeString: (OFString*)string
	usingEncoding: (of_string_encoding_t)encoding;
	     encoding: (of_string_encoding_t)encoding;

/*!
 * @brief Writes a string into the stream with a trailing newline.
 *
 * @param string The string from which the data is written to the stream
 * @return The number of bytes written
 */
- (size_t)writeLine: (OFString*)string;

/*!
 * @brief Writes a string into the stream in the specified encoding with a
 *	  trailing newline.
 *
 * @param string The string from which the data is written to the stream
 * @param encoding The encoding in which to write the string to the stream
 * @return The number of bytes written
 */
- (size_t)writeLine: (OFString*)string
      usingEncoding: (of_string_encoding_t)encoding;
	   encoding: (of_string_encoding_t)encoding;

/*!
 * @brief Writes a formatted string into the stream.
 *
 * See printf for the format syntax. As an addition, %@ is available as format
 * specifier for objects.
 *

Modified src/OFStream.m from [c8e036b974] to [94745f6f8c].

1368
1369
1370
1371
1372
1373
1374
1375

1376
1377
1378
1379

1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392

1393
1394
1395
1396

1397
1398
1399
1400
1401
1402
1403
1368
1369
1370
1371
1372
1373
1374

1375
1376
1377
1378

1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391

1392
1393
1394
1395

1396
1397
1398
1399
1400
1401
1402
1403







-
+



-
+












-
+



-
+








	return length;
}

- (size_t)writeString: (OFString*)string
{
	return [self writeString: string
		   usingEncoding: OF_STRING_ENCODING_UTF_8];
			encoding: OF_STRING_ENCODING_UTF_8];
}

- (size_t)writeString: (OFString*)string
	usingEncoding: (of_string_encoding_t)encoding
	     encoding: (of_string_encoding_t)encoding
{
	size_t length = [string cStringLengthWithEncoding: encoding];

	[self writeBuffer: [string cStringWithEncoding: encoding]
		   length: length];

	return length;
}

- (size_t)writeLine: (OFString*)string
{
	return [self writeLine: string
		 usingEncoding: OF_STRING_ENCODING_UTF_8];
		      encoding: OF_STRING_ENCODING_UTF_8];
}

- (size_t)writeLine: (OFString*)string
      usingEncoding: (of_string_encoding_t)encoding
	   encoding: (of_string_encoding_t)encoding
{
	size_t stringLength = [string cStringLengthWithEncoding: encoding];
	char *buffer;

	buffer = [self allocMemoryWithSize: stringLength + 1];

	@try {