1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla embedding code.
|
---|
16 | *
|
---|
17 | * The Initial Developers of the Original Code are
|
---|
18 | * Benjamin Smedberg <[email protected]> and
|
---|
19 | * Roland Mainz <[email protected]>.
|
---|
20 | *
|
---|
21 | * Portions created by the Initial Developer are Copyright (C) 2003/2004
|
---|
22 | * the Initial Developer. All Rights Reserved.
|
---|
23 | *
|
---|
24 | * Contributor(s):
|
---|
25 | *
|
---|
26 | * Alternatively, the contents of this file may be used under the terms of
|
---|
27 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
28 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
29 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
30 | * of those above. If you wish to allow use of your version of this file only
|
---|
31 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
32 | * use your version of this file under the terms of the MPL, indicate your
|
---|
33 | * decision by deleting the provisions above and replace them with the notice
|
---|
34 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
35 | * the provisions above, a recipient may use your version of this file under
|
---|
36 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
37 | *
|
---|
38 | * ***** END LICENSE BLOCK ***** */
|
---|
39 |
|
---|
40 | #include "nsISupports.idl"
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * Scriptable access to the current process environment.
|
---|
44 | *
|
---|
45 | */
|
---|
46 | [scriptable, uuid(101d5941-d820-4e85-a266-9a3469940807)]
|
---|
47 | interface nsIEnvironment : nsISupports
|
---|
48 | {
|
---|
49 | /**
|
---|
50 | * Set the value of an environment variable.
|
---|
51 | *
|
---|
52 | * @param aName the variable name to set.
|
---|
53 | * @param aValue the value to set.
|
---|
54 | */
|
---|
55 | void set(in AString aName, in AString aValue);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Get the value of an environment variable.
|
---|
59 | *
|
---|
60 | * @param aName the variable name to retrieve.
|
---|
61 | * @return returns the value of the env variable. An empty string
|
---|
62 | * will be returned when the env variable does not exist or
|
---|
63 | * when the value itself is an empty string - please use
|
---|
64 | * |exists()| to probe whether the env variable exists
|
---|
65 | * or not.
|
---|
66 | */
|
---|
67 | AString get(in AString aName);
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Check the existence of an environment variable.
|
---|
71 | * This method checks whether an environment variable is present in
|
---|
72 | * the environment or not.
|
---|
73 | *
|
---|
74 | * - For Unix/Linux platforms we follow the Unix definition:
|
---|
75 | * An environment variable exists when |getenv()| returns a non-NULL value.
|
---|
76 | * An environment variable does not exist when |getenv()| returns NULL.
|
---|
77 | * - For non-Unix/Linux platforms we have to fall back to a
|
---|
78 | * "portable" definition (which is incorrect for Unix/Linux!!!!)
|
---|
79 | * which simply checks whether the string returned by |Get()| is empty
|
---|
80 | * or not.
|
---|
81 | *
|
---|
82 | * @param aName the variable name to probe.
|
---|
83 | * @return if the variable has been set, the value returned is
|
---|
84 | * PR_TRUE. If the variable was not defined in the
|
---|
85 | * environment PR_FALSE will be returned.
|
---|
86 | */
|
---|
87 | boolean exists(in AString aName);
|
---|
88 | };
|
---|
89 |
|
---|