ObjFW  Diff

Differences From Artifact [bbac3bc2d4]:

To Artifact [b5cc441e5f]:


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
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88


89
90









91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95
96

97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-








-

-
+











-

-
-
+
+


+
+
+
+
+
+
+
+
+




-










-











-







/**
 * \param fp A file pointer, returned from for example fopen().
 *	     It is not closed when the OFFile object is deallocated!
 * \return A new autoreleased OFFile
 */
+ fileWithFilePointer: (FILE*)fp;

/**
 * \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
 * \param mode The new mode for the file
 * \return A boolean whether the operation succeeded
 */
+ (BOOL)changeModeOfFile: (OFString*)path
+ (void)changeModeOfFile: (OFString*)path
		  toMode: (mode_t)mode;

/**
 * Changes the owner of a file.
 *
 * Not available on Windows.
 *
 * \param path The path to the file of which the owner should be changed as a
 *	       string
 * \param owner The new owner for the file
 * \param group The new group for the file
 * \return A boolean whether the operation succeeded
 */
+ (BOOL)changeOwnerOfFile: (OFString*)path
		    owner: (uid_t)owner
+ (void)changeOwnerOfFile: (OFString*)path
		  toOwner: (uid_t)owner
		    group: (gid_t)group;

/**
 * Renames a file.
 *
 * \param from The file to rename
 * \param to The new name
 */
+ (void)rename: (OFString*)from
	    to: (OFString*)to;

/**
 * Deletes a file.
 *
 * \param path The path to the file of which should be deleted as a string
 * \return A boolean whether the operation succeeded
 */
+ (void)delete: (OFString*)path;

/**
 * Hardlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be linked as a string
 * \param dest The path to where the file should be linked as a string
 * \return A boolean whether the operation succeeded
 */
+ (void)link: (OFString*)src
	  to: (OFString*)dest;

/**
 * Symlinks a file.
 *
 * Not available on Windows.
 *
 * \param src The path to the file of which should be symlinked as a string
 * \param dest The path to where the file should be symlinked as a string
 * \return A boolean whether the operation succeeded
 */
+ (void)symlink: (OFString*)src
	     to: (OFString*)dest;

/**
 * Initializes an already allocated OFFile.
 *
163
164
165
166
167
168
169







152
153
154
155
156
157
158
159
160
161
162
163
164
165







+
+
+
+
+
+
+
- (size_t)writeNItems: (size_t)nitems
	       ofSize: (size_t)size
	   fromBuffer: (const char*)buf;
@end

@interface OFFileSingleton: OFFile
@end

/// An OFFile object for stdin.
extern OFFile *of_stdin;
/// An OFFile object for stdout.
extern OFFile *of_stdout;
/// An OFFile object for stderr.
extern OFFile *of_stderr;