WBA_Environment
WBA_Environment
wba
1998 12-05
CLASS
WBA_Environment - C++ execution environment
SYNOPSIS
This class encapsulates the execution environment of an application, in
particular the arguments, parameters, and executable name.
There are Load member functions with which the user loads
environment data from different environment sources (namely the command
line, environment variables, and configuration files). Each of the
Load functions accepts a mode argument which when set to
TRUE loads all arguments and when set to FALSE loads only
arguments that already exist in the argument table. This allows the
program to specify ahead of time which arguments are relevant to itself
(using WBA_ArgumentTable::Set()) and disregard irrelevant
arguments.
PARENTS
CONSTRUCTOR
WBA_Environment()
Create a WBA_Environment. The environment loading is not done
automatically to allow for user specified load ordering.
MEMBER FUNCTIONS
WBA_ArgumentTable *GetArgumentTable(void)
Return the argument table.
GPL_Array<GPL_String> *GetParameters(void)
Return the parameter array.
const GPL_String &GetProgramName(void) const
Return the full program name as executed.
const GPL_String &GetProgramBasename(void) const
Return the basename (no preceding path) of the program name as executed.
virtual GPL_Boolean GetValue(const GPL_String & name, GPL_String & value)
Get the value for name and put in value.
GPL_Boolean LoadCommandLine(const int argc, const char **argv, GPL_Boolean mode = TRUE)
Load the environment from the command line. If and argument is found
that does not already exist in the argument table FALSE is
returned. Otherwise TRUE is returned. This allows the program to
take action (such as print usage) if an unexpected argument is given.
void LoadEnvVariables(const char **envp, GPL_Boolean mode = TRUE)
Load the environment from environment variables.
GPL_Boolean LoadFile(const GPL_String & filename, GPL_Boolean mode = TRUE)
Load the environment from a file. Configuration files contain variable
definitions in the Bourne shell syntax (e.g., KEY=VALUE) with comments
preceded by '#'.