diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2018-12-08 10:43:50 +0100 |
| commit | 0c1d1a0f24655c22a373c19aac90a6a225a353e6 (patch) | |
| tree | e65fe3c5f8b80bb59910c81c700eb3ed545848bb /src/environment.cpp | |
| parent | f22d1b76c9a957a679b57ddcb67b33cc73a15de1 (diff) | |
| download | wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.tar.xz wanda-0c1d1a0f24655c22a373c19aac90a6a225a353e6.zip | |
wanda: reformat source code
Diffstat (limited to 'src/environment.cpp')
| -rw-r--r-- | src/environment.cpp | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index e5c8c6d..abcf62a 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -4,69 +4,68 @@ namespace wanda { - -environment::environment(char const *const *env) -{ + environment::environment(char const * const * env) + { if (!env) { - return; + return; } std::string buffer{}; for (; *env != nullptr; ++env) { - buffer = *env; - int split_point = buffer.find('='); - if (split_point != std::string::npos) - { - m_cache[buffer.substr(0, split_point)] = buffer.substr(split_point + 1); - } + buffer = *env; + int split_point = buffer.find('='); + if (split_point != std::string::npos) + { + m_cache[buffer.substr(0, split_point)] = buffer.substr(split_point + 1); + } } -} + } -std::string & environment::operator[](std::string const & variable) -{ + std::string & environment::operator[](std::string const & variable) + { return m_cache[variable]; -} + } -std::string const & environment::operator[](std::string const & variable) const -{ + std::string const & environment::operator[](std::string const & variable) const + { static std::string const empty{}; - if(auto needle = m_cache.find(variable); needle != cend()) + if (auto needle = m_cache.find(variable); needle != cend()) { - return needle->second; + return needle->second; } return empty; -} + } -environment::iterator environment::begin() -{ + environment::iterator environment::begin() + { return m_cache.begin(); -} + } -environment::const_iterator environment::begin() const -{ + environment::const_iterator environment::begin() const + { return m_cache.begin(); -} + } -environment::const_iterator environment::cbegin() const -{ + environment::const_iterator environment::cbegin() const + { return m_cache.cbegin(); -} + } -environment::iterator environment::end() -{ + environment::iterator environment::end() + { return m_cache.end(); -} + } -environment::const_iterator environment::end() const -{ + environment::const_iterator environment::end() const + { return m_cache.end(); -} + } -environment::const_iterator environment::cend() const -{ + environment::const_iterator environment::cend() const + { return m_cache.cend(); -} + } -} // namespace wanda
\ No newline at end of file +} // namespace wanda
\ No newline at end of file |
