ObjFW  Diff

Differences From Artifact [8b3e4349b5]:

To Artifact [0828962522]:


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
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
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
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







+










-
-
+
+


-
-
+
+






-
+



-
+








-
+




-
+






-
+


-
+






-
-
+
+


-
-
+
+






-
-
+
+


-
-
+
+




-
-
+
+


-
-
+
+







#include <sys/types.h>
#else
typedef int uid_t;
typedef int gid_t;
#endif

#import "OFStream.h"
#import "OFString.h"

/**
 * The OFFile class provides functions to read, write and manipulate files.
 */
@interface OFFile: OFStream
{
	FILE *fp;
}

/**
 * \param path The path to the file to open as a C string
 * \param mode The mode in which the file should be opened as a C string
 * \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: (const char*)path
       andMode: (const char*)mode;
+ 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
 *	  C string
 *	       string
 * \param mode The new mode for the file
 * \return A boolean whether the operation succeeded
 */
+ (void)changeModeOfFile: (const char*)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
 *	  C string
 *	       string
 * \param owner The new owner for the file
 * \param group The new group for the file
 * \return A boolean whether the operation succeeded
 */
+ (void)changeOwnerOfFile: (const char*)path
+ (void)changeOwnerOfFile: (OFString*)path
		  toOwner: (uid_t)owner
		 andGroup: (gid_t)group;

/**
 * Deletes a file.
 *
 * \param path The path to the file of which should be deleted as a C string
 * \param path The path to the file of which should be deleted as a string
 * \return A boolean whether the operation succeeded
 */
+ (void)delete: (const char*)path;
+ (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 C string
 * \param dest The path to where the file should be linked as a C string
 * \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: (const char*)src
	  to: (const char*)dest;
+ (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 C string
 * \param dest The path to where the file should be symlinked as a C string
 * \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: (const char*)src
	     to: (const char*)dest;
+ (void)symlink: (OFString*)src
	     to: (OFString*)dest;

/**
 * Initializes an already allocated OFFile.
 *
 * \param path The path to the file to open as a C string
 * \param mode The mode in which the file should be opened as a C string
 * \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 An initialized OFFile
 */
- initWithPath: (const char*)path
       andMode: (const char*)mode;
- initWithPath: (OFString*)path
       andMode: (OFString*)mode;

/**
 * \return A boolean whether the end of the file has been reached
 */
- (BOOL)atEndOfFile;

/**