Refactoring, FFmpeg updates
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <filesystem>
|
||||
|
||||
#include "string_.h"
|
||||
|
||||
namespace anm2ed::util::filesystem
|
||||
{
|
||||
std::string path_preferences_get()
|
||||
@@ -27,6 +29,13 @@ namespace anm2ed::util::filesystem
|
||||
return e == ("." + extension);
|
||||
}
|
||||
|
||||
std::filesystem::path path_lower_case_backslash_handle(std::filesystem::path& path)
|
||||
{
|
||||
if (path_is_exist(path)) return path;
|
||||
if (path_is_exist(string::backslash_replace(path))) return path;
|
||||
return string::to_lower(path);
|
||||
}
|
||||
|
||||
WorkingDirectory::WorkingDirectory(const std::string& path, bool isFile)
|
||||
{
|
||||
previous = std::filesystem::current_path();
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace anm2ed::util::filesystem
|
||||
std::string path_preferences_get();
|
||||
bool path_is_exist(const std::string&);
|
||||
bool path_is_extension(const std::string&, const std::string&);
|
||||
std::filesystem::path path_lower_case_backslash_handle(std::filesystem::path&);
|
||||
|
||||
class WorkingDirectory
|
||||
{
|
||||
|
||||
@@ -19,13 +19,6 @@ namespace anm2ed::util::string
|
||||
return transformed;
|
||||
}
|
||||
|
||||
std::string backslash_replace_to_lower(const std::string& string)
|
||||
{
|
||||
std::string transformed = string;
|
||||
transformed = backslash_replace(transformed);
|
||||
return to_lower(transformed);
|
||||
}
|
||||
|
||||
std::string quote(const std::string& string)
|
||||
{
|
||||
return "\"" + string + "\"";
|
||||
|
||||
@@ -6,6 +6,5 @@ namespace anm2ed::util::string
|
||||
{
|
||||
std::string to_lower(const std::string&);
|
||||
std::string backslash_replace(const std::string&);
|
||||
std::string backslash_replace_to_lower(const std::string&);
|
||||
bool to_bool(const std::string&);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,15 @@ namespace anm2ed::util::vector
|
||||
return index >= 0 && index < (int)v.size() ? &v[index] : nullptr;
|
||||
}
|
||||
|
||||
template <typename T> bool in_bounds(std::vector<T>& v, int index)
|
||||
{
|
||||
return index >= 0 && index < (int)v.size();
|
||||
}
|
||||
template <typename T> void clamp_in_bounds(std::vector<T>& v, int& index)
|
||||
{
|
||||
index = std::clamp(index, 0, (int)v.size() - 1);
|
||||
}
|
||||
|
||||
template <typename T> std::set<int> move_indices(std::vector<T>& v, std::vector<int>& indices, int index)
|
||||
{
|
||||
if (indices.empty()) return {};
|
||||
@@ -52,12 +61,4 @@ namespace anm2ed::util::vector
|
||||
return moveIndices;
|
||||
}
|
||||
|
||||
template <typename T> bool in_bounds(std::vector<T>& v, int& index)
|
||||
{
|
||||
return index >= 0 || index <= (int)v.size() - 1;
|
||||
}
|
||||
template <typename T> void clamp_in_bounds(std::vector<T>& v, int& index)
|
||||
{
|
||||
index = std::clamp(index, 0, (int)v.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user