blob: 9622e74768474a5353b9cf021bfc695d01d44d17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_ENV_VAR_H_
#define BASE_ENV_VAR_H_
#pragma once
#include <string>
#include "base/basictypes.h"
namespace base {
namespace env_vars {
#if defined(OS_POSIX)
extern const char kHome[];
#endif
} // namespace env_vars
// These are used to derive mocks for unittests.
class EnvVarGetter {
public:
virtual ~EnvVarGetter();
// Gets an environment variable's value and stores it in |result|.
// Returns false if the key is unset.
virtual bool GetEnv(const char* variable_name, std::string* result) = 0;
// Syntactic sugar for GetEnv(variable_name, NULL);
virtual bool HasEnv(const char* variable_name);
// Returns true on success, otherwise returns false.
virtual bool SetEnv(const char* variable_name,
const std::string& new_value) = 0;
// Create an instance of EnvVarGetter
static EnvVarGetter* Create();
};
} // namespace base
#endif // BASE_ENV_VAR_H_
|