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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _OSD_FileNode_HeaderFile
18 #define _OSD_FileNode_HeaderFile
20 #include <Standard.hxx>
22 #include <OSD_Path.hxx>
23 #include <OSD_Error.hxx>
26 class Standard_ProgramError;
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.
42 //! Gets file name and path.
43 Standard_EXPORT void Path (OSD_Path& Name) const;
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);
49 //! Returns TRUE if <me> exists.
50 Standard_EXPORT Standard_Boolean Exists();
52 //! Erases the FileNode from directory
53 Standard_EXPORT void Remove();
55 //! Moves <me> into another directory
56 Standard_EXPORT void Move (const OSD_Path& NewPath);
58 //! Copies <me> to another FileNode
59 Standard_EXPORT void Copy (const OSD_Path& ToPath);
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();
65 //! Changes protection of the FileNode
66 Standard_EXPORT void SetProtection (const OSD_Protection& Prot);
68 //! Returns last write access.
69 //! On UNIX, AccessMoment and CreationMoment return the
71 Standard_EXPORT Quantity_Date AccessMoment();
73 //! Returns creation date.
74 //! On UNIX, AccessMoment and CreationMoment return the
76 Standard_EXPORT Quantity_Date CreationMoment();
78 //! Returns TRUE if an error occurs
79 Standard_EXPORT Standard_Boolean Failed() const;
81 //! Resets error counter to zero
82 Standard_EXPORT void Reset();
85 Standard_EXPORT void Perror();
87 //! Returns error number if 'Failed' is TRUE.
88 Standard_EXPORT Standard_Integer Error() const;
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();
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);
102 //! Destructor is protected for safer inheritance
112 #endif // _OSD_FileNode_HeaderFile