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

Side by Side Diff: base/env_var.h

Issue 3012001: Move implementation from header to source. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: blank line 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
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
18 // Gets an environment variable's value and stores it in |result|. 19 // Gets an environment variable's value and stores it in |result|.
19 // Returns false if the key is unset. 20 // Returns false if the key is unset.
20 virtual bool GetEnv(const char* variable_name, std::string* result) = 0; 21 virtual bool GetEnv(const char* variable_name, std::string* result) = 0;
21 22
22 // Syntactic sugar for GetEnv(variable_name, NULL); 23 // Syntactic sugar for GetEnv(variable_name, NULL);
23 virtual bool HasEnv(const char* variable_name) { 24 virtual bool HasEnv(const char* variable_name);
24 return GetEnv(variable_name, NULL);
25 }
26 25
27 virtual void SetEnv(const char* variable_name, 26 virtual void SetEnv(const char* variable_name,
28 const std::string& new_value) = 0; 27 const std::string& new_value) = 0;
29 28
30 // Create an instance of EnvVarGetter 29 // Create an instance of EnvVarGetter
31 static EnvVarGetter* Create(); 30 static EnvVarGetter* Create();
32 }; 31 };
33 32
34 } // namespace base 33 } // namespace base
35 34
36 #endif // BASE_ENV_VAR_H_ 35 #endif // BASE_ENV_VAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698