ObjFW  Check-in [18ad960654]

Overview
Comment:OFString: Add -[writeToFile:encoding:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 18ad960654c1162fb7ea77191e09d6d6bfdbe47d29f9f593e9e66c823f9c96fd
User & Date: js on 2013-01-14 23:57:51
Other Links: manifest | tags
Context
2013-01-15
00:01
-[OFString cStringWithEncoding:]: Add ISO 8859-15. check-in: 14a638f75e user: js tags: trunk
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
Changes

Modified src/OFString.h from [0efe0688a9] to [b1831ea39c].

1005
1006
1007
1008
1009
1010
1011










1012
1013
1014
1015
1016
1017
1018
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028







+
+
+
+
+
+
+
+
+
+







/*!
 * @brief Writes the string into the specified file using UTF-8 encoding.
 *
 * @param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;

/*!
 * @brief Writes the string into the specified file using the specified
 *	  encoding.
 *
 * @param path The path of the file to write to
 * @param encoding The encoding to use to write the string into the file
 */
- (void)writeToFile: (OFString*)path
	   encoding: (of_string_encoding_t)encoding;

#ifdef OF_HAVE_BLOCKS
/*!
 * Enumerates all lines in the receiver using the specified block.
 *
 * @brief block The block to call for each line
 */
- (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block;

Modified src/OFString.m from [3b195e39ec] to [a4fa320751].

2220
2221
2222
2223
2224
2225
2226







2227
2228
2229
2230
2231
2232


2233
2234
2235
2236
2237
2238
2239
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238

2239
2240
2241
2242
2243
2244
2245
2246
2247







+
+
+
+
+
+
+





-
+
+







	}

	return ret;
}

- (void)writeToFile: (OFString*)path
{
	return [self writeToFile: path
			encoding: OF_STRING_ENCODING_UTF_8];
}

- (void)writeToFile: (OFString*)path
	   encoding: (of_string_encoding_t)encoding
{
	void *pool = objc_autoreleasePoolPush();
	OFFile *file;

	file = [OFFile fileWithPath: path
			       mode: @"wb"];
	[file writeString: self];
	[file writeString: self
		 encoding: encoding];

	objc_autoreleasePoolPop(pool);
}

#ifdef OF_HAVE_BLOCKS
- (void)enumerateLinesUsingBlock: (of_string_line_enumeration_block_t)block
{