ObjFW  Check-in [aed0aea0b2]

Overview
Comment:Add -[writeToFile:] to OFString.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: aed0aea0b27269b158361d0ab2c0b5e3ea8d6fb0778ebf48776ce3e23fb3e7c1
User & Date: js on 2010-07-02 21:56:12
Other Links: manifest | tags
Context
2010-07-03
17:15
Skip over the prolog in OFXMLParser. Will be parsed someday. check-in: e7801f415e user: js tags: trunk
2010-07-02
21:56
Add -[writeToFile:] to OFString. check-in: aed0aea0b2 user: js tags: trunk
21:40
Add OFXMLElementBuilder. check-in: ad93296956 user: js tags: trunk
Changes

Modified src/OFString.h from [56876e2512] to [9830becdb5].

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 *
 * \param str A string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithString: (OFString*)str;

/**
 * Creates a new OFString with the contents of the specified file.
 *
 * \param path The path to the file
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfFile: (OFString*)path;

/**







|







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
 *
 * \param str A string to initialize the OFString with
 * \return A new autoreleased OFString
 */
+ stringWithString: (OFString*)str;

/**
 * Creates a new OFString with the contents of the specified UTF-8 encoded file.
 *
 * \param path The path to the file
 * \return A new autoreleased OFString
 */
+ stringWithContentsOfFile: (OFString*)path;

/**
362
363
364
365
366
367
368







369
370
371
372
373
374
375
376
/**
 * Returns the hexadecimal value of the string as an intmax_t or throws an
 * OFInvalidEncoding exception if the string contains any non-number characters.
 *
 * \return An OFNumber
 */
- (uintmax_t)hexadecimalValueAsInteger;







@end

#import "OFConstString.h"
#import "OFMutableString.h"
#import "OFString+Hashing.h"
#import "OFString+URLEncoding.h"
#import "OFString+XMLEscaping.h"
#import "OFString+XMLUnescaping.h"







>
>
>
>
>
>
>








362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/**
 * Returns the hexadecimal value of the string as an intmax_t or throws an
 * OFInvalidEncoding exception if the string contains any non-number characters.
 *
 * \return An OFNumber
 */
- (uintmax_t)hexadecimalValueAsInteger;

/**
 * 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;
@end

#import "OFConstString.h"
#import "OFMutableString.h"
#import "OFString+Hashing.h"
#import "OFString+URLEncoding.h"
#import "OFString+XMLEscaping.h"
#import "OFString+XMLUnescaping.h"

Modified src/OFString.m from [19d4bb0975] to [5d478c6564].

1022
1023
1024
1025
1026
1027
1028












1029
			@throw [OFOutOfRangeException newWithClass: isa];

		num = newnum;
	}

	return num;
}












@end







>
>
>
>
>
>
>
>
>
>
>
>

1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
			@throw [OFOutOfRangeException newWithClass: isa];

		num = newnum;
	}

	return num;
}

- (void)writeToFile: (OFString*)path
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFFile *file;

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

	[pool release];
}
@end