Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-05 09:23:39

0001 // Created on: 2024-03-15
0002 // Created by: Stephan GARNAUD (ARM)
0003 // Copyright (c) 1998-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _OSD_FileNode_HeaderFile
0018 #define _OSD_FileNode_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <OSD_Path.hxx>
0023 #include <OSD_Error.hxx>
0024 
0025 class OSD_Protection;
0026 class Quantity_Date;
0027 
0028 //! A class for 'File' and 'Directory' grouping common
0029 //! methods (file/directory manipulation tools).
0030 //! The "file oriented" name means files or directories which are
0031 //! in fact hard coded as files.
0032 class OSD_FileNode
0033 {
0034 public:
0035   DEFINE_STANDARD_ALLOC
0036 
0037   //! Gets file name and path.
0038   Standard_EXPORT void Path(OSD_Path& Name) const;
0039 
0040   //! Sets file name and path.
0041   //! If a name is not found, it raises a program error.
0042   Standard_EXPORT void SetPath(const OSD_Path& Name);
0043 
0044   //! Returns TRUE if <me> exists.
0045   Standard_EXPORT bool Exists();
0046 
0047   //! Erases the FileNode from directory
0048   Standard_EXPORT void Remove();
0049 
0050   //! Moves <me> into another directory
0051   Standard_EXPORT void Move(const OSD_Path& NewPath);
0052 
0053   //! Copies <me> to another FileNode
0054   Standard_EXPORT void Copy(const OSD_Path& ToPath);
0055 
0056   // None of the existing security APIs are supported in a UWP applications
0057   //! Returns access mode of <me>.
0058   Standard_EXPORT OSD_Protection Protection();
0059 
0060   //! Changes protection of the FileNode
0061   Standard_EXPORT void SetProtection(const OSD_Protection& Prot);
0062 
0063   //! Returns last write access.
0064   //! On UNIX, AccessMoment and CreationMoment return the
0065   //! same value.
0066   Standard_EXPORT Quantity_Date AccessMoment();
0067 
0068   //! Returns creation date.
0069   //! On UNIX, AccessMoment and CreationMoment return the
0070   //! same value.
0071   Standard_EXPORT Quantity_Date CreationMoment();
0072 
0073   //! Returns TRUE if an error occurs
0074   Standard_EXPORT bool Failed() const;
0075 
0076   //! Resets error counter to zero
0077   Standard_EXPORT void Reset();
0078 
0079   //! Raises OSD_Error
0080   Standard_EXPORT void Perror();
0081 
0082   //! Returns error number if 'Failed' is TRUE.
0083   Standard_EXPORT int Error() const;
0084 
0085 protected:
0086   //! Creates FileNode object
0087   //! This is to be used with SetPath .
0088   //! Allocate space for the file name and initializes this
0089   //! name to an empty name.
0090   Standard_EXPORT OSD_FileNode();
0091 
0092   //! Instantiates the object FileNode storing its name.
0093   //! If a name is not found, it raises a program error.
0094   Standard_EXPORT OSD_FileNode(const OSD_Path& Name);
0095 
0096   //! Destructor is protected for safer inheritance
0097   ~OSD_FileNode() = default;
0098 
0099 protected:
0100   OSD_Path  myPath;
0101   OSD_Error myError;
0102 };
0103 
0104 #endif // _OSD_FileNode_HeaderFile