on xenial help sign in
Make Get/GetAll const
commit7e97f61d1fc5f424a03d80c92a19bd9d2eecbb8d authorMichael Terry <michael.terry@canonical.com> dateTue 9 Feb 2016, 08:58 (11 years ago) parent84f8b38
2 files changed+5−5
tests/plugins/AccountsService/PropertiesServer.cpp+3−3 tests/plugins/AccountsService/PropertiesServer.h+2−2
tests/plugins/AccountsService/PropertiesServer.cpp+3−3
@@ -32,9 +32,9 @@ PropertiesServer::PropertiesServer(QObject *parent)
3232 Reset();
3333}
3434
35−QDBusVariant PropertiesServer::Get(const QString &interface, const QString &property)
35+QDBusVariant PropertiesServer::Get(const QString &interface, const QString &property) const
3636{
37− if (m_properties[interface].contains(property)) {
37+ if (m_properties.contains(interface) && m_properties[interface].contains(property)) {
3838 return QDBusVariant(m_properties[interface][property]);
3939 } else {
4040 sendErrorReply(QDBusError::InvalidArgs, "Bad interface or property");
@@ -42,7 +42,7 @@ QDBusVariant PropertiesServer::Get(const QString &interface, const QString &prop
4242 }
4343}
4444
45−QVariantMap PropertiesServer::GetAll(const QString &interface)
45+QVariantMap PropertiesServer::GetAll(const QString &interface) const
4646{
4747 if (m_properties.contains(interface)) {
4848 return m_properties[interface];
tests/plugins/AccountsService/PropertiesServer.h+2−2
@@ -34,8 +34,8 @@ public:
3434 explicit PropertiesServer(QObject *parent = 0);
3535
3636public Q_SLOTS:
37− QDBusVariant Get(const QString &interface, const QString &property);
38− QVariantMap GetAll(const QString &interface);
37+ QDBusVariant Get(const QString &interface, const QString &property) const;
38+ QVariantMap GetAll(const QString &interface) const;
3939 void Set(const QString &interface, const QString &property, const QDBusVariant &variant);
4040
4141 // mock only.