clang-format
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
// Clase Asset: gestor optimizado de recursos (singleton)
|
||||
class Asset {
|
||||
@@ -32,7 +32,7 @@ class Asset {
|
||||
// --- Métodos para la gestión de recursos ---
|
||||
void add(const std::string &file_path, Type type, bool required = true, bool absolute = false);
|
||||
void loadFromFile(const std::string &config_file_path, const std::string &prefix = "", const std::string &system_folder = ""); // Con soporte para variables
|
||||
[[nodiscard]] auto get(const std::string &filename) const -> std::string; // Mantener nombre original
|
||||
[[nodiscard]] auto get(const std::string &filename) const -> std::string; // Mantener nombre original
|
||||
[[nodiscard]] auto check() const -> bool;
|
||||
[[nodiscard]] auto getListByType(Type type) const -> std::vector<std::string>;
|
||||
[[nodiscard]] auto exists(const std::string &filename) const -> bool; // Nueva función para verificar existencia
|
||||
@@ -40,17 +40,17 @@ class Asset {
|
||||
private:
|
||||
// --- Estructura interna para almacenar información de cada recurso ---
|
||||
struct Item {
|
||||
std::string file; // Ruta completa del archivo (mantener nombre original)
|
||||
Type type; // Tipo de recurso
|
||||
bool required; // Indica si el archivo es obligatorio
|
||||
std::string file; // Ruta completa del archivo (mantener nombre original)
|
||||
Type type; // Tipo de recurso
|
||||
bool required; // Indica si el archivo es obligatorio
|
||||
|
||||
Item(std::string path, Type asset_type, bool is_required)
|
||||
: file(std::move(path)), type(asset_type), required(is_required) {}
|
||||
Item(std::string path, Type asset_type, bool is_required)
|
||||
: file(std::move(path)), type(asset_type), required(is_required) {}
|
||||
};
|
||||
|
||||
// --- Variables internas ---
|
||||
std::unordered_map<std::string, Item> file_list_; // Mapa para búsqueda O(1) (mantener nombre original)
|
||||
std::string executable_path_; // Ruta del ejecutable
|
||||
std::string executable_path_; // Ruta del ejecutable
|
||||
|
||||
// --- Métodos internos ---
|
||||
[[nodiscard]] static auto checkFile(const std::string &path) -> bool;
|
||||
|
||||
Reference in New Issue
Block a user