tots els singletons tornats a fer a la vieja y gorda usanza

This commit is contained in:
2025-05-30 10:17:41 +02:00
parent 64b6f66044
commit f661da5215
29 changed files with 322 additions and 379 deletions

View File

@@ -6,15 +6,10 @@
class ServiceMenu
{
public:
static ServiceMenu &get_instance()
{
static ServiceMenu instance;
return instance;
}
// Eliminar copia y asignación
ServiceMenu(const ServiceMenu &) = delete;
ServiceMenu &operator=(const ServiceMenu &) = delete;
// --- Métodos de singleton ---
static void init(); // Inicializa el objeto ServiceMenu
static void destroy(); // Libera el objeto ServiceMenu
static ServiceMenu *get(); // Obtiene el puntero al objeto ServiceMenu
void show();
void render();
@@ -22,9 +17,16 @@ public:
void execute_option(size_t option);
private:
ServiceMenu();
~ServiceMenu() = default;
// --- Patrón Singleton ---
ServiceMenu(); // Constructor privado
~ServiceMenu() = default; // Destructor privado
ServiceMenu(const ServiceMenu &) = delete; // Evitar copia
ServiceMenu &operator=(const ServiceMenu &) = delete; // Evitar asignación
// --- Singleton ---
static ServiceMenu *instance_;
// -- Variables internas ---
bool is_active;
size_t selected_option;
std::vector<std::string> options;