blob: 3ee4352d5430c0180ffd87d438412d04e0344c8f [file] [log] [blame]
// Copyright (c) 2012 The Chromium OS 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 SHILL_SHIMS_ENVIRONMENT_H_
#define SHILL_SHIMS_ENVIRONMENT_H_
#include <map>
#include <string>
#include <base/lazy_instance.h>
namespace shill {
namespace shims {
// Environment access utilities.
class Environment {
public:
virtual ~Environment();
// This is a singleton -- use Environment::GetInstance()->Foo().
static Environment *GetInstance();
// Sets |value| to the value of environment variable |name| and returns
// true. Returns false if variable |name| is not set.
virtual bool GetVariable(const std::string &name, std::string *value);
// Parses and returns the environment as a name->value string map.
virtual std::map<std::string, std::string> AsMap();
protected:
Environment();
private:
friend struct base::DefaultLazyInstanceTraits<Environment>;
DISALLOW_COPY_AND_ASSIGN(Environment);
};
} // namespace shims
} // namespace shill
#endif // SHILL_SHIMS_ENVIRONMENT_H_