ObjFW  Diff

Differences From Artifact [3298445bd5]:

To Artifact [d94b85395e]:


9
10
11
12
13
14
15



16
17
18
19
20
21
22
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+
+







 * the packaging of this file.
 */

#import <stdio.h>

#ifndef _WIN32
#import <sys/types.h>
#else
typedef int uid_t;
typedef int gid_t;
#endif

#import "OFObject.h"
#import "OFStream.h"

/**
 * The OFFile class provides functions to read, write and manipulate files.
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
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







-
-
+

-












-
-
+


-







-
+










-
-
+

-










-
-
+

-







 * Not available on Windows.
 *
 * \param path The path to the file of which the mode should be changed as a
 *	  C string
 * \param mode The new mode for the file
 * \return A boolean whether the operation succeeded
 */
#ifndef _WIN32
+ (BOOL)changeModeOfFile: (const char*)path
+ (void)changeModeOfFile: (const char*)path
		  toMode: (mode_t)mode;
#endif

/**
 * 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
 * \param owner The new owner for the file
 * \param group The new group for the file
 * \return A boolean whether the operation succeeded
 */
#ifndef _WIN32
+ (BOOL)changeOwnerOfFile: (const char*)path
+ (void)changeOwnerOfFile: (const char*)path
		  toOwner: (uid_t)owner
		 andGroup: (gid_t)group;
#endif

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

/**
 * 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
 * \return A boolean whether the operation succeeded
 */
#ifndef _WIN32
+ (BOOL)symlink: (const char*)src
+ (void)symlink: (const char*)src
	     to: (const char*)dest;
#endif

/**
 * 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
 * \return An initialized OFFile