mirror of https://github.com/aria2/aria2
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Renamed member variables. * src/Netrc.cc * src/Netrc.hpull/1/head
parent
cc95c788b1
commit
6f89b0287a
|
@ -1,3 +1,9 @@
|
||||||
|
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Renamed member variables.
|
||||||
|
* src/Netrc.cc
|
||||||
|
* src/Netrc.h
|
||||||
|
|
||||||
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-06-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Renamed member variables.
|
Renamed member variables.
|
||||||
|
|
|
@ -68,7 +68,7 @@ void Netrc::skipMacdef(std::ifstream& f) const
|
||||||
|
|
||||||
void Netrc::parse(const std::string& path)
|
void Netrc::parse(const std::string& path)
|
||||||
{
|
{
|
||||||
authenticators.clear();
|
_authenticators.clear();
|
||||||
std::ifstream f(path.c_str(), std::ios::binary);
|
std::ifstream f(path.c_str(), std::ios::binary);
|
||||||
|
|
||||||
if(!f) {
|
if(!f) {
|
||||||
|
@ -146,7 +146,7 @@ void Netrc::parse(const std::string& path)
|
||||||
void Netrc::storeAuthenticator(const SharedHandle<Authenticator>& authenticator)
|
void Netrc::storeAuthenticator(const SharedHandle<Authenticator>& authenticator)
|
||||||
{
|
{
|
||||||
if(!authenticator.isNull()) {
|
if(!authenticator.isNull()) {
|
||||||
authenticators.push_back(authenticator);
|
_authenticators.push_back(authenticator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,9 +167,9 @@ Netrc::findAuthenticator(const std::string& hostname) const
|
||||||
{
|
{
|
||||||
SharedHandle<Authenticator> res;
|
SharedHandle<Authenticator> res;
|
||||||
std::vector<SharedHandle<Authenticator> >::const_iterator itr =
|
std::vector<SharedHandle<Authenticator> >::const_iterator itr =
|
||||||
std::find_if(authenticators.begin(), authenticators.end(),
|
std::find_if(_authenticators.begin(), _authenticators.end(),
|
||||||
AuthHostMatch(hostname));
|
AuthHostMatch(hostname));
|
||||||
if(itr != authenticators.end()) {
|
if(itr != _authenticators.end()) {
|
||||||
res = *itr;
|
res = *itr;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
40
src/Netrc.h
40
src/Netrc.h
|
@ -55,10 +55,10 @@ public:
|
||||||
|
|
||||||
class Authenticator : public Authenticatable {
|
class Authenticator : public Authenticatable {
|
||||||
private:
|
private:
|
||||||
std::string machine;
|
std::string _machine;
|
||||||
std::string login;
|
std::string _login;
|
||||||
std::string password;
|
std::string _password;
|
||||||
std::string account;
|
std::string _account;
|
||||||
public:
|
public:
|
||||||
Authenticator() {}
|
Authenticator() {}
|
||||||
|
|
||||||
|
@ -66,45 +66,45 @@ public:
|
||||||
const std::string& login,
|
const std::string& login,
|
||||||
const std::string& password,
|
const std::string& password,
|
||||||
const std::string& account)
|
const std::string& account)
|
||||||
:machine(machine),
|
:_machine(machine),
|
||||||
login(login),
|
_login(login),
|
||||||
password(password),
|
_password(password),
|
||||||
account(account) {}
|
_account(account) {}
|
||||||
|
|
||||||
virtual ~Authenticator() {}
|
virtual ~Authenticator() {}
|
||||||
|
|
||||||
virtual bool match(const std::string& hostname) const
|
virtual bool match(const std::string& hostname) const
|
||||||
{
|
{
|
||||||
return hostname == machine;
|
return hostname == _machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& getMachine() const
|
const std::string& getMachine() const
|
||||||
{
|
{
|
||||||
return machine;
|
return _machine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMachine(const std::string& machine) { this->machine = machine; }
|
void setMachine(const std::string& machine) { _machine = machine; }
|
||||||
|
|
||||||
const std::string& getLogin() const
|
const std::string& getLogin() const
|
||||||
{
|
{
|
||||||
return login;
|
return _login;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setLogin(const std::string& login) { this->login = login; }
|
void setLogin(const std::string& login) { _login = login; }
|
||||||
|
|
||||||
const std::string& getPassword() const
|
const std::string& getPassword() const
|
||||||
{
|
{
|
||||||
return password;
|
return _password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPassword(const std::string& password) { this->password = password; }
|
void setPassword(const std::string& password) { _password = password; }
|
||||||
|
|
||||||
const std::string& getAccount() const
|
const std::string& getAccount() const
|
||||||
{
|
{
|
||||||
return account;
|
return _account;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAccount(const std::string& account) { this->account = account; }
|
void setAccount(const std::string& account) { _account = account; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultAuthenticator : public Authenticator {
|
class DefaultAuthenticator : public Authenticator {
|
||||||
|
@ -126,7 +126,7 @@ public:
|
||||||
|
|
||||||
class Netrc {
|
class Netrc {
|
||||||
private:
|
private:
|
||||||
std::vector<SharedHandle<Authenticator> > authenticators;
|
std::vector<SharedHandle<Authenticator> > _authenticators;
|
||||||
|
|
||||||
void storeAuthenticator(const SharedHandle<Authenticator>& authenticator);
|
void storeAuthenticator(const SharedHandle<Authenticator>& authenticator);
|
||||||
|
|
||||||
|
@ -143,12 +143,12 @@ public:
|
||||||
|
|
||||||
const std::vector<SharedHandle<Authenticator> >& getAuthenticators() const
|
const std::vector<SharedHandle<Authenticator> >& getAuthenticators() const
|
||||||
{
|
{
|
||||||
return authenticators;
|
return _authenticators;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addAuthenticator(const SharedHandle<Authenticator>& authenticator)
|
void addAuthenticator(const SharedHandle<Authenticator>& authenticator)
|
||||||
{
|
{
|
||||||
authenticators.push_back(authenticator);
|
_authenticators.push_back(authenticator);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string MACHINE;
|
static const std::string MACHINE;
|
||||||
|
|
Loading…
Reference in New Issue