2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 18:24:55 +00:00

Code style improvements

This commit is contained in:
Jack Andersen
2019-09-30 21:23:35 -10:00
parent 0b30fedef5
commit 8a73a8ee48
26 changed files with 719 additions and 833 deletions

View File

@@ -30,11 +30,13 @@
#include <logvisor/logvisor.hpp>
using namespace std::literals;
namespace hecl {
unsigned VerbosityLevel = 0;
bool GuiMode = false;
logvisor::Module LogModule("hecl");
constexpr std::string_view Illegals{"<>?\""};
constexpr std::string_view Illegals = "<>?\""sv;
void SanitizePath(std::string& path) {
if (path.empty())
@@ -64,7 +66,7 @@ void SanitizePath(std::string& path) {
path.pop_back();
}
constexpr std::wstring_view WIllegals{L"<>?\""};
constexpr std::wstring_view WIllegals = L"<>?\""sv;
void SanitizePath(std::wstring& path) {
if (path.empty())
@@ -174,9 +176,8 @@ bool IsPathPNG(const hecl::ProjectPath& path) {
bool IsPathBlend(const hecl::ProjectPath& path) {
const auto lastCompExt = path.getLastComponentExt();
if (lastCompExt.empty() || hecl::StrCmp(lastCompExt.data(), _SYS_STR("blend"))) {
if (lastCompExt.empty() || lastCompExt != _SYS_STR("blend"))
return false;
}
const auto fp = hecl::FopenUnique(path.getAbsolutePath().data(), _SYS_STR("rb"));
if (fp == nullptr) {
@@ -193,14 +194,15 @@ bool IsPathBlend(const hecl::ProjectPath& path) {
}
bool IsPathYAML(const hecl::ProjectPath& path) {
if (!hecl::StrCmp(path.getLastComponent().data(), _SYS_STR("!catalog.yaml")))
return false; /* !catalog.yaml is exempt from general use */
auto lastComp = path.getLastComponent();
if (lastComp == _SYS_STR("!catalog.yaml") ||
lastComp == _SYS_STR("!memoryid.yaml") ||
lastComp == _SYS_STR("!memoryrelays.yaml"))
return false; /* !catalog.yaml, !memoryid.yaml, !memoryrelays.yaml are exempt from general use */
auto lastCompExt = path.getLastComponentExt();
if (lastCompExt.empty())
return false;
if (!hecl::StrCmp(lastCompExt.data(), _SYS_STR("yaml")) || !hecl::StrCmp(lastCompExt.data(), _SYS_STR("yml")))
return true;
return false;
return lastCompExt == _SYS_STR("yaml") || lastCompExt == _SYS_STR("yml");
}
hecl::DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode, bool sizeSort, bool reverse,