Warnings on vc14 were eliminated
[occt.git] / src / OSD / OSD_Disk.hxx
1 // Created on: 1992-05-27
2 // Created by: Stephan GARNAUD (ARM)
3 // Copyright (c) 1992-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_Disk_HeaderFile
18 #define _OSD_Disk_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TCollection_AsciiString.hxx>
25 #include <Standard_Integer.hxx>
26 #include <OSD_Error.hxx>
27 #include <Standard_CString.hxx>
28 #include <Standard_Boolean.hxx>
29 class OSD_OSDError;
30 class OSD_Path;
31
32
33 //! Disk management (a set of disk oriented tools)
34 class OSD_Disk 
35 {
36 public:
37
38   DEFINE_STANDARD_ALLOC
39
40   
41   //! Creates a disk object.
42   //! This is used only when a class contains a Disk field.
43   //! By default, its name is initialized to current working disk.
44   Standard_EXPORT OSD_Disk();
45   
46   //! Initializes the object Disk with the disk name
47   //! associated to the OSD_Path.
48   Standard_EXPORT OSD_Disk(const OSD_Path& Name);
49   
50   //! Initializes the object Disk with <PathName>.
51   //! <PathName> specifies any file within the mounted
52   //! file system.
53   //! Example : OSD_Disk myDisk ("/tmp")
54   //! Initializes a disk object with the mounted
55   //! file associated to /tmp.
56   Standard_EXPORT OSD_Disk(const Standard_CString PathName);
57   
58   //! Returns disk name of <me>.
59   Standard_EXPORT OSD_Path Name() const;
60   
61   //! Instantiates <me> with <Name>.
62   Standard_EXPORT void SetName (const OSD_Path& Name);
63   
64   //! Returns total disk capacity in 512 bytes blocks.
65   Standard_EXPORT Standard_Integer DiskSize();
66   
67   //! Returns free available 512 bytes blocks on disk.
68   Standard_EXPORT Standard_Integer DiskFree();
69   
70   //! Returns user's disk quota (in Bytes).
71   Standard_EXPORT Standard_Integer DiskQuota();
72   
73   //! Sets user's disk quota (in Bytes).
74   //! Warning: Needs system administrator privilege.
75   Standard_EXPORT void SetDiskQuota (const Standard_Integer QuotaSize);
76   
77   //! Activates user's disk quota
78   //! Warning: Needs system administrator privilege.
79   Standard_EXPORT void SetQuotaOn();
80   
81   //! Deactivates user's disk quota
82   //! Warning: Needs system administrator privilege.
83   Standard_EXPORT void SetQuotaOff();
84   
85   //! Returns TRUE if an error occurs
86   Standard_EXPORT Standard_Boolean Failed() const;
87   
88   //! Resets error counter to zero
89   Standard_EXPORT void Reset();
90   
91   //! Raises OSD_Error
92   Standard_EXPORT void Perror();
93   
94   //! Returns error number if 'Failed' is TRUE.
95   Standard_EXPORT Standard_Integer Error() const;
96
97
98
99
100 protected:
101
102
103
104
105
106 private:
107
108
109
110   TCollection_AsciiString DiskName;
111   Standard_Integer myQuotaSize;
112   OSD_Error myError;
113
114
115 };
116
117
118
119
120
121
122
123 #endif // _OSD_Disk_HeaderFile