Updating trunk VERSION from 833.0 to 834.0
[chromium-blink-merge.git] / base / environment.h
blob9d2a662391013fc1c7b3e0ba1ff5ac2f68288a02
1 // Copyright (c) 2011 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.
5 #ifndef BASE_ENVIRONMENT_H_
6 #define BASE_ENVIRONMENT_H_
7 #pragma once
9 #include <string>
11 #include "base/base_api.h"
12 #include "build/build_config.h"
14 namespace base {
16 namespace env_vars {
18 #if defined(OS_POSIX)
19 BASE_API extern const char kHome[];
20 #endif
22 } // namespace env_vars
24 class BASE_API Environment {
25 public:
26 virtual ~Environment();
28 // Static factory method that returns the implementation that provide the
29 // appropriate platform-specific instance.
30 static Environment* Create();
32 // Gets an environment variable's value and stores it in |result|.
33 // Returns false if the key is unset.
34 virtual bool GetVar(const char* variable_name, std::string* result) = 0;
36 // Syntactic sugar for GetVar(variable_name, NULL);
37 virtual bool HasVar(const char* variable_name);
39 // Returns true on success, otherwise returns false.
40 virtual bool SetVar(const char* variable_name,
41 const std::string& new_value) = 0;
43 // Returns true on success, otherwise returns false.
44 virtual bool UnSetVar(const char* variable_name) = 0;
47 } // namespace base
49 #endif // BASE_ENVIRONMENT_H_