From a6a9aa88b208eb4a285f534b008589b1a274036b Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Fri, 5 Feb 2021 16:03:04 +0200 Subject: [PATCH] Const cleanup. --- module/Core/Privilege.hpp | 6 +++--- module/Core/Privilege/Class.cpp | 6 +++--- module/Core/Privilege/Class.hpp | 22 +++++++++++----------- module/Core/Privilege/Unit.cpp | 2 +- module/Core/Privilege/Unit.hpp | 18 +++++++++--------- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/module/Core/Privilege.hpp b/module/Core/Privilege.hpp index 5db702ec..ead6d5a9 100644 --- a/module/Core/Privilege.hpp +++ b/module/Core/Privilege.hpp @@ -194,7 +194,7 @@ public: /* -------------------------------------------------------------------------------------------- * Makes sure you can modify current entries. */ - void ModifyEntries() + void ModifyEntries() const { if (m_LockEntries) { @@ -205,7 +205,7 @@ public: /* -------------------------------------------------------------------------------------------- * Makes sure you can modify current entries. */ - void ModifyClasses() + void ModifyClasses() const { if (m_LockClasses) { @@ -216,7 +216,7 @@ public: /* -------------------------------------------------------------------------------------------- * Makes sure you can modify current entries. */ - void ModifyUnits() + void ModifyUnits() const { if (m_LockUnits) { diff --git a/module/Core/Privilege/Class.cpp b/module/Core/Privilege/Class.cpp index 8ef0fd79..62cbc6a9 100644 --- a/module/Core/Privilege/Class.cpp +++ b/module/Core/Privilege/Class.cpp @@ -162,7 +162,7 @@ void PvClass::AssignPrivilege(SQInteger id, SQInteger value) DoChanged(id, r.Cast< bool >(), value); } } - // Either waiy, we are setting this value + // Either way, we are setting this value mPrivileges[id] = value; } @@ -391,7 +391,7 @@ bool PvClass::HaveUnitWithTag(StackStrF & tag) } // ------------------------------------------------------------------------------------------------ -void PvClass::EachEntryID(Object & ctx, Function & func) +void PvClass::EachEntryID(Object & ctx, Function & func) const { // In order to be safe from modifications while iterating, create a copy PvStatusList list(mPrivileges); @@ -403,7 +403,7 @@ void PvClass::EachEntryID(Object & ctx, Function & func) } // ------------------------------------------------------------------------------------------------ -void PvClass::EachUnitID(Object & ctx, Function & func) +void PvClass::EachUnitID(Object & ctx, Function & func) const { // In order to be safe from modifications while iterating, create a copy PvUnit::List list(mUnits); diff --git a/module/Core/Privilege/Class.hpp b/module/Core/Privilege/Class.hpp index 20f72954..774873d8 100644 --- a/module/Core/Privilege/Class.hpp +++ b/module/Core/Privilege/Class.hpp @@ -300,12 +300,12 @@ struct PvClass /* -------------------------------------------------------------------------------------------- * Invoke a given callback with every owned entry identifier. */ - void EachEntryID(Object & ctx, Function & func); + void EachEntryID(Object & ctx, Function & func) const; /* -------------------------------------------------------------------------------------------- * Invoke a given callback with every parented unit identifier. */ - void EachUnitID(Object & ctx, Function & func); + void EachUnitID(Object & ctx, Function & func) const; }; /* ------------------------------------------------------------------------------------------------ @@ -356,21 +356,21 @@ struct SqPvClass // -------------------------------------------------------------------------------------------- bool Can(LightObj & obj, SQInteger req) const; // -------------------------------------------------------------------------------------------- - void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); } - void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); } - void RemovePrivilegeWithID(SQInteger id) { Valid().RemovePrivilege(id); } - void RemovePrivilegeWithTag(StackStrF & tag) { Valid().RemovePrivilege(tag); } - void ModifyPrivilegeWithID(SQInteger id, SQInteger value) { Valid().ModifyPrivilege(id, value); } - void ModifyPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().ModifyPrivilege(tag, value); } - void RemoveAllPrivileges() { Valid().RemoveAllPrivileges(); } + void AssignPrivilegeWithID(SQInteger id, SQInteger value) const { Valid().AssignPrivilege(id, value); } + void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) const { Valid().AssignPrivilege(tag, value); } + void RemovePrivilegeWithID(SQInteger id) const { Valid().RemovePrivilege(id); } + void RemovePrivilegeWithTag(StackStrF & tag) const { Valid().RemovePrivilege(tag); } + void ModifyPrivilegeWithID(SQInteger id, SQInteger value) const { Valid().ModifyPrivilege(id, value); } + void ModifyPrivilegeWithTag(StackStrF & tag, SQInteger value) const { Valid().ModifyPrivilege(tag, value); } + void RemoveAllPrivileges() const { Valid().RemoveAllPrivileges(); } // -------------------------------------------------------------------------------------------- SQMOD_NODISCARD LightObj GetUnitWithID(SQInteger id) const { return Valid().GetUnitWithID(id); } SQMOD_NODISCARD LightObj GetUnitWithTag(StackStrF & tag) const { return Valid().GetUnitWithTag(tag); } SQMOD_NODISCARD bool HaveUnitWithID(SQInteger id) const { return Valid().HaveUnitWithID(id); } SQMOD_NODISCARD bool HaveUnitWithTag(StackStrF & tag) const { return Valid().HaveUnitWithTag(tag); } // -------------------------------------------------------------------------------------------- - void EachEntryID(Object & ctx, Function & func) { return Valid().EachEntryID(ctx, func); } - void EachUnitID(Object & ctx, Function & func) { return Valid().EachUnitID(ctx, func); } + void EachEntryID(Object & ctx, Function & func) const { return Valid().EachEntryID(ctx, func); } + void EachUnitID(Object & ctx, Function & func) const { return Valid().EachUnitID(ctx, func); } }; } // Namespace:: SqMod diff --git a/module/Core/Privilege/Unit.cpp b/module/Core/Privilege/Unit.cpp index 892042cd..73401e19 100644 --- a/module/Core/Privilege/Unit.cpp +++ b/module/Core/Privilege/Unit.cpp @@ -343,7 +343,7 @@ bool PvUnit::Can(SQInteger id, SQInteger req) const } // ------------------------------------------------------------------------------------------------ -void PvUnit::EachEntryID(Object & ctx, Function & func) +void PvUnit::EachEntryID(Object & ctx, Function & func) const { // In order to be safe from modifications while iterating, create a copy PvStatusList list(mPrivileges); diff --git a/module/Core/Privilege/Unit.hpp b/module/Core/Privilege/Unit.hpp index 94ca34b3..72172ecc 100644 --- a/module/Core/Privilege/Unit.hpp +++ b/module/Core/Privilege/Unit.hpp @@ -253,7 +253,7 @@ struct PvUnit /* -------------------------------------------------------------------------------------------- * Invoke a given callback with every owned entry identifier. */ - void EachEntryID(Object & ctx, Function & func); + void EachEntryID(Object & ctx, Function & func) const; }; /* ------------------------------------------------------------------------------------------------ @@ -302,15 +302,15 @@ struct SqPvUnit // -------------------------------------------------------------------------------------------- bool Can(LightObj & obj, SQInteger req) const; // -------------------------------------------------------------------------------------------- - void AssignPrivilegeWithID(SQInteger id, SQInteger value) { Valid().AssignPrivilege(id, value); } - void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().AssignPrivilege(tag, value); } - void RemovePrivilegeWithID(SQInteger id) { Valid().RemovePrivilege(id); } - void RemovePrivilegeWithTag(StackStrF & tag) { Valid().RemovePrivilege(tag); } - void ModifyPrivilegeWithID(SQInteger id, SQInteger value) { Valid().ModifyPrivilege(id, value); } - void ModifyPrivilegeWithTag(StackStrF & tag, SQInteger value) { Valid().ModifyPrivilege(tag, value); } - void RemoveAllPrivileges() { Valid().RemoveAllPrivileges(); } + void AssignPrivilegeWithID(SQInteger id, SQInteger value) const { Valid().AssignPrivilege(id, value); } + void AssignPrivilegeWithTag(StackStrF & tag, SQInteger value) const { Valid().AssignPrivilege(tag, value); } + void RemovePrivilegeWithID(SQInteger id) const { Valid().RemovePrivilege(id); } + void RemovePrivilegeWithTag(StackStrF & tag) const { Valid().RemovePrivilege(tag); } + void ModifyPrivilegeWithID(SQInteger id, SQInteger value) const { Valid().ModifyPrivilege(id, value); } + void ModifyPrivilegeWithTag(StackStrF & tag, SQInteger value) const { Valid().ModifyPrivilege(tag, value); } + void RemoveAllPrivileges() const { Valid().RemoveAllPrivileges(); } // -------------------------------------------------------------------------------------------- - void EachEntryID(Object & ctx, Function & func) { return Valid().EachEntryID(ctx, func); } + void EachEntryID(Object & ctx, Function & func) const { return Valid().EachEntryID(ctx, func); } }; } // Namespace:: SqMod