Overview
Comment: | Add -[OFStream write{String,Line}:usingEncoding:]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8f6d44074ddf0ba0caa8686da4b255c9 |
User & Date: | js on 2012-12-16 01:18:00 |
Other Links: | manifest | tags |
Context
2012-12-16
| ||
01:24 | OFStream: Fix a FIXME. check-in: 28ffd3d914 user: js tags: trunk | |
01:18 | Add -[OFStream write{String,Line}:usingEncoding:]. check-in: 8f6d44074d user: js tags: trunk | |
01:15 | Add encodings for -[cStringUsingEncoding:]. check-in: 556234e290 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [c7b337bee8] to [bcd97aa0de].
︙ | ︙ | |||
925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 | * @brief Writes a string into the stream, without the trailing zero. * * @param string The string from which the data is written to the stream * @return The number of bytes written */ - (size_t)writeString: (OFString*)string; /*! * @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 formatted string into the stream. * * See printf for the format syntax. As an addition, %@ is available as format * specifier for objects. * * @param format A string used as format | > > > > > > > > > > > > > > > > > > > > > > | 925 926 927 928 929 930 931 932 933 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 968 | * @brief Writes a string into the stream, without the trailing zero. * * @param string The string from which the data is written to the stream * @return The number of bytes written */ - (size_t)writeString: (OFString*)string; /*! * @brief Writes a string into the stream in the specified encoding, without * 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; /*! * @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; /*! * @brief Writes a formatted string into the stream. * * See printf for the format syntax. As an addition, %@ is available as format * specifier for objects. * * @param format A string used as format |
︙ | ︙ |
Modified src/OFStream.m from [c1d9e7762b] to [9acea0cd8c].
︙ | ︙ | |||
1361 1362 1363 1364 1365 1366 1367 | length: length]; return length; } - (size_t)writeString: (OFString*)string { | > > > > > > > | | > > > > > > > | | > | 1361 1362 1363 1364 1365 1366 1367 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 1404 1405 1406 | length: length]; return length; } - (size_t)writeString: (OFString*)string { return [self writeString: string usingEncoding: OF_STRING_ENCODING_UTF_8]; } - (size_t)writeString: (OFString*)string usingEncoding: (of_string_encoding_t)encoding { size_t length = [string lengthOfBytesUsingEncoding: encoding]; [self writeBuffer: [string cStringUsingEncoding: encoding] length: length]; return length; } - (size_t)writeLine: (OFString*)string { return [self writeLine: string usingEncoding: OF_STRING_ENCODING_UTF_8]; } - (size_t)writeLine: (OFString*)string usingEncoding: (of_string_encoding_t)encoding { size_t stringLength = [string lengthOfBytesUsingEncoding: encoding]; char *buffer; buffer = [self allocMemoryWithSize: stringLength + 1]; @try { memcpy(buffer, [string cStringUsingEncoding: encoding], stringLength); buffer[stringLength] = '\n'; [self writeBuffer: buffer length: stringLength + 1]; } @finally { [self freeMemory: buffer]; } |
︙ | ︙ |