Environment::get

This commit is contained in:
Kelvin Sherlock 2016-02-11 15:49:19 -05:00
parent a7dce37fe6
commit a6913f7c46
2 changed files with 8 additions and 5 deletions

View File

@ -20,6 +20,11 @@ namespace {
}
}
std::string Environment::get(const std::string & key) const {
auto iter = find(key);
if (iter == end()) return "";
return iter->second;
}
Environment::iterator Environment::find( const std::string & key ) {
std::string k(key);

View File

@ -56,13 +56,13 @@ public:
void unset(const std::string &k);
void unset();
std::string get(const std::string &k) const;
constexpr bool echo() const noexcept { return _echo; }
constexpr bool test() const noexcept { return _test; }
constexpr bool exit() const noexcept { return _and_or ? false : _exit; }
constexpr bool exit() const noexcept { return _exit; }
constexpr int status() const noexcept { return _status; }
bool and_or(bool v) { std::swap(v, _and_or); return v; }
int status(int i, bool throw_up = true);
int status(int i, const std::nothrow_t &);
@ -108,8 +108,6 @@ private:
bool _exit = false;
bool _test = false;
bool _and_or = false;
bool _echo = false;
int _status = 0;
bool _startup = false;