xpcom/threads/nsIEnvironment.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/threads/nsIEnvironment.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +/**
    1.12 + * Scriptable access to the current process environment.
    1.13 + *
    1.14 + */
    1.15 +[scriptable, uuid(101d5941-d820-4e85-a266-9a3469940807)]
    1.16 +interface nsIEnvironment : nsISupports
    1.17 +{
    1.18 +    /**
    1.19 +     * Set the value of an environment variable.
    1.20 +     *
    1.21 +     * @param aName   the variable name to set.
    1.22 +     * @param aValue  the value to set.
    1.23 +     */
    1.24 +    void set(in AString aName, in AString aValue);
    1.25 +
    1.26 +    /**
    1.27 +     * Get the value of an environment variable.
    1.28 +     *
    1.29 +     * @param aName   the variable name to retrieve.
    1.30 +     * @return        returns the value of the env variable. An empty string
    1.31 +     *                will be returned when the env variable does not exist or
    1.32 +     *                when the value itself is an empty string - please use
    1.33 +     *                |exists()| to probe whether the env variable exists
    1.34 +     *                or not.
    1.35 +     */
    1.36 +    AString get(in AString aName);
    1.37 +
    1.38 +    /**
    1.39 +     * Check the existence of an environment variable.
    1.40 +     * This method checks whether an environment variable is present in
    1.41 +     * the environment or not.
    1.42 +     *
    1.43 +     * - For Unix/Linux platforms we follow the Unix definition:
    1.44 +     * An environment variable exists when |getenv()| returns a non-NULL value.
    1.45 +     * An environment variable does not exist when |getenv()| returns NULL.
    1.46 +     * - For non-Unix/Linux platforms we have to fall back to a 
    1.47 +     * "portable" definition (which is incorrect for Unix/Linux!!!!)
    1.48 +     * which simply checks whether the string returned by |Get()| is empty
    1.49 +     * or not.
    1.50 +     *
    1.51 +     * @param aName   the variable name to probe.
    1.52 +     * @return        if the variable has been set, the value returned is
    1.53 +     *                PR_TRUE. If the variable was not defined in the
    1.54 +     *                environment PR_FALSE will be returned.
    1.55 +     */
    1.56 +    boolean exists(in AString aName);
    1.57 +};
    1.58 +

mercurial