9#ifndef LLDB_UTILITY_ENVIRONMENT_H
10#define LLDB_UTILITY_ENVIRONMENT_H
12#include "llvm/ADT/StringMap.h"
13#include "llvm/Support/Allocator.h"
14#include "llvm/Support/FormatProviders.h"
19 using Base = llvm::StringMap<std::string>;
28 operator char *
const *()
const {
return get(); }
41 using Base::const_iterator;
43 using Base::value_type;
53 using Base::insert_or_assign;
56 using Base::try_emplace;
57 using Base::operator[];
63 :
Environment(const_cast<const char *const *>(Env)) {}
67 Base::operator=(std::move(RHS));
71 std::pair<iterator, bool>
insert(llvm::StringRef KeyEqValue) {
72 auto Split = KeyEqValue.split(
'=');
73 return insert(std::make_pair(Split.first, std::string(Split.second)));
76 void insert(iterator first, iterator last);
80 static std::string
compose(
const value_type &KeyValue) {
81 return (KeyValue.first() +
"=" + KeyValue.second).str();
91 for (
const auto &KV : Env)
92 Stream <<
"env[" << KV.first() <<
"] = " << KV.second <<
"\n";
char *const * get() const
Envp & operator=(Envp &&RHS)=default
char * make_entry(llvm::StringRef Key, llvm::StringRef Value)
llvm::BumpPtrAllocator Allocator
Envp(const Envp &)=delete
Envp & operator=(const Envp &)=delete
Environment(const Environment &RHS)
Environment(char *const *Env)
Environment & operator=(Environment RHS)
static std::string compose(const value_type &KeyValue)
std::pair< iterator, bool > insert(llvm::StringRef KeyEqValue)
Environment(Environment &&RHS)
llvm::StringMap< std::string > Base
A class that represents a running process on the host machine.