Back to home page

EIC code displayed by LXR

 
 

    


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

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