diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-28 12:30:11 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2010-02-28 12:30:11 +0000 |
| commit | c342bde9627b434effbc0cd10b817670d1da0923 (patch) | |
| tree | 60d14bf448066b8dcd639adfa0db716d5a8258c8 /src/Netrc.h | |
| parent | 135f0a2a8c4ee04a5e96d84ba558245fabfc1f5c (diff) | |
2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use vector instead of deque for containers which is used for
mostly read-only purpose.
Diffstat (limited to 'src/Netrc.h')
| -rw-r--r-- | src/Netrc.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/Netrc.h b/src/Netrc.h index 7be2581c..ec17bcba 100644 --- a/src/Netrc.h +++ b/src/Netrc.h @@ -36,12 +36,14 @@ #define _D_NETRC_H_ #include "common.h" -#include "SharedHandle.h" -#include "A2STR.h" + #include <string> -#include <deque> +#include <vector> #include <iosfwd> +#include "SharedHandle.h" +#include "A2STR.h" + namespace aria2 { class Authenticatable { @@ -51,8 +53,6 @@ public: virtual bool match(const std::string& hostname) const = 0; }; -typedef SharedHandle<Authenticatable> AuthenticatableHandle; - class Authenticator : public Authenticatable { private: std::string machine; @@ -107,9 +107,6 @@ public: void setAccount(const std::string& account) { this->account = account; } }; -typedef SharedHandle<Authenticator> AuthenticatorHandle; -typedef std::deque<AuthenticatorHandle> Authenticators; - class DefaultAuthenticator : public Authenticator { public: DefaultAuthenticator() {} @@ -127,13 +124,11 @@ public: } }; -typedef SharedHandle<DefaultAuthenticator> DefaultAuthenticatorHandle; - class Netrc { private: - Authenticators authenticators; + std::vector<SharedHandle<Authenticator> > authenticators; - void storeAuthenticator(const AuthenticatorHandle& authenticator); + void storeAuthenticator(const SharedHandle<Authenticator>& authenticator); std::string getRequiredNextToken(std::ifstream& f) const; @@ -143,14 +138,15 @@ public: void parse(const std::string& path); - AuthenticatorHandle findAuthenticator(const std::string& hostname) const; + SharedHandle<Authenticator> findAuthenticator + (const std::string& hostname) const; - const Authenticators& getAuthenticators() const + const std::vector<SharedHandle<Authenticator> >& getAuthenticators() const { return authenticators; } - void addAuthenticator(const AuthenticatorHandle& authenticator) + void addAuthenticator(const SharedHandle<Authenticator>& authenticator) { authenticators.push_back(authenticator); } @@ -168,8 +164,6 @@ public: static const std::string MACDEF; }; -typedef SharedHandle<Netrc> NetrcHandle; - } // namespace aria2 #endif // _D_NETRC_H_ |
