mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Removed some unnecessary typedefs and replaced the remaining ones with the more modern 'using' keyword.
Also harmonized the names of some user defined types and made some other minor cleanup.
This commit is contained in:
parent
c477c12dde
commit
a233b96c2a
|
@ -1366,9 +1366,9 @@ std::vector<std::string> CollectionSystemsManager::getSystemsFromTheme()
|
|||
std::string themePath = set->second.path;
|
||||
|
||||
if (Utils::FileSystem::exists(themePath)) {
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(themePath);
|
||||
Utils::FileSystem::StringList dirContent = Utils::FileSystem::getDirContent(themePath);
|
||||
|
||||
for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin();
|
||||
for (Utils::FileSystem::StringList::const_iterator it = dirContent.cbegin();
|
||||
it != dirContent.cend(); ++it) {
|
||||
if (Utils::FileSystem::isDirectory(*it)) {
|
||||
// ... here you have a directory.
|
||||
|
@ -1390,8 +1390,8 @@ std::vector<std::string> CollectionSystemsManager::getCollectionsFromConfigFolde
|
|||
std::string configPath = getCollectionsFolder();
|
||||
|
||||
if (Utils::FileSystem::exists(configPath)) {
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(configPath);
|
||||
for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin();
|
||||
Utils::FileSystem::StringList dirContent = Utils::FileSystem::getDirContent(configPath);
|
||||
for (Utils::FileSystem::StringList::const_iterator it = dirContent.cbegin();
|
||||
it != dirContent.cend(); ++it) {
|
||||
if (Utils::FileSystem::isRegularFile(*it)) {
|
||||
// It's a file.
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
void launchGame(Window* window);
|
||||
const std::string findEmulatorPath(std::string& command);
|
||||
|
||||
typedef bool ComparisonFunction(const FileData* a, const FileData* b);
|
||||
using ComparisonFunction = bool(const FileData* a, const FileData* b);
|
||||
struct SortType {
|
||||
ComparisonFunction* comparisonFunction;
|
||||
std::string description;
|
||||
|
|
|
@ -30,7 +30,7 @@ FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Utils::FileSystem::stringList pathList = Utils::FileSystem::getPathList(relative);
|
||||
Utils::FileSystem::StringList pathList = Utils::FileSystem::getPathList(relative);
|
||||
auto path_it = pathList.begin();
|
||||
FileData* treeNode = root;
|
||||
bool found = false;
|
||||
|
|
|
@ -265,13 +265,13 @@ bool SystemData::populateFolder(FileData* folder)
|
|||
std::string extension;
|
||||
bool isGame;
|
||||
bool showHiddenFiles = Settings::getInstance()->getBool("ShowHiddenFiles");
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(folderPath);
|
||||
Utils::FileSystem::StringList dirContent = Utils::FileSystem::getDirContent(folderPath);
|
||||
|
||||
// If system directory exists but contains no games, return as error.
|
||||
if (dirContent.size() == 0)
|
||||
return false;
|
||||
|
||||
for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin();
|
||||
for (Utils::FileSystem::StringList::const_iterator it = dirContent.cbegin();
|
||||
it != dirContent.cend(); ++it) {
|
||||
filePath = *it;
|
||||
|
||||
|
|
|
@ -465,7 +465,7 @@ void SystemScreensaver::generateCustomImageList()
|
|||
|
||||
if (imageDir != "" && Utils::FileSystem::isDirectory(imageDir)) {
|
||||
std::string imageFilter = ".jpg, .JPG, .png, .PNG";
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(
|
||||
Utils::FileSystem::StringList dirContent = Utils::FileSystem::getDirContent(
|
||||
imageDir, Settings::getInstance()->getBool("ScreensaverSlideshowRecurse"));
|
||||
|
||||
for (auto it = dirContent.begin(); it != dirContent.end(); ++it) {
|
||||
|
|
|
@ -43,10 +43,10 @@ private:
|
|||
|
||||
MenuComponent mMenu;
|
||||
|
||||
typedef OptionListComponent<std::string> LetterList;
|
||||
using LetterList = OptionListComponent<std::string>;
|
||||
std::shared_ptr<LetterList> mJumpToLetterList;
|
||||
|
||||
typedef OptionListComponent<const FileData::SortType*> SortList;
|
||||
using SortList = OptionListComponent<const FileData::SortType*>;
|
||||
std::shared_ptr<SortList> mListSort;
|
||||
|
||||
SystemData* mSystem;
|
||||
|
|
|
@ -296,10 +296,9 @@ void GuiMenu::openUIOptions()
|
|||
});
|
||||
|
||||
// Default gamelist sort order.
|
||||
typedef OptionListComponent<const FileData::SortType*> SortList;
|
||||
std::string sortOrder;
|
||||
auto default_sort_order =
|
||||
std::make_shared<SortList>(mWindow, getHelpStyle(), "DEFAULT SORT ORDER", false);
|
||||
auto default_sort_order = std::make_shared<OptionListComponent<const FileData::SortType*>>(
|
||||
mWindow, getHelpStyle(), "DEFAULT SORT ORDER", false);
|
||||
// Exclude the System sort options.
|
||||
unsigned int numSortTypes = static_cast<unsigned int>(FileSorts::SortTypes.size() - 2);
|
||||
for (unsigned int i = 0; i < numSortTypes; ++i) {
|
||||
|
|
|
@ -20,7 +20,7 @@ class SwitchComponent;
|
|||
class SystemData;
|
||||
|
||||
template <typename T> class OptionListComponent;
|
||||
typedef std::function<bool(SystemData*, FileData*)> GameFilterFunc;
|
||||
using GameFilterFunc = std::function<bool(SystemData*, FileData*)>;
|
||||
|
||||
class GuiScraperMenu : public GuiComponent
|
||||
{
|
||||
|
|
|
@ -151,10 +151,10 @@ std::vector<std::string> getScraperList();
|
|||
// Returns true if the scraper configured in the settings is still valid.
|
||||
bool isValidConfiguredScraper();
|
||||
|
||||
typedef void (*generate_scraper_requests_func)(
|
||||
const ScraperSearchParams& params,
|
||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||
std::vector<ScraperSearchResult>& results);
|
||||
using generate_scraper_requests_func =
|
||||
void (*)(const ScraperSearchParams& params,
|
||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||
std::vector<ScraperSearchResult>& results);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
private:
|
||||
ScraperSearchResult mResult;
|
||||
|
||||
typedef std::pair<std::unique_ptr<AsyncHandle>, std::function<void()>> ResolvePair;
|
||||
using ResolvePair = std::pair<std::unique_ptr<AsyncHandle>, std::function<void()>>;
|
||||
std::vector<ResolvePair> mFuncs;
|
||||
};
|
||||
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
typedef std::pair<std::string, std::string> HelpPrompt;
|
||||
using HelpPrompt = std::pair<std::string, std::string>;
|
||||
|
||||
#endif // ES_CORE_HELP_PROMPT_H
|
||||
|
|
|
@ -120,8 +120,7 @@ std::vector<std::string> InputConfig::getMappedTo(Input input)
|
|||
{
|
||||
std::vector<std::string> maps;
|
||||
|
||||
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||
for (it_type it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
for (auto it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
Input chk = it->second;
|
||||
|
||||
if (!chk.configured)
|
||||
|
@ -204,8 +203,7 @@ void InputConfig::writeToXML(pugi::xml_node& parent)
|
|||
|
||||
cfg.append_attribute("deviceGUID") = mDeviceGUID.c_str();
|
||||
|
||||
typedef std::map<std::string, Input>::const_iterator it_type;
|
||||
for (it_type it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
for (auto it = mNameMap.cbegin(); it != mNameMap.cend(); ++it) {
|
||||
if (!it->second.configured)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -702,9 +702,9 @@ std::map<std::string, ThemeSet> ThemeData::getThemeSets()
|
|||
if (!Utils::FileSystem::isDirectory(paths[i]))
|
||||
continue;
|
||||
|
||||
Utils::FileSystem::stringList dirContent = Utils::FileSystem::getDirContent(paths[i]);
|
||||
Utils::FileSystem::StringList dirContent = Utils::FileSystem::getDirContent(paths[i]);
|
||||
|
||||
for (Utils::FileSystem::stringList::const_iterator it = dirContent.cbegin();
|
||||
for (Utils::FileSystem::StringList::const_iterator it = dirContent.cbegin();
|
||||
it != dirContent.cend(); ++it) {
|
||||
if (Utils::FileSystem::isDirectory(*it)) {
|
||||
ThemeSet set = {*it};
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void onSizeChanged() override;
|
||||
|
||||
private:
|
||||
typedef std::pair<std::unique_ptr<ImageComponent>, int> ImageFrame;
|
||||
using ImageFrame = std::pair<std::unique_ptr<ImageComponent>, int>;
|
||||
|
||||
std::vector<ImageFrame> mFrames;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ private:
|
|||
glm::vec2 mSourceSize;
|
||||
bool mForceLoad;
|
||||
|
||||
typedef std::pair<std::string, bool> TextureKeyType;
|
||||
using TextureKeyType = std::pair<std::string, bool>;
|
||||
// Map of textures, used to prevent duplicate textures.
|
||||
static std::map<TextureKeyType, std::weak_ptr<TextureResource>> sTextureMap;
|
||||
// Set of all textures, used for memory management.
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace Utils
|
|||
unsigned int shadowDistance,
|
||||
float transparency,
|
||||
unsigned int iterations);
|
||||
|
||||
} // namespace CImg
|
||||
|
||||
} // namespace Utils
|
||||
|
|
|
@ -63,10 +63,10 @@ namespace Utils
|
|||
static std::string homePath = "";
|
||||
static std::string exePath = "";
|
||||
|
||||
stringList getDirContent(const std::string& path, const bool recursive)
|
||||
StringList getDirContent(const std::string& path, const bool recursive)
|
||||
{
|
||||
std::string genericPath = getGenericPath(path);
|
||||
stringList contentList;
|
||||
StringList contentList;
|
||||
|
||||
// Only parse the directory, if it's a directory.
|
||||
if (isDirectory(genericPath)) {
|
||||
|
@ -121,9 +121,9 @@ namespace Utils
|
|||
return contentList;
|
||||
}
|
||||
|
||||
stringList getPathList(const std::string& path)
|
||||
StringList getPathList(const std::string& path)
|
||||
{
|
||||
stringList pathList;
|
||||
StringList pathList;
|
||||
std::string genericPath = getGenericPath(path);
|
||||
size_t start = 0;
|
||||
size_t end = 0;
|
||||
|
@ -337,12 +337,12 @@ namespace Utils
|
|||
// Cleanup path.
|
||||
bool scan = true;
|
||||
while (scan) {
|
||||
stringList pathList = getPathList(canonicalPath);
|
||||
StringList pathList = getPathList(canonicalPath);
|
||||
|
||||
canonicalPath.clear();
|
||||
scan = false;
|
||||
|
||||
for (stringList::const_iterator it = pathList.cbegin(); it != pathList.cend();
|
||||
for (StringList::const_iterator it = pathList.cbegin(); it != pathList.cend();
|
||||
++it) {
|
||||
// Ignore empty.
|
||||
if ((*it).empty())
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace Utils
|
|||
{
|
||||
namespace FileSystem
|
||||
{
|
||||
typedef std::list<std::string> stringList;
|
||||
using StringList = std::list<std::string>;
|
||||
|
||||
stringList getDirContent(const std::string& path, const bool recursive = false);
|
||||
stringList getPathList(const std::string& path);
|
||||
StringList getDirContent(const std::string& path, const bool recursive = false);
|
||||
StringList getPathList(const std::string& path);
|
||||
void setHomePath(const std::string& path);
|
||||
std::string getHomePath();
|
||||
std::string getCWDPath();
|
||||
|
@ -66,6 +66,7 @@ namespace Utils
|
|||
bool isDirectory(const std::string& path);
|
||||
bool isSymlink(const std::string& path);
|
||||
bool isHidden(const std::string& path);
|
||||
|
||||
} // namespace FileSystem
|
||||
|
||||
} // namespace Utils
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "utils/StringUtil.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <codecvt>
|
||||
#include <locale>
|
||||
|
||||
namespace Utils
|
||||
|
@ -470,8 +469,7 @@ namespace Utils
|
|||
if (charIndex != nullptr) {
|
||||
wchar_t lowerChar = *(unicodeLowercase + (charIndex - unicodeUppercase));
|
||||
// Convert back to string format.
|
||||
typedef std::codecvt_utf8<wchar_t> convert_type;
|
||||
std::wstring_convert<convert_type, wchar_t> byteConverter;
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> byteConverter;
|
||||
|
||||
stringLower += byteConverter.to_bytes(lowerChar);
|
||||
}
|
||||
|
@ -523,8 +521,7 @@ namespace Utils
|
|||
if (charIndex != nullptr) {
|
||||
wchar_t upperChar = *(unicodeUppercase + (charIndex - unicodeLowercase));
|
||||
// Convert back to string format.
|
||||
typedef std::codecvt_utf8<wchar_t> convert_type;
|
||||
std::wstring_convert<convert_type, wchar_t> byteConverter;
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> byteConverter;
|
||||
|
||||
stringUpper += byteConverter.to_bytes(upperChar);
|
||||
}
|
||||
|
@ -596,17 +593,13 @@ namespace Utils
|
|||
|
||||
std::wstring stringToWideString(const std::string& stringArg)
|
||||
{
|
||||
typedef std::codecvt_utf8<wchar_t> convert_type;
|
||||
std::wstring_convert<convert_type, wchar_t> stringConverter;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> stringConverter;
|
||||
return stringConverter.from_bytes(stringArg);
|
||||
}
|
||||
|
||||
std::string wideStringToString(const std::wstring& stringArg)
|
||||
{
|
||||
typedef std::codecvt_utf8<wchar_t> convert_type;
|
||||
std::wstring_convert<convert_type, wchar_t> stringConverter;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> stringConverter;
|
||||
return stringConverter.to_bytes(stringArg);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef ES_CORE_UTILS_STRING_UTIL_H
|
||||
#define ES_CORE_UTILS_STRING_UTIL_H
|
||||
|
||||
#include <codecvt>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -44,6 +45,7 @@ namespace Utils
|
|||
const std::string& delimiter,
|
||||
bool caseInsensitive = false);
|
||||
std::string scramble(const std::string& input, const std::string& key);
|
||||
|
||||
} // namespace String
|
||||
|
||||
} // namespace Utils
|
||||
|
|
|
@ -71,6 +71,7 @@ namespace Utils
|
|||
std::string timeToString(const time_t& time, const std::string& format = "%Y%m%dT%H%M%S");
|
||||
int daysInMonth(const int year, const int month);
|
||||
int daysInYear(const int year);
|
||||
|
||||
} // namespace Time
|
||||
|
||||
} // namespace Utils
|
||||
|
|
Loading…
Reference in a new issue