Overview
Comment: | Add OFFile singletons for stdin, stdout and stderr. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f285996b9157c2a284c21e5d9ca86990 |
User & Date: | js on 2009-06-06 14:10:42 |
Other Links: | manifest | tags |
Context
2009-06-06
| ||
19:17 | Change include path in objfw-config. check-in: 52fd75e0d0 user: js tags: trunk | |
14:10 | Add OFFile singletons for stdin, stdout and stderr. check-in: f285996b91 user: js tags: trunk | |
2009-06-05
| ||
18:30 | Rename -[url{De,En}codedString] to -[stringByURL{De,En}coding]. check-in: 4fa95c938d user: js tags: trunk | |
Changes
Modified src/OFConstString.m from [be48d08a96] to [385eb440a2].
︙ | ︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" #import "OFConstString.h" #ifndef __objc_INCLUDE_GNU void *_OFConstStringClassReference; #endif @implementation OFConstString #ifndef __objc_INCLUDE_GNU + (void)load { objc_setFutureClass((Class)&_OFConstStringClassReference, "OFConstString"); } #endif - retain { return self; } - (void)release { } - (size_t)retainCount { return SIZE_MAX; } | > > > > > > | > | > | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" #import "OFConstString.h" #import "OFExceptions.h" #ifndef __objc_INCLUDE_GNU void *_OFConstStringClassReference; #endif @implementation OFConstString #ifndef __objc_INCLUDE_GNU + (void)load { objc_setFutureClass((Class)&_OFConstStringClassReference, "OFConstString"); } #endif - autorelease { return self; } - retain { return self; } - (void)release { } - (size_t)retainCount { return SIZE_MAX; } - (void)dealloc { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; [super dealloc]; /* Get rid of stupid warning */ } @end |
Modified src/OFFile.h from [61195747ef] to [b3fcaa127c].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | /** * \param path The path to the file to open as a string * \param mode The mode in which the file should be opened as a string * \return A new autoreleased OFFile */ + fileWithPath: (OFString*)path andMode: (OFString*)mode; /** * Changes the mode of a file. * * Not available on Windows. * * \param path The path to the file of which the mode should be changed as a * string | > > > > > > > > > > > > > > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /** * \param path The path to the file to open as a string * \param mode The mode in which the file should be opened as a string * \return A new autoreleased OFFile */ + fileWithPath: (OFString*)path andMode: (OFString*)mode; /** * \return An OFFile singleton for stdin */ + standardInput; /** * \return An OFFile singleton for stdout */ + standardOutput; /** * \return An OFFile singleton for stderr */ + standardError; /** * Changes the mode of a file. * * Not available on Windows. * * \param path The path to the file of which the mode should be changed as a * string |
︙ | ︙ | |||
128 129 130 131 132 133 134 | * \param nitem The number of items to write * \return The number of bytes written */ - (size_t)writeNItems: (size_t)nitems ofSize: (size_t)size fromBuffer: (const char*)buf; @end | > > > > | 144 145 146 147 148 149 150 151 152 153 154 | * \param nitem The number of items to write * \return The number of bytes written */ - (size_t)writeNItems: (size_t)nitems ofSize: (size_t)size fromBuffer: (const char*)buf; @end @interface OFFileSingleton: OFFile - initWithFilePointer: (FILE*)fp; @end |
Modified src/OFFile.m from [c2c38ca999] to [5ce65f3f89].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #include <sys/types.h> #include <sys/stat.h> #endif #import "OFFile.h" #import "OFExceptions.h" @implementation OFFile + fileWithPath: (OFString*)path andMode: (OFString*)mode { return [[[self alloc] initWithPath: path andMode: mode] autorelease]; } + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode { /* * FIXME: On error, throw exception * FIXME: On Win32, change write access | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #include <sys/types.h> #include <sys/stat.h> #endif #import "OFFile.h" #import "OFExceptions.h" static OFFileSingleton *of_file_stdin = nil; static OFFileSingleton *of_file_stdout = nil; static OFFileSingleton *of_file_stderr = nil; @implementation OFFile + fileWithPath: (OFString*)path andMode: (OFString*)mode { return [[[self alloc] initWithPath: path andMode: mode] autorelease]; } + standardInput { if (of_file_stdin == nil) of_file_stdin = [[OFFileSingleton alloc] initWithFilePointer: stdin]; return of_file_stdin; } + standardOutput { if (of_file_stdout == nil) of_file_stdout = [[OFFileSingleton alloc] initWithFilePointer: stdout]; return of_file_stdout; } + standardError { if (of_file_stderr == nil) of_file_stderr = [[OFFileSingleton alloc] initWithFilePointer: stderr]; return of_file_stderr; } + (void)changeModeOfFile: (OFString*)path toMode: (mode_t)mode { /* * FIXME: On error, throw exception * FIXME: On Win32, change write access |
︙ | ︙ | |||
170 171 172 173 174 175 176 | { fclose(fp); fp = NULL; return self; } @end | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | { fclose(fp); fp = NULL; return self; } @end @implementation OFFileSingleton - initWithFilePointer: (FILE*)fp_ { self = [super init]; fp = fp_; return self; } - autorelease { return self; } - retain { return self; } - (void)release { } - (size_t)retainCount { return SIZE_MAX; } - (void)dealloc { @throw [OFNotImplementedException newWithClass: isa andSelector: _cmd]; [super dealloc]; /* Get rid of stupid warning */ } @end |