Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:17:33

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_Environment_HeaderFile
0018 #define _OSD_Environment_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TCollection_AsciiString.hxx>
0025 #include <OSD_Error.hxx>
0026 
0027 //! Management of system environment variables
0028 //! An environment variable is composed of a variable name
0029 //! and its value.
0030 //!
0031 //! To be portable among various systems, environment variables
0032 //! are local to a process.
0033 class OSD_Environment
0034 {
0035 public:
0036   DEFINE_STANDARD_ALLOC
0037 
0038   //! Creates the object Environment.
0039   Standard_EXPORT OSD_Environment();
0040 
0041   //! Creates an Environment variable initialized with value
0042   //! set to an empty AsciiString.
0043   Standard_EXPORT OSD_Environment(const TCollection_AsciiString& Name);
0044 
0045   //! Creates an Environment variable initialized with Value.
0046   Standard_EXPORT OSD_Environment(const TCollection_AsciiString& Name,
0047                                   const TCollection_AsciiString& Value);
0048 
0049   //! Changes environment variable value.
0050   //! Raises ConstructionError either if the string contains
0051   //! characters not in range of ' '...'~' or if the string
0052   //! contains the character '$' which is forbidden.
0053   Standard_EXPORT void SetValue(const TCollection_AsciiString& Value);
0054 
0055   //! Gets the value of an environment variable
0056   Standard_EXPORT TCollection_AsciiString Value();
0057 
0058   //! Changes environment variable name.
0059   //! Raises ConstructionError either if the string contains
0060   //! characters not in range of ' '...'~' or if the string
0061   //! contains the character '$' which is forbidden.
0062   Standard_EXPORT void SetName(const TCollection_AsciiString& name);
0063 
0064   //! Gets the name of <me>.
0065   Standard_EXPORT TCollection_AsciiString Name() const;
0066 
0067   //! Sets the value of an environment variable
0068   //! into system (physically).
0069   Standard_EXPORT void Build();
0070 
0071   //! Removes (physically) an environment variable
0072   Standard_EXPORT void Remove();
0073 
0074   //! Returns TRUE if an error occurs
0075   Standard_EXPORT bool Failed() const;
0076 
0077   //! Resets error counter to zero
0078   Standard_EXPORT void Reset();
0079 
0080   //! Raises OSD_Error
0081   Standard_EXPORT void Perror();
0082 
0083   //! Returns error number if 'Failed' is TRUE.
0084   Standard_EXPORT int Error() const;
0085 
0086 private:
0087   TCollection_AsciiString myName;
0088   TCollection_AsciiString myValue;
0089   OSD_Error               myError;
0090 };
0091 
0092 #endif // _OSD_Environment_HeaderFile