Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:37

0001 // Created on: 2018-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_Protection_HeaderFile
0018 #define _OSD_Protection_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <OSD_SingleProtection.hxx>
0025 
0026 
0027 //! This  class provides data to manage file protection
0028 //! Example:These rights are treated in a system dependent manner :
0029 //! On UNIX you have User,Group and Other rights
0030 //! On VMS  you have Owner,Group,World and System rights
0031 //! An automatic conversion is done between OSD and UNIX/VMS.
0032 //!
0033 //! OSD VMS UNIX
0034 //! User     Owner   User
0035 //! Group    Group   Group
0036 //! World    World   Other
0037 //! System   System  (combined with Other)
0038 //!
0039 //! When you use System protection on UNIX you must know that
0040 //! Other rights and System rights are inclusively "ORed".
0041 //! So Other with only READ access and System with WRITE access
0042 //! will produce on UNIX Other with READ and WRITE access.
0043 //!
0044 //! This choice comes from the fact that ROOT can't be considered
0045 //! as member of the group nor as user. So it is considered as Other.
0046 class OSD_Protection 
0047 {
0048 public:
0049 
0050   DEFINE_STANDARD_ALLOC
0051 
0052   
0053   //! Initializes global access rights as follows
0054   //!
0055   //! User   : Read Write
0056   //! System : Read Write
0057   //! Group  : Read
0058   //! World  : Read
0059   Standard_EXPORT OSD_Protection();
0060   
0061   //! Sets values of fields
0062   Standard_EXPORT OSD_Protection(const OSD_SingleProtection System, const OSD_SingleProtection User, const OSD_SingleProtection Group, const OSD_SingleProtection World);
0063   
0064   //! Retrieves values of fields
0065   Standard_EXPORT void Values (OSD_SingleProtection& System, OSD_SingleProtection& User, OSD_SingleProtection& Group, OSD_SingleProtection& World);
0066   
0067   //! Sets values of fields
0068   Standard_EXPORT void SetValues (const OSD_SingleProtection System, const OSD_SingleProtection User, const OSD_SingleProtection Group, const OSD_SingleProtection World);
0069   
0070   //! Sets protection of 'System'
0071   Standard_EXPORT void SetSystem (const OSD_SingleProtection priv);
0072   
0073   //! Sets protection of 'User'
0074   Standard_EXPORT void SetUser (const OSD_SingleProtection priv);
0075   
0076   //! Sets protection of 'Group'
0077   Standard_EXPORT void SetGroup (const OSD_SingleProtection priv);
0078   
0079   //! Sets protection of 'World'
0080   Standard_EXPORT void SetWorld (const OSD_SingleProtection priv);
0081   
0082   //! Gets protection of 'System'
0083   Standard_EXPORT OSD_SingleProtection System() const;
0084   
0085   //! Gets protection of 'User'
0086   Standard_EXPORT OSD_SingleProtection User() const;
0087   
0088   //! Gets protection of 'Group'
0089   Standard_EXPORT OSD_SingleProtection Group() const;
0090   
0091   //! Gets protection of 'World'
0092   Standard_EXPORT OSD_SingleProtection World() const;
0093   
0094   //! Add a right to a single protection.
0095   //! ex: aProt = RWD
0096   //! me.Add(aProt,X)  ->  aProt = RWXD
0097   Standard_EXPORT void Add (OSD_SingleProtection& aProt, const OSD_SingleProtection aRight);
0098   
0099   //! Subtract a right to a single protection.
0100   //! ex: aProt = RWD
0101   //! me.Sub(aProt,RW) ->  aProt = D
0102   //! But me.Sub(aProt,RWX) is also valid and gives same result.
0103   Standard_EXPORT void Sub (OSD_SingleProtection& aProt, const OSD_SingleProtection aRight);
0104 
0105 
0106 friend class OSD_FileNode;
0107 friend class OSD_File;
0108 friend class OSD_Directory;
0109 
0110 
0111 protected:
0112 
0113 
0114 
0115 
0116 
0117 private:
0118 
0119   
0120   //! Returns System dependent access rights
0121   //! this is a private method.
0122   Standard_EXPORT Standard_Integer Internal() const;
0123 
0124 
0125   OSD_SingleProtection s;
0126   OSD_SingleProtection u;
0127   OSD_SingleProtection g;
0128   OSD_SingleProtection w;
0129 
0130 
0131 };
0132 
0133 
0134 
0135 
0136 
0137 
0138 
0139 #endif // _OSD_Protection_HeaderFile