mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Remove most file-level using statements
They were often unnecessary or too broadly-scoped.
This commit is contained in:
@@ -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<std::string>& plugins,
|
||||
bool loadHeadersOnly) {
|
||||
auto logger = getLogger();
|
||||
std::multimap<uintmax_t, string> sizeMap;
|
||||
std::multimap<uintmax_t, std::string> sizeMap;
|
||||
|
||||
// First get the plugin sizes.
|
||||
for (const auto& plugin : plugins) {
|
||||
@@ -116,11 +113,11 @@ void Game::LoadPlugins(const std::vector<std::string>& 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<vector<string>> pluginGroups(threadsToUse);
|
||||
std::vector<std::vector<std::string>> pluginGroups(threadsToUse);
|
||||
if (logger) {
|
||||
auto pluginsPerThread = sizeMap.size() / threadsToUse;
|
||||
logger->info(
|
||||
@@ -154,10 +151,10 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
logger->trace("Starting plugin loading.");
|
||||
}
|
||||
auto masterPath = DataPath() / u8path(masterFilename_);
|
||||
vector<thread> threads;
|
||||
std::vector<std::thread> threads;
|
||||
while (threads.size() < threadsToUse) {
|
||||
vector<string>& 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);
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
|
||||
using std::lock_guard;
|
||||
using std::mutex;
|
||||
using std::pair;
|
||||
using std::string;
|
||||
|
||||
namespace loot {
|
||||
GameCache::GameCache(const GameCache& cache) {
|
||||
|
||||
@@ -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<std::string> LoadOrderHandler::GetLoadOrder() const {
|
||||
HandleError("get the load order", ret);
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
std::vector<string> loadOrder(pluginArr, pluginArr + pluginArrSize);
|
||||
std::vector<std::string> loadOrder(pluginArr, pluginArr + pluginArrSize);
|
||||
lo_free_string_array(pluginArr, pluginArrSize);
|
||||
|
||||
return loadOrder;
|
||||
@@ -161,7 +159,7 @@ std::vector<std::string> LoadOrderHandler::GetActivePlugins() const {
|
||||
HandleError("get active plugins", ret);
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
std::vector<string> loadOrder(pluginArr, pluginArr + pluginArrSize);
|
||||
std::vector<std::string> loadOrder(pluginArr, pluginArr + pluginArrSize);
|
||||
lo_free_string_array(pluginArr, pluginArrSize);
|
||||
|
||||
return loadOrder;
|
||||
@@ -182,7 +180,7 @@ std::vector<std::string> LoadOrderHandler::GetImplicitlyActivePlugins() const {
|
||||
HandleError("get implicitly active plugins", ret);
|
||||
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
|
||||
std::vector<string> loadOrder(pluginArr, pluginArr + pluginArrSize);
|
||||
std::vector<std::string> 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 +
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -31,11 +31,8 @@
|
||||
#else
|
||||
#include <unicode/uchar.h>
|
||||
#include <unicode/unistr.h>
|
||||
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<Tag> ExtractBashTags(const std::string& description) {
|
||||
}
|
||||
|
||||
std::optional<std::string> 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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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.
|
||||
|
||||
+2
-5
@@ -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
|
||||
|
||||
@@ -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<RawPluginGraph>::edge_descriptor edge_t;
|
||||
typedef boost::graph_traits<RawPluginGraph>::edge_iterator edge_it;
|
||||
|
||||
Reference in New Issue
Block a user