From 76b90d310def447b7b5f10d92a69813308150778 Mon Sep 17 00:00:00 2001 From: "tfarina@chromium.org" Date: Tue, 3 Aug 2010 03:00:50 +0000 Subject: 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 Review URL: http://codereview.chromium.org/3052034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54696 0039d316-1c4b-4281-b951-d872f2087c98 --- base/environment.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 base/environment.h (limited to 'base/environment.h') 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 + +#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_ -- cgit v1.1