From 4f4f793faae0adab88c768b2a62443dd558be620 Mon Sep 17 00:00:00 2001 From: Arkadii Hlushchevskyi Date: Tue, 12 Mar 2024 04:34:50 +0200 Subject: [PATCH] Replaced term "exclusion group" with "exclusive group". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Yeah, it bothered me too much 🤓 --- SPID/cmake/headerlist.cmake | 2 +- SPID/cmake/sourcelist.cmake | 2 +- .../{ExclusionGroups.h => ExclusiveGroups.h} | 20 +++++++++---------- SPID/include/LookupConfigs.h | 10 +++++----- SPID/include/LookupNPC.h | 2 +- ...xclusionGroups.cpp => ExclusiveGroups.cpp} | 10 +++++----- SPID/src/LookupConfigs.cpp | 17 ++++++++-------- SPID/src/LookupForms.cpp | 20 +++++++++---------- SPID/src/LookupNPC.cpp | 4 ++-- 9 files changed, 43 insertions(+), 44 deletions(-) rename SPID/include/{ExclusionGroups.h => ExclusiveGroups.h} (61%) rename SPID/src/{ExclusionGroups.cpp => ExclusiveGroups.cpp} (75%) diff --git a/SPID/cmake/headerlist.cmake b/SPID/cmake/headerlist.cmake index 9346806..9d8fa86 100644 --- a/SPID/cmake/headerlist.cmake +++ b/SPID/cmake/headerlist.cmake @@ -5,7 +5,7 @@ set(headers ${headers} include/Distribute.h include/DistributeManager.h include/DistributePCLevelMult.h - include/ExclusionGroups.h + include/ExclusiveGroups.h include/FormData.h include/KeywordDependencies.h include/LogBuffer.h diff --git a/SPID/cmake/sourcelist.cmake b/SPID/cmake/sourcelist.cmake index 46bd8f1..fc75060 100644 --- a/SPID/cmake/sourcelist.cmake +++ b/SPID/cmake/sourcelist.cmake @@ -3,7 +3,7 @@ set(sources ${sources} src/Distribute.cpp src/DistributeManager.cpp src/DistributePCLevelMult.cpp - src/ExclusionGroups.cpp + src/ExclusiveGroups.cpp src/FormData.cpp src/KeywordDependencies.cpp src/LogBuffer.cpp diff --git a/SPID/include/ExclusionGroups.h b/SPID/include/ExclusiveGroups.h similarity index 61% rename from SPID/include/ExclusionGroups.h rename to SPID/include/ExclusiveGroups.h index 1b4f23d..0fc97e8 100644 --- a/SPID/include/ExclusionGroups.h +++ b/SPID/include/ExclusiveGroups.h @@ -1,7 +1,7 @@ #pragma once #include "LookupConfigs.h" -namespace Exclusion +namespace ExclusiveGroups { using GroupName = std::string; using LinkedGroups = std::unordered_map>; @@ -13,35 +13,35 @@ namespace Exclusion /// /// Does a forms lookup similar to what Filters do. /// - /// As a result this method configures Manager with discovered valid exclusion groups. + /// As a result this method configures Manager with discovered valid exclusive groups. /// /// - /// A Raw exclusion entries that should be processed/ - void LookupExclusions(RE::TESDataHandler* const dataHandler, INI::ExclusionsVec& exclusion); + /// A raw exclusive group entries that should be processed/ + void LookupExclusiveGroups(RE::TESDataHandler* const dataHandler, INI::ExclusiveGroupsVec& rawExclusiveGroups); /// - /// Gets a set of all forms that are in the same exclusion group as the given form. - /// Note that a form can appear in multiple exclusion groups, all of those groups are returned. + /// Gets a set of all forms that are in the same exclusive group as the given form. + /// Note that a form can appear in multiple exclusive groups, all of those groups are returned. /// /// /// A union of all groups that contain a given form. std::unordered_set MutuallyExclusiveFormsForForm(RE::TESForm* form) const; /// - /// Retrieves all exclusion groups. + /// Retrieves all exclusive groups. /// - /// A reference to discovered exclusion groups + /// A reference to discovered exclusive groups const Groups& GetGroups() const; private: /// - /// A map of exclusion group names related to each form in the exclusion groups. + /// A map of exclusive group names related to each form in the exclusive groups. /// Provides a quick and easy way to get names of all groups that need to be checked. /// LinkedGroups linkedGroups{}; /// - /// A map of exclusion groups names and the forms that are part of each exclusion group. + /// A map of exclusive groups names and the forms that are part of each exclusive group. /// Groups groups{}; }; diff --git a/SPID/include/LookupConfigs.h b/SPID/include/LookupConfigs.h index 35e5b31..063c2ed 100644 --- a/SPID/include/LookupConfigs.h +++ b/SPID/include/LookupConfigs.h @@ -51,24 +51,24 @@ namespace INI std::string path{}; }; - struct Exclusion + struct RawExclusiveGroup { std::string name{}; - /// Raw filters in Exclusion only use NOT and MATCH, there is no meaning for ALL, so it's ignored. + /// Raw filters in RawExclusiveGroup only use NOT and MATCH, there is no meaning for ALL, so it's ignored. Filters rawFormFilters{}; std::string path{}; }; using DataVec = std::vector; - using ExclusionsVec = std::vector; + using ExclusiveGroupsVec = std::vector; inline StringMap configs{}; /// - /// A raw list of ExclusionGroups that will be processed along with configs. + /// A list of RawExclusiveGroups that will be processed along with configs. /// - inline ExclusionsVec exclusions{}; + inline ExclusiveGroupsVec exclusiveGroups{}; std::pair GetConfigs(); } diff --git a/SPID/include/LookupNPC.h b/SPID/include/LookupNPC.h index 753fcf5..d3f5849 100644 --- a/SPID/include/LookupNPC.h +++ b/SPID/include/LookupNPC.h @@ -20,7 +20,7 @@ namespace NPC /// /// Checks whether given NPC already has another form that is mutually exclusive with the given form, - /// according to the exclusion groups configuration. + /// according to the exclusive groups configuration. /// /// A Form that needs to be checked. /// diff --git a/SPID/src/ExclusionGroups.cpp b/SPID/src/ExclusiveGroups.cpp similarity index 75% rename from SPID/src/ExclusionGroups.cpp rename to SPID/src/ExclusiveGroups.cpp index 13ada82..6db5f4f 100644 --- a/SPID/src/ExclusionGroups.cpp +++ b/SPID/src/ExclusiveGroups.cpp @@ -1,12 +1,12 @@ -#include "ExclusionGroups.h" +#include "ExclusiveGroups.h" #include "FormData.h" -void Exclusion::Manager::LookupExclusions(RE::TESDataHandler* const dataHandler, INI::ExclusionsVec& exclusions) +void ExclusiveGroups::Manager::LookupExclusiveGroups(RE::TESDataHandler* const dataHandler, INI::ExclusiveGroupsVec& exclusiveGroups) { groups.clear(); linkedGroups.clear(); - for (auto& [name, filterIDs, path] : exclusions) { + for (auto& [name, filterIDs, path] : exclusiveGroups) { auto& forms = groups[name]; FormVec match{}; FormVec formsNot{}; @@ -41,7 +41,7 @@ void Exclusion::Manager::LookupExclusions(RE::TESDataHandler* const dataHandler, } } -std::unordered_set Exclusion::Manager::MutuallyExclusiveFormsForForm(RE::TESForm* form) const +std::unordered_set ExclusiveGroups::Manager::MutuallyExclusiveFormsForForm(RE::TESForm* form) const { std::unordered_set forms{}; if (auto it = linkedGroups.find(form); it != linkedGroups.end()) { @@ -57,7 +57,7 @@ std::unordered_set Exclusion::Manager::MutuallyExclusiveFormsForFo return forms; } -const Exclusion::Groups& Exclusion::Manager::GetGroups() const +const ExclusiveGroups::Groups& ExclusiveGroups::Manager::GetGroups() const { return groups; } diff --git a/SPID/src/LookupConfigs.cpp b/SPID/src/LookupConfigs.cpp index 7a87bbe..07df2e0 100644 --- a/SPID/src/LookupConfigs.cpp +++ b/SPID/src/LookupConfigs.cpp @@ -46,9 +46,9 @@ namespace INI return newValue; } - std::optional parse_exclusion(const std::string& a_key, const std::string& a_value, const std::string& a_path) + std::optional parse_exclusive_group(const std::string& a_key, const std::string& a_value, const std::string& a_path) { - if (a_key != "ExclusionGroup") { + if (a_key != "ExclusiveGroup") { return std::nullopt; } @@ -56,23 +56,23 @@ namespace INI const auto size = sections.size(); if (size == 0) { - logger::warn("IGNORED: ExclusionGroup must have a name: {} = {}"sv, a_key, a_value); + logger::warn("IGNORED: ExclusiveGroup must have a name: {} = {}"sv, a_key, a_value); return std::nullopt; } if (size == 1) { - logger::warn("IGNORED: ExclusionGroup must have at least one filter name: {} = {}"sv, a_key, a_value); + logger::warn("IGNORED: ExclusiveGroup must have at least one filter name: {} = {}"sv, a_key, a_value); return std::nullopt; } auto split_IDs = distribution::split_entry(sections[1]); if (split_IDs.empty()) { - logger::warn("ExclusionGroup must have at least one Form Filter : {} = {}"sv, a_key, a_value); + logger::warn("ExclusiveGroup must have at least one Form Filter : {} = {}"sv, a_key, a_value); return std::nullopt; } - Exclusion group{}; + RawExclusiveGroup group{}; group.name = sections[0]; group.path = a_path; @@ -305,9 +305,8 @@ namespace INI for (auto& [key, entry] : *values) { try { - if (const auto exclusionOpt = detail::parse_exclusion(key.pItem, entry, truncatedPath); exclusionOpt) { - const auto& exclusion = *exclusionOpt; - exclusions.emplace_back(exclusion); + if (const auto group = detail::parse_exclusive_group(key.pItem, entry, truncatedPath); group) { + exclusiveGroups.emplace_back(*group); continue; } diff --git a/SPID/src/LookupForms.cpp b/SPID/src/LookupForms.cpp index 31d3601..a56d673 100644 --- a/SPID/src/LookupForms.cpp +++ b/SPID/src/LookupForms.cpp @@ -1,5 +1,5 @@ #include "LookupForms.h" -#include "ExclusionGroups.h" +#include "ExclusiveGroups.h" #include "FormData.h" #include "KeywordDependencies.h" @@ -51,24 +51,24 @@ void LogDistributablesLookup() buffered_logger::clear(); } -// Lookup exclusion forms too. +// Lookup forms in exclusvie groups too. // P.S. Lookup process probably should build some sort of cache and reuse already discovered forms // instead of quering data handler for the same raw FormOrEditorID. -void LookupExclusionGroups(RE::TESDataHandler* const dataHandler) +void LookupExclusiveGroups(RE::TESDataHandler* const dataHandler) { - Exclusion::Manager::GetSingleton()->LookupExclusions(dataHandler, INI::exclusions); + ExclusiveGroups::Manager::GetSingleton()->LookupExclusiveGroups(dataHandler, INI::exclusiveGroups); } -void LogExclusionGroupsLookup() +void LogExclusiveGroupsLookup() { - if (const auto manager = Exclusion::Manager::GetSingleton(); manager) { + if (const auto manager = ExclusiveGroups::Manager::GetSingleton(); manager) { const auto& groups = manager->GetGroups(); if (!groups.empty()) { - logger::info("{:*^50}", "EXCLUSIONS"); + logger::info("{:*^50}", "EXCLUSIVE GROUPS"); for (const auto& [group, forms] : groups) { - logger::info("Adding '{}' exclusion group", group); + logger::info("Adding '{}' exclusive group", group); for (const auto& form : forms) { logger::info(" {}", describe(form)); } @@ -93,8 +93,8 @@ bool Lookup::LookupForms() logger::info("Lookup took {}μs / {}ms", timer.duration_μs(), timer.duration_ms()); } - LookupExclusionGroups(dataHandler); - LogExclusionGroupsLookup(); + LookupExclusiveGroups(dataHandler); + LogExclusiveGroupsLookup(); return success; } diff --git a/SPID/src/LookupNPC.cpp b/SPID/src/LookupNPC.cpp index d5f9a0a..b164e6b 100644 --- a/SPID/src/LookupNPC.cpp +++ b/SPID/src/LookupNPC.cpp @@ -1,5 +1,5 @@ #include "LookupNPC.h" -#include +#include namespace NPC { @@ -185,7 +185,7 @@ namespace NPC bool Data::HasMutuallyExclusiveForm(RE::TESForm* a_form) const { - auto excludedForms = Exclusion::Manager::GetSingleton()->MutuallyExclusiveFormsForForm(a_form); + auto excludedForms = ExclusiveGroups::Manager::GetSingleton()->MutuallyExclusiveFormsForForm(a_form); if (excludedForms.empty()) { return false; }