diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 03:00:50 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-03 03:00:50 +0000 |
commit | 76b90d310def447b7b5f10d92a69813308150778 (patch) | |
tree | 24c61fdccf94360913bfa8f7ac67c24a27bcfb38 /base/environment.h | |
parent | 7f2a9dbe56bfa6189271af808c53ccaee193a961 (diff) | |
download | chromium_src-76b90d310def447b7b5f10d92a69813308150778.zip chromium_src-76b90d310def447b7b5f10d92a69813308150778.tar.gz chromium_src-76b90d310def447b7b5f10d92a69813308150778.tar.bz2 |
base: Rename EnvVarGetter to Environment.
Now EnvVarGetter do much more than getting environment variables.
Per suggestion from Pawel in http://codereview.chromium.org/3043018/.
BUG=None
TEST=trybots
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Review URL: http://codereview.chromium.org/3052034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/environment.h')
-rw-r--r-- | base/environment.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/base/environment.h b/base/environment.h new file mode 100644 index 0000000..a586ae8 --- /dev/null +++ b/base/environment.h @@ -0,0 +1,48 @@ +// 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_ENVIRONMENT_H_ +#define BASE_ENVIRONMENT_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 + +class Environment { + public: + virtual ~Environment(); + + // Static factory method that returns the implementation that provide the + // appropriate platform-specific instance. + static Environment* Create(); + + // 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; + + // Returns true on success, otherwise returns false. + virtual bool UnSetEnv(const char* variable_name) = 0; +}; + +} // namespace base + +#endif // BASE_ENVIRONMENT_H_ |