Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-11 08:33:55

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_Process_HeaderFile
0018 #define _OSD_Process_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <OSD_Error.hxx>
0025 #include <TCollection_AsciiString.hxx>
0026 
0027 class Quantity_Date;
0028 class OSD_Path;
0029 
0030 // undefine SetCurrentDirectory that can be #defined by previous inclusion of windows.h
0031 #ifdef SetCurrentDirectory
0032   #undef SetCurrentDirectory
0033 #endif
0034 
0035 //! A set of system process tools
0036 class OSD_Process
0037 {
0038 public:
0039   //! Return full path to the current process executable.
0040   Standard_EXPORT static TCollection_AsciiString ExecutablePath();
0041 
0042   //! Return full path to the folder containing current process executable with trailing separator.
0043   Standard_EXPORT static TCollection_AsciiString ExecutableFolder();
0044 
0045 public:
0046   DEFINE_STANDARD_ALLOC
0047 
0048   //! Initializes the object and prepare for a possible dump
0049   Standard_EXPORT OSD_Process();
0050 
0051   //! Returns the terminal used (vt100, vt200 ,sun-cmd ...)
0052   Standard_EXPORT void TerminalType(TCollection_AsciiString& Name);
0053 
0054   //! Gets system date.
0055   Standard_EXPORT Quantity_Date SystemDate();
0056 
0057   //! Returns the user name.
0058   Standard_EXPORT TCollection_AsciiString UserName();
0059 
0060   //! Returns True if the process user is the super-user.
0061   Standard_EXPORT Standard_Boolean IsSuperUser();
0062 
0063   //! Returns the 'Process Id'
0064   Standard_EXPORT Standard_Integer ProcessId();
0065 
0066   //! Returns the current path where the process is.
0067   Standard_EXPORT OSD_Path CurrentDirectory();
0068 
0069   //! Changes the current process directory.
0070   Standard_EXPORT void SetCurrentDirectory(const OSD_Path& where);
0071 
0072   //! Returns TRUE if an error occurs
0073   Standard_EXPORT Standard_Boolean Failed() const;
0074 
0075   //! Resets error counter to zero
0076   Standard_EXPORT void Reset();
0077 
0078   //! Raises OSD_Error
0079   Standard_EXPORT void Perror();
0080 
0081   //! Returns error number if 'Failed' is TRUE.
0082   Standard_EXPORT Standard_Integer Error() const;
0083 
0084 private:
0085   OSD_Error myError;
0086 };
0087 
0088 #endif // _OSD_Process_HeaderFile