Use nested namespaces (C++17 feature)

This commit is contained in:
Mat Sutcliffe
2021-09-15 21:44:54 +01:00
parent 3f2e5b0b69
commit 57d32da826
1345 changed files with 146075 additions and 150376 deletions

View File

@@ -13,55 +13,52 @@
#include <QJsonValue>
#include <tuple>
namespace BlackMisc
namespace BlackMisc::Network
{
namespace Network
CRoleList::CRoleList() { }
bool CRoleList::hasRole(const QString &roleName) const
{
CRoleList::CRoleList() { }
return this->contains(&CRole::getName, roleName.trimmed().toUpper());
}
bool CRoleList::hasRole(const QString &roleName) const
bool CRoleList::hasRole(const CRole &role) const
{
return hasRole(role.getName());
}
bool CRoleList::hasAnyRole(const QStringList &roles) const
{
for (const QString &r : roles)
{
return this->contains(&CRole::getName, roleName.trimmed().toUpper());
if (this->hasRole(r)) { return true; }
}
return false;
}
bool CRoleList::hasRole(const CRole &role) const
CRoleList::CRoleList(const CSequence<CRole> &other) :
CSequence<CRole>(other)
{ }
QString CRoleList::namesAsString(const QString &separator) const
{
QStringList rolesString;
rolesString.reserve(size());
for (const CRole &role : (*this))
{
return hasRole(role.getName());
rolesString.append(role.getName());
}
return rolesString.join(separator);
}
bool CRoleList::hasAnyRole(const QStringList &roles) const
CRoleList CRoleList::fromDatabaseJson(const QJsonArray &array)
{
CRoleList roles;
for (const QJsonValue &value : array)
{
for (const QString &r : roles)
{
if (this->hasRole(r)) { return true; }
}
return false;
roles.push_back(CRole::fromDatabaseJson(value.toObject()));
}
return roles;
}
CRoleList::CRoleList(const CSequence<CRole> &other) :
CSequence<CRole>(other)
{ }
QString CRoleList::namesAsString(const QString &separator) const
{
QStringList rolesString;
rolesString.reserve(size());
for (const CRole &role : (*this))
{
rolesString.append(role.getName());
}
return rolesString.join(separator);
}
CRoleList CRoleList::fromDatabaseJson(const QJsonArray &array)
{
CRoleList roles;
for (const QJsonValue &value : array)
{
roles.push_back(CRole::fromDatabaseJson(value.toObject()));
}
return roles;
}
} // namespace
} // namespace