Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
nsEnvironment Class Reference

#include <nsEnvironment.h>

Inheritance diagram for nsEnvironment:
Inheritance graph
[legend]
Collaboration diagram for nsEnvironment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void set (in AString aName, in AString aValue)
 Set the value of an environment variable.
AString get (in AString aName)
 Get the value of an environment variable.
boolean exists (in AString aName)
 Check the existence of an environment variable.

Static Public Member Functions

NS_DECL_ISUPPORTS static
NS_DECL_NSIENVIRONMENT
NS_METHOD 
Create (nsISupports *aOuter, REFNSIID aIID, void **aResult)

Private Member Functions

 nsEnvironment ()
 ~nsEnvironment ()

Private Attributes

PRLockmLock

Detailed Description

Definition at line 51 of file nsEnvironment.h.


Constructor & Destructor Documentation

nsEnvironment::nsEnvironment ( ) [inline, private]

Definition at line 61 of file nsEnvironment.h.

{ }

Definition at line 81 of file nsEnvironment.cpp.

Here is the call graph for this function:


Member Function Documentation

NS_METHOD nsEnvironment::Create ( nsISupports *  aOuter,
REFNSIID  aIID,
void **  aResult 
) [static]

Definition at line 53 of file nsEnvironment.cpp.

{
    nsresult rv;
    *aResult = nsnull;

    if (aOuter != nsnull) {
        return NS_ERROR_NO_AGGREGATION;
    }

    nsEnvironment* obj = new nsEnvironment();
    if (!obj) {
        return NS_ERROR_OUT_OF_MEMORY;
    }

    obj->mLock = PR_NewLock();
    if (!obj->mLock) {
        delete obj;
        return NS_ERROR_OUT_OF_MEMORY;
    }

    rv = obj->QueryInterface(aIID, aResult);
    if (NS_FAILED(rv)) {
      delete obj;
    }
    return rv;
}

Here is the call graph for this function:

boolean nsIEnvironment::exists ( in AString  aName) [inherited]

Check the existence of an environment variable.

This method checks whether an environment variable is present in the environment or not.

  • For Unix/Linux platforms we follow the Unix definition: An environment variable exists when |getenv()| returns a non-NULL value. An environment variable does not exist when |getenv()| returns NULL.
    • For non-Unix/Linux platforms we have to fall back to a "portable" definition (which is incorrect for Unix/Linux!!!!) which simply checks whether the string returned by |Get()| is empty or not.
Parameters:
aNamethe variable name to probe.
Returns:
if the variable has been set, the value returned is PR_TRUE. If the variable was not defined in the environment PR_FALSE will be returned.
AString nsIEnvironment::get ( in AString  aName) [inherited]

Get the value of an environment variable.

Parameters:
aNamethe variable name to retrieve.
Returns:
returns the value of the env variable. An empty string will be returned when the env variable does not exist or when the value itself is an empty string - please use |exists()| to probe whether the env variable exists or not.
void nsIEnvironment::set ( in AString  aName,
in AString  aValue 
) [inherited]

Set the value of an environment variable.

Parameters:
aNamethe variable name to set.
aValuethe value to set.

Member Data Documentation

Definition at line 64 of file nsEnvironment.h.


The documentation for this class was generated from the following files: