Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: base/env_var.h

Issue 2843048: base: Add SetEnv() to EnvVarGetter class and get rid of the some ifdefs. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: filename Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/env_var.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_ENV_VAR_H_ 5 #ifndef BASE_ENV_VAR_H_
6 #define BASE_ENV_VAR_H_ 6 #define BASE_ENV_VAR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 11
12 namespace base { 12 namespace base {
13 13
14 // These are used to derive mocks for unittests. 14 // These are used to derive mocks for unittests.
15 class EnvVarGetter { 15 class EnvVarGetter {
16 public: 16 public:
17 virtual ~EnvVarGetter() {} 17 virtual ~EnvVarGetter() {}
18 // Gets an environment variable's value and stores it in |result|. 18 // Gets an environment variable's value and stores it in |result|.
19 // Returns false if the key is unset. 19 // Returns false if the key is unset.
20 virtual bool GetEnv(const char* variable_name, std::string* result) = 0; 20 virtual bool GetEnv(const char* variable_name, std::string* result) = 0;
21 21
22 // Syntactic sugar for GetEnv(variable_name, NULL); 22 // Syntactic sugar for GetEnv(variable_name, NULL);
23 virtual bool HasEnv(const char* variable_name) { 23 virtual bool HasEnv(const char* variable_name) {
24 return GetEnv(variable_name, NULL); 24 return GetEnv(variable_name, NULL);
25 } 25 }
26 26
27 virtual void SetEnv(const char* variable_name,
28 const std::string& new_value) = 0;
29
27 // Create an instance of EnvVarGetter 30 // Create an instance of EnvVarGetter
28 static EnvVarGetter* Create(); 31 static EnvVarGetter* Create();
29 }; 32 };
30 33
31 } // namespace base 34 } // namespace base
32 35
33 #endif // BASE_ENV_VAR_H_ 36 #endif // BASE_ENV_VAR_H_
OLDNEW
« no previous file with comments | « no previous file | base/env_var.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698