first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / 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 get(const astring &variable_name);
30     //!< looks up the "variable_name" in the current environment variables.
31     /*!< this returns the value for "variable_name" as it was found in the
32     operating system's environment variables that are defined at this point
33     in time for the user and process.  the returned string will be empty if no
34     variable under that name could be found. */
35
36 //  static astring get(const char *variable_name) { return get(astring(variable_name)); }
37     //!< synonym using simpler char pointer.
38
39   static bool set(const astring &variable_name, const astring &value);
40     //!< adds or creates "variable_name" in the environment.
41     /*!< changes the current set of environment variables by adding or
42     modifying the "variable_name".  its new value will be "value". */
43
44 //  static bool set(const char *variable_name, const char *value)
45 //      { return set(astring(variable_name), astring(value)); }
46     //!< synonym using simpler char pointers.
47
48   static basis::un_int system_uptime();
49     //!< gives the operating system's uptime in a small form that rolls over.
50 };
51
52 } //namespace.
53
54 #endif
55