OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef BASE_ENV_VAR_H_ |
| 6 #define BASE_ENV_VAR_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 namespace base { |
| 13 |
| 14 // These are used to derive mocks for unittests. |
| 15 class EnvVarGetter { |
| 16 public: |
| 17 virtual ~EnvVarGetter() {} |
| 18 // Gets an environment variable's value and stores it in |result|. |
| 19 // Returns false if the key is unset. |
| 20 virtual bool GetEnv(const char* variable_name, std::string* result) = 0; |
| 21 |
| 22 // Syntactic sugar for GetEnv(variable_name, NULL); |
| 23 virtual bool HasEnv(const char* variable_name) { |
| 24 return GetEnv(variable_name, NULL); |
| 25 } |
| 26 |
| 27 // Create an instance of EnvVarGetter |
| 28 static EnvVarGetter* Create(); |
| 29 }; |
| 30 |
| 31 } // namespace base |
| 32 |
| 33 #endif // BASE_ENV_VAR_H_ |
OLD | NEW |