0030924: Coding - incorrect header in file OSD_ThreadPool.hxx
[occt.git] / src / OSD / OSD_FileNode.hxx
1 // Created on: 2024-03-15
2 // Created by: Stephan GARNAUD (ARM)
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _OSD_FileNode_HeaderFile
18 #define _OSD_FileNode_HeaderFile
19
20 #include <Standard.hxx>
21
22 #include <OSD_Path.hxx>
23 #include <OSD_Error.hxx>
24
25 class OSD_OSDError;
26 class Standard_ProgramError;
27 class OSD_Protection;
28 class Quantity_Date;
29
30
31 //! A class for 'File' and 'Directory' grouping common
32 //! methods (file/directory manipulation tools).
33 //! The "file oriented" name means files or directories which are
34 //! in fact hard coded as files.
35 class OSD_FileNode 
36 {
37 public:
38
39   DEFINE_STANDARD_ALLOC
40
41   
42   //! Gets file name and path.
43   Standard_EXPORT void Path (OSD_Path& Name) const;
44   
45   //! Sets file name and path.
46   //! If a name is not found, it raises a program error.
47   Standard_EXPORT void SetPath (const OSD_Path& Name);
48   
49   //! Returns TRUE if <me> exists.
50   Standard_EXPORT Standard_Boolean Exists();
51   
52   //! Erases the FileNode from directory
53   Standard_EXPORT void Remove();
54   
55   //! Moves <me> into another directory
56   Standard_EXPORT void Move (const OSD_Path& NewPath);
57   
58   //! Copies <me> to another FileNode
59   Standard_EXPORT void Copy (const OSD_Path& ToPath);
60
61   // None of the existing security APIs are supported in a UWP applications
62   //! Returns access mode of <me>.
63   Standard_EXPORT OSD_Protection Protection();
64   
65   //! Changes protection of the FileNode
66   Standard_EXPORT void SetProtection (const OSD_Protection& Prot);
67
68   //! Returns last write access.
69   //! On UNIX, AccessMoment and CreationMoment return the
70   //! same value.
71   Standard_EXPORT Quantity_Date AccessMoment();
72   
73   //! Returns creation date.
74   //! On UNIX, AccessMoment and CreationMoment return the
75   //! same value.
76   Standard_EXPORT Quantity_Date CreationMoment();
77   
78   //! Returns TRUE if an error occurs
79   Standard_EXPORT Standard_Boolean Failed() const;
80   
81   //! Resets error counter to zero
82   Standard_EXPORT void Reset();
83   
84   //! Raises OSD_Error
85   Standard_EXPORT void Perror();
86   
87   //! Returns error number if 'Failed' is TRUE.
88   Standard_EXPORT Standard_Integer Error() const;
89
90 protected:
91   
92   //! Creates FileNode object
93   //! This is to be used with SetPath .
94   //! Allocate space for the file name and initializes this
95   //! name to an empty name.
96   Standard_EXPORT OSD_FileNode();
97   
98   //! Instantiates the object FileNode storing its name.
99   //! If a name is not found, it raises a program error.
100   Standard_EXPORT OSD_FileNode(const OSD_Path& Name);
101
102   //! Destructor is protected for safer inheritance
103   ~OSD_FileNode () {}
104
105 protected:
106
107   OSD_Path myPath;
108   OSD_Error myError;
109 };
110
111
112 #endif // _OSD_FileNode_HeaderFile