diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-22 01:10:38 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-06-22 01:10:38 +0900 |
| commit | 07d270c87e6f9184aea4ca17eb26e466712e8db2 (patch) | |
| tree | 2dfbaa2e0d2ad0f38cb73098608f7d67a64320f8 /src/Netrc.cc | |
| parent | 126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8 (diff) | |
Require -std=c++11 and use std::shared_ptr instead of SharedHandle
Diffstat (limited to 'src/Netrc.cc')
| -rw-r--r-- | src/Netrc.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Netrc.cc b/src/Netrc.cc index cbcfc063..0c7743d5 100644 --- a/src/Netrc.cc +++ b/src/Netrc.cc @@ -107,7 +107,7 @@ Netrc::Netrc() {} Netrc::~Netrc() {} -void Netrc::addAuthenticator(const SharedHandle<Authenticator>& authenticator) +void Netrc::addAuthenticator(const std::shared_ptr<Authenticator>& authenticator) { authenticators_.push_back(authenticator); } @@ -146,7 +146,7 @@ void Netrc::parse(const std::string& path) SET_ACCOUNT, SET_MACDEF }; - SharedHandle<Authenticator> authenticator; + std::shared_ptr<Authenticator> authenticator; STATE state = GET_TOKEN; while(1) { std::string line = fp.getLine(); @@ -215,7 +215,7 @@ void Netrc::parse(const std::string& path) storeAuthenticator(authenticator); } -void Netrc::storeAuthenticator(const SharedHandle<Authenticator>& authenticator) +void Netrc::storeAuthenticator(const std::shared_ptr<Authenticator>& authenticator) { if(authenticator) { authenticators_.push_back(authenticator); @@ -229,18 +229,18 @@ private: public: AuthHostMatch(const std::string& hostname):hostname(hostname) {} - bool operator()(const SharedHandle<Authenticator>& authenticator) + bool operator()(const std::shared_ptr<Authenticator>& authenticator) { return authenticator->match(hostname); } }; } // namespace -SharedHandle<Authenticator> +std::shared_ptr<Authenticator> Netrc::findAuthenticator(const std::string& hostname) const { - SharedHandle<Authenticator> res; - std::vector<SharedHandle<Authenticator> >::const_iterator itr = + std::shared_ptr<Authenticator> res; + std::vector<std::shared_ptr<Authenticator> >::const_iterator itr = std::find_if(authenticators_.begin(), authenticators_.end(), AuthHostMatch(hostname)); if(itr != authenticators_.end()) { |
