7fd59977 |
1 | |
2 | --Copyright: Matra Datavision 1992,1993 |
3 | |
4 | -- File: OSD_FileNode.cdl |
5 | -- Created: Mon 24 1992 |
6 | -- Author: Stephan GARNAUD (ARM) |
7 | -- <sga@sparc4> |
8 | |
9 | |
10 | deferred class FileNode from OSD |
11 | |
12 | ---Purpose: A class for 'File' and 'Directory' grouping common |
13 | -- methods. |
14 | -- The "file oriented" name means files or directories which are |
15 | -- in fact hard coded as files. |
16 | |
17 | uses Protection, Date, Path, OpenMode, Error, AsciiString from TCollection |
18 | raises OSDError, ProgramError |
19 | |
20 | |
21 | is |
22 | Initialize; |
23 | ---Purpose: Creates FileNode object |
24 | -- This is to be used with SetPath . |
25 | -- Allocate space for the file name and initializes this |
26 | -- name to an empty name. |
27 | ---Level: Internal |
28 | |
29 | Initialize (Name : Path ) |
30 | ---Purpose: Instantiates the object FileNode storing its name. |
31 | -- If a name is not found, it raises a program error. |
32 | ---Level: Internal |
33 | raises ProgramError; |
34 | |
35 | Path(me ; Name : out Path) is static; |
36 | ---Purpose: Gets file name and path. |
37 | ---Level: Public |
38 | |
39 | SetPath(me : in out; Name : Path) |
40 | ---Purpose: Sets file name and path. |
41 | -- If a name is not found, it raises a program error. |
42 | ---Level: Public |
43 | raises ProgramError is static; |
44 | |
45 | Exists ( me : in out ) returns Boolean |
46 | ---Purpose: Returns TRUE if <me> exists. |
47 | ---Level: Public |
48 | raises ProgramError is static; |
49 | |
50 | Remove (me : in out) |
51 | ---Purpose: Erases the FileNode from directory |
52 | ---Level: Public |
53 | raises ProgramError is static; |
54 | |
55 | Move (me : in out; NewPath : Path) |
56 | ---Purpose: Moves <me> into another directory |
57 | ---Level: Public |
58 | raises ProgramError is static; |
59 | |
60 | Copy (me : in out; ToPath : Path ) |
61 | ---Purpose: Copies <me> to another FileNode |
62 | ---Level: Public |
63 | raises ProgramError is static; |
64 | |
65 | Protection (me : in out) returns Protection |
66 | ---Purpose: Returns access mode of <me>. |
67 | ---Level: Public |
68 | raises ProgramError is static; |
69 | |
70 | SetProtection (me : out; Prot : Protection) |
71 | ---Purpose: Changes protection of the FileNode |
72 | ---Level: Public |
73 | raises ProgramError is static; |
74 | |
75 | AccessMoment (me : in out) returns Date |
76 | ---Purpose: Returns last write access. |
77 | -- On UNIX, AccessMoment and CreationMoment return the |
78 | -- same value. |
79 | ---Level: Public |
80 | raises ProgramError is static; |
81 | |
82 | CreationMoment (me : in out) returns Date |
83 | ---Purpose: Returns creation date. |
84 | -- On UNIX, AccessMoment and CreationMoment return the |
85 | -- same value. |
86 | ---Level: Public |
87 | raises ProgramError is static; |
88 | |
89 | UserId (me : in out) returns Integer |
90 | ---Purpose: Returns User Identification. |
91 | ---Level: Public |
92 | raises ProgramError is static; |
93 | |
94 | GroupId (me : in out) returns Integer |
95 | ---Purpose: Returns Group Identification. |
96 | ---Level: Public |
97 | raises ProgramError is static; |
98 | |
99 | Failed (me) returns Boolean is static; |
100 | ---Purpose: Returns TRUE if an error occurs |
101 | ---Level: Public |
102 | |
103 | Reset (me : in out) is static; |
104 | ---Purpose: Resets error counter to zero |
105 | ---Level: Public |
106 | |
107 | Perror (me : in out) |
108 | ---Purpose: Raises OSD_Error |
109 | ---Level: Public |
110 | raises OSDError is static; |
111 | |
112 | Error (me) returns Integer is static; |
113 | ---Purpose: Returns error number if 'Failed' is TRUE. |
114 | ---Level: Public |
115 | |
116 | fields |
117 | myPath : Path is protected; -- system independent path name |
118 | myFileChannel : Integer is protected; -- file descriptor |
119 | myError : Error is protected; |
120 | end FileNode from OSD; |
121 | |
122 | |
123 | |