diff --git a/src/api/game/game.cpp b/src/api/game/game.cpp index f4785363..5e3aec9c 100644 --- a/src/api/game/game.cpp +++ b/src/api/game/game.cpp @@ -48,9 +48,6 @@ #include "windows.h" #endif -using std::string; -using std::thread; -using std::vector; using std::filesystem::u8path; namespace loot { @@ -95,7 +92,7 @@ bool Game::IsValidPlugin(const std::string& plugin) const { void Game::LoadPlugins(const std::vector& plugins, bool loadHeadersOnly) { auto logger = getLogger(); - std::multimap sizeMap; + std::multimap sizeMap; // First get the plugin sizes. for (const auto& plugin : plugins) { @@ -116,11 +113,11 @@ void Game::LoadPlugins(const std::vector& plugins, // Get the number of threads to use. // hardware_concurrency() may be zero, if so then use only one thread. size_t threadsToUse = - ::std::min((size_t)thread::hardware_concurrency(), sizeMap.size()); + ::std::min((size_t)std::thread::hardware_concurrency(), sizeMap.size()); threadsToUse = ::std::max(threadsToUse, (size_t)1); // Divide the plugins up by thread. - vector> pluginGroups(threadsToUse); + std::vector> pluginGroups(threadsToUse); if (logger) { auto pluginsPerThread = sizeMap.size() / threadsToUse; logger->info( @@ -154,10 +151,10 @@ void Game::LoadPlugins(const std::vector& plugins, logger->trace("Starting plugin loading."); } auto masterPath = DataPath() / u8path(masterFilename_); - vector threads; + std::vector threads; while (threads.size() < threadsToUse) { - vector& pluginGroup = pluginGroups.at(threads.size()); - threads.push_back(thread([&]() { + const auto& pluginGroup = pluginGroups.at(threads.size()); + threads.push_back(std::thread([&]() { for (auto pluginName : pluginGroup) { try { auto pluginPath = DataPath() / u8path(pluginName); diff --git a/src/api/game/game_cache.cpp b/src/api/game/game_cache.cpp index cb663ba2..3a0c2490 100644 --- a/src/api/game/game_cache.cpp +++ b/src/api/game/game_cache.cpp @@ -30,8 +30,6 @@ using std::lock_guard; using std::mutex; -using std::pair; -using std::string; namespace loot { GameCache::GameCache(const GameCache& cache) { diff --git a/src/api/game/load_order_handler.cpp b/src/api/game/load_order_handler.cpp index 1756125c..51876a9a 100644 --- a/src/api/game/load_order_handler.cpp +++ b/src/api/game/load_order_handler.cpp @@ -27,8 +27,6 @@ #include "api/helpers/logging.h" #include "loot/exception/error_categories.h" -using std::string; - namespace loot { unsigned int mapGameId(GameType gameType) { switch (gameType) { @@ -67,7 +65,7 @@ LoadOrderHandler::LoadOrderHandler( } const char* gameLocalDataPath = nullptr; - string tempPathString = gameLocalAppData.u8string(); + std::string tempPathString = gameLocalAppData.u8string(); if (!tempPathString.empty()) gameLocalDataPath = tempPathString.c_str(); @@ -140,7 +138,7 @@ std::vector LoadOrderHandler::GetLoadOrder() const { HandleError("get the load order", ret); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); + std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); lo_free_string_array(pluginArr, pluginArrSize); return loadOrder; @@ -161,7 +159,7 @@ std::vector LoadOrderHandler::GetActivePlugins() const { HandleError("get active plugins", ret); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); + std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); lo_free_string_array(pluginArr, pluginArrSize); return loadOrder; @@ -182,7 +180,7 @@ std::vector LoadOrderHandler::GetImplicitlyActivePlugins() const { HandleError("get implicitly active plugins", ret); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); + std::vector loadOrder(pluginArr, pluginArr + pluginArrSize); lo_free_string_array(pluginArr, pluginArrSize); return loadOrder; @@ -221,7 +219,7 @@ void LoadOrderHandler::HandleError(const std::string& operation, } const char* e = nullptr; - string err; + std::string err; lo_get_error_message(&e); if (e == nullptr) { err = "libloadorder failed to " + operation + diff --git a/src/api/helpers/crc.cpp b/src/api/helpers/crc.cpp index 59f8eb9e..927a79a5 100644 --- a/src/api/helpers/crc.cpp +++ b/src/api/helpers/crc.cpp @@ -31,9 +31,6 @@ #include "api/helpers/logging.h" #include "loot/exception/file_access_error.h" -using std::string; -using std::wstring; - namespace loot { size_t GetStreamSize(std::istream& stream) { const std::streampos startingPosition = stream.tellg(); diff --git a/src/api/helpers/text.cpp b/src/api/helpers/text.cpp index 8ab81cd3..fec7263b 100644 --- a/src/api/helpers/text.cpp +++ b/src/api/helpers/text.cpp @@ -31,11 +31,8 @@ #else #include #include -using icu::UnicodeString; #endif -using std::regex; - namespace loot { /* The string below matches timestamps that use forwardslashes for date separators. However, Pseudosem v1.0.1 will only compare the first @@ -91,6 +88,8 @@ std::vector ExtractBashTags(const std::string& description) { } std::optional ExtractVersion(const std::string& text) { + using std::regex; + /* There are a few different version formats that can appear in strings together, and in order to extract the correct one, they must be searched for in order of priority. */ @@ -200,8 +199,8 @@ int CompareFilenames(const std::string& lhs, const std::string& rhs) { "One of the filenames to compare was invalid."); } #else - auto unicodeLhs = UnicodeString::fromUTF8(lhs); - auto unicodeRhs = UnicodeString::fromUTF8(rhs); + auto unicodeLhs = icu::UnicodeString::fromUTF8(lhs); + auto unicodeRhs = icu::UnicodeString::fromUTF8(rhs); return unicodeLhs.caseCompare(unicodeRhs, U_FOLD_CASE_DEFAULT); #endif } @@ -218,7 +217,7 @@ std::string NormalizeFilename(const std::string& filename) { return FromWinWide(wideString); #else std::string normalizedFilename; - UnicodeString::fromUTF8(filename) + icu::UnicodeString::fromUTF8(filename) .foldCase(U_FOLD_CASE_DEFAULT) .toUTF8String(normalizedFilename); return normalizedFilename; diff --git a/src/api/metadata/condition_evaluator.cpp b/src/api/metadata/condition_evaluator.cpp index 17e04616..03233537 100644 --- a/src/api/metadata/condition_evaluator.cpp +++ b/src/api/metadata/condition_evaluator.cpp @@ -30,8 +30,6 @@ #include "api/helpers/logging.h" #include "loot/exception/condition_syntax_error.h" -using std::filesystem::u8path; - namespace loot { void HandleError(const std::string operation, int returnCode) { if (returnCode == LCI_OK) { diff --git a/src/api/metadata/conditional_metadata.cpp b/src/api/metadata/conditional_metadata.cpp index 151fc8c2..53fb452b 100644 --- a/src/api/metadata/conditional_metadata.cpp +++ b/src/api/metadata/conditional_metadata.cpp @@ -28,10 +28,8 @@ #include "api/helpers/logging.h" #include "api/metadata/condition_evaluator.h" -using std::string; - namespace loot { -ConditionalMetadata::ConditionalMetadata(const string& condition) : +ConditionalMetadata::ConditionalMetadata(const std::string& condition) : condition_(condition) {} bool ConditionalMetadata::IsConditional() const { return !condition_.empty(); } diff --git a/src/api/metadata/plugin_metadata.cpp b/src/api/metadata/plugin_metadata.cpp index 0844e453..8e837940 100644 --- a/src/api/metadata/plugin_metadata.cpp +++ b/src/api/metadata/plugin_metadata.cpp @@ -33,12 +33,6 @@ #include "api/helpers/text.h" #include "api/metadata/yaml/plugin_metadata.h" -using std::inserter; -using std::regex; -using std::regex_match; -using std::set; -using std::vector; - namespace loot { PluginMetadata::PluginMetadata(const std::string& n) : name_(n) { // If the name passed ends in '.ghost', that should be trimmed. diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 2ca3e08b..67771f6d 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -33,9 +33,6 @@ #include "api/helpers/text.h" #include "loot/exception/file_access_error.h" -using std::set; -using std::string; - namespace loot { Plugin::Plugin(const GameType gameType, const GameCache& gameCache, @@ -315,7 +312,7 @@ std::string Plugin::GetDescription() const { return ""; } - string descriptionStr = description; + std::string descriptionStr = description; esp_string_free(description); return descriptionStr; @@ -374,7 +371,7 @@ bool Plugin::LoadsArchive(const GameType gameType, return false; } - const string archiveExtension = GetArchiveFileExtension(gameType); + const auto archiveExtension = GetArchiveFileExtension(gameType); if (gameType == GameType::tes5) { // Skyrim (non-SE) plugins can only load BSAs that have exactly the same diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index 44959734..fe3272e5 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -38,9 +38,6 @@ #include "loot/exception/cyclic_interaction_error.h" #include "loot/exception/undefined_group_error.h" -using std::string; -using std::vector; - namespace loot { typedef boost::graph_traits::edge_descriptor edge_t; typedef boost::graph_traits::edge_iterator edge_it;