SshConnectionParameters: Fix compiler warning about inline vs export

by making operator== non-inline.

Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Friedemann Kleint
2010-08-24 10:51:31 +02:00
parent 0f4a66e785
commit e3b1279f65
2 changed files with 29 additions and 9 deletions

View File

@@ -65,6 +65,31 @@ namespace {
staticInitMutex.unlock(); staticInitMutex.unlock();
} }
} }
} // anonymous namespace
SshConnectionParameters::SshConnectionParameters() :
timeout(0), authType(AuthByKey), port(0)
{
}
static inline bool equals(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return p1.host == p2.host && p1.uname == p2.uname
&& p1.authType == p2.authType
&& (p1.authType == SshConnectionParameters::AuthByPwd ?
p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile)
&& p1.timeout == p2.timeout && p1.port == p2.port;
}
CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return equals(p1, p2);
}
CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2)
{
return !equals(p1, p2);
} }
// TODO: Mechanism for checking the host key. First connection to host: save, later: compare // TODO: Mechanism for checking the host key. First connection to host: save, later: compare

View File

@@ -49,6 +49,8 @@ class SshConnectionPrivate;
struct CORE_EXPORT SshConnectionParameters struct CORE_EXPORT SshConnectionParameters
{ {
SshConnectionParameters();
QString host; QString host;
QString uname; QString uname;
QString pwd; QString pwd;
@@ -57,16 +59,9 @@ struct CORE_EXPORT SshConnectionParameters
enum AuthType { AuthByPwd, AuthByKey } authType; enum AuthType { AuthByPwd, AuthByKey } authType;
quint16 port; quint16 port;
}; };
CORE_EXPORT inline bool operator==(const SshConnectionParameters &p1,
const SshConnectionParameters &p2)
{
return p1.host == p2.host && p1.uname == p2.uname
&& p1.authType == p2.authType
&& (p1.authType == SshConnectionParameters::AuthByPwd ?
p1.pwd == p2.pwd : p1.privateKeyFile == p2.privateKeyFile)
&& p1.timeout == p2.timeout && p1.port == p2.port;
}
CORE_EXPORT bool operator==(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
CORE_EXPORT bool operator!=(const SshConnectionParameters &p1, const SshConnectionParameters &p2);
/* /*
* This class provides an SSH connection, implementing protocol version 2.0 * This class provides an SSH connection, implementing protocol version 2.0