cleaning up usage of TMP variable to always get it from environment class.
[feisty_meow.git] / nucleus / library / basis / environment.h
1 #ifndef ENVIRONMENT_CLASS
2 #define ENVIRONMENT_CLASS
3
4 //////////////
5 // Name   : environment
6 // Author : Chris Koeritz
7 //////////////
8 // Copyright (c) 1994-$now By Author.  This program is free software; you can
9 // redistribute it and/or modify it under the terms of the GNU General Public
10 // License as published by the Free Software Foundation:
11 //     http://www.gnu.org/licenses/gpl.html
12 // or under the terms of the GNU Library license:
13 //     http://www.gnu.org/licenses/lgpl.html
14 // at your preference.  Those licenses describe your legal rights to this
15 // software, and no other rights or warranties apply.
16 // Please send updates for this code to: fred@gruntose.com -- Thanks, fred.
17 //////////////
18
19 #include "astring.h"
20 #include "definitions.h"
21
22 namespace basis {
23
24 //! Provides access to the system's environment variables.
25
26 class environment : public virtual root_object
27 {
28 public:
29   static astring TMP();
30     //!< provides a single place to get the temporary directory.
31     /*!< this will locate the value of the TMP variable and return it.  if the TMP
32     variable is not currently defined, this will try to do something reasonable for
33     a default value. */
34
35   static astring get(const astring &variable_name);
36     //!< looks up the "variable_name" in the current environment variables.
37     /*!< this returns the value for "variable_name" as it was found in the
38     operating system's environment variables that are defined at this point
39     in time for the user and process.  the returned string will be empty if no
40     variable under that name could be found. */
41
42   static bool set(const astring &variable_name, const astring &value);
43     //!< adds or creates "variable_name" in the environment.
44     /*!< changes the current set of environment variables by adding or
45     modifying the "variable_name".  its new value will be "value". */
46
47   static basis::un_int system_uptime();
48     //!< gives the operating system's uptime in a small form that rolls over.
49 };
50
51 } //namespace.
52
53 #endif
54