tots els singletons tornats a fer a la vieja y gorda usanza
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user