fix: enum class amb base std::uint8_t (33 troballes)
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <algorithm> // Para ranges::transform
|
||||
#include <numeric> // Para std::accumulate
|
||||
#include <cctype> // Para toupper
|
||||
#include <numeric> // Para std::accumulate
|
||||
#include <sstream> // Para std::istringstream
|
||||
#include <string> // Para string
|
||||
#include <vector> // Para vector
|
||||
@@ -182,8 +182,7 @@ void Console::update(float delta_time) { // NOLINT(readability-function-cogniti
|
||||
|
||||
// Efecto typewriter: revelar letras una a una (solo cuando ACTIVE)
|
||||
if (status_ == Status::ACTIVE) {
|
||||
const int total_chars = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0,
|
||||
[](int acc, const auto& line) { return acc + static_cast<int>(line.size()); });
|
||||
const int total_chars = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0, [](int acc, const auto& line) { return acc + static_cast<int>(line.size()); });
|
||||
if (typewriter_chars_ < total_chars) {
|
||||
typewriter_timer_ += delta_time;
|
||||
while (typewriter_timer_ >= TYPEWRITER_CHAR_DELAY && typewriter_chars_ < total_chars) {
|
||||
@@ -339,8 +338,7 @@ void Console::handleEvent(const SDL_Event& event) { // NOLINT(readability-funct
|
||||
if (SPACE_POS == std::string::npos) {
|
||||
// Modo comando: ciclar keywords visibles que empiecen por el prefijo
|
||||
const auto KEYWORDS = registry_.getVisibleKeywords();
|
||||
std::ranges::copy_if(KEYWORDS, std::back_inserter(tab_matches_),
|
||||
[&upper](const auto& kw) { return upper.empty() || kw.starts_with(upper); });
|
||||
std::ranges::copy_if(KEYWORDS, std::back_inserter(tab_matches_), [&upper](const auto& kw) { return upper.empty() || kw.starts_with(upper); });
|
||||
} else {
|
||||
const std::string BASE_CMD = upper.substr(0, SPACE_POS);
|
||||
const std::string SUB_PREFIX = upper.substr(SPACE_POS + 1);
|
||||
@@ -356,8 +354,7 @@ void Console::handleEvent(const SDL_Event& event) { // NOLINT(readability-funct
|
||||
if (tab_matches_.empty()) { break; }
|
||||
tab_index_ = (tab_index_ + 1) % static_cast<int>(tab_matches_.size());
|
||||
std::string result = tab_matches_[static_cast<size_t>(tab_index_)];
|
||||
std::ranges::transform(result, result.begin(),
|
||||
[](char c) { return static_cast<char>(std::tolower(static_cast<unsigned char>(c))); });
|
||||
std::ranges::transform(result, result.begin(), [](char c) { return static_cast<char>(std::tolower(static_cast<unsigned char>(c))); });
|
||||
input_line_ = result;
|
||||
break;
|
||||
}
|
||||
@@ -403,8 +400,7 @@ void Console::processCommand() {
|
||||
|
||||
// Typewriter: instantáneo si el comando lo requiere, letra a letra si no
|
||||
if (instant) {
|
||||
typewriter_chars_ = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0,
|
||||
[](int acc, const auto& l) { return acc + static_cast<int>(l.size()); });
|
||||
typewriter_chars_ = std::accumulate(msg_lines_.begin(), msg_lines_.end(), 0, [](int acc, const auto& l) { return acc + static_cast<int>(l.size()); });
|
||||
} else {
|
||||
typewriter_chars_ = 0;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <cstdint> // Para uint8_t
|
||||
#include <deque> // Para deque (historial)
|
||||
#include <functional> // Para function
|
||||
#include <memory> // Para shared_ptr
|
||||
@@ -43,7 +44,7 @@ class Console {
|
||||
std::function<void(bool)> on_toggle;
|
||||
|
||||
private:
|
||||
enum class Status {
|
||||
enum class Status : std::uint8_t {
|
||||
HIDDEN,
|
||||
RISING,
|
||||
ACTIVE,
|
||||
|
||||
@@ -1013,8 +1013,7 @@ void CommandRegistry::registerHandlers() { // NOLINT(readability-function-cogni
|
||||
std::vector<std::string> result = {"NEXT", "PREV", "SORT", "DEFAULT"};
|
||||
if (Screen::get() != nullptr) {
|
||||
const auto NAMES = Screen::get()->getPaletteNames();
|
||||
std::ranges::transform(NAMES, std::back_inserter(result),
|
||||
[](const auto& name) { return toUpper(name); });
|
||||
std::ranges::transform(NAMES, std::back_inserter(result), [](const auto& name) { return toUpper(name); });
|
||||
}
|
||||
return result;
|
||||
};
|
||||
@@ -1120,8 +1119,7 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
if (cat_node.contains("scope")) {
|
||||
const auto& scope_node = cat_node["scope"];
|
||||
if (scope_node.is_sequence()) {
|
||||
std::ranges::transform(scope_node, std::back_inserter(cat_scopes),
|
||||
[](const auto& s) { return s.template get_value<std::string>(); });
|
||||
std::ranges::transform(scope_node, std::back_inserter(cat_scopes), [](const auto& s) { return s.template get_value<std::string>(); });
|
||||
} else {
|
||||
cat_scopes.push_back(scope_node.get_value<std::string>());
|
||||
}
|
||||
@@ -1162,8 +1160,7 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
for (auto it = completions_node.begin(); it != completions_node.end(); ++it) {
|
||||
auto path = it.key().get_value<std::string>();
|
||||
std::vector<std::string> opts;
|
||||
std::ranges::transform(*it, std::back_inserter(opts),
|
||||
[](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
std::ranges::transform(*it, std::back_inserter(opts), [](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
def.completions[path] = std::move(opts);
|
||||
}
|
||||
}
|
||||
@@ -1182,8 +1179,7 @@ void CommandRegistry::load(const std::string& yaml_path) { // NOLINT(readabilit
|
||||
for (auto it = extras_completions.begin(); it != extras_completions.end(); ++it) {
|
||||
auto path = it.key().get_value<std::string>();
|
||||
std::vector<std::string> opts;
|
||||
std::ranges::transform(*it, std::back_inserter(opts),
|
||||
[](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
std::ranges::transform(*it, std::back_inserter(opts), [](const auto& opt) { return opt.template get_value<std::string>(); });
|
||||
def.completions[path] = std::move(opts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,6 @@ auto Notifier::getVisibleHeight() const -> int {
|
||||
auto Notifier::getCodes() -> std::vector<std::string> {
|
||||
std::vector<std::string> codes;
|
||||
codes.reserve(notifications_.size());
|
||||
std::ranges::transform(notifications_, std::back_inserter(codes),
|
||||
[](const auto& notification) { return notification.code; });
|
||||
std::ranges::transform(notifications_, std::back_inserter(codes), [](const auto& notification) { return notification.code; });
|
||||
return codes;
|
||||
}
|
||||
@@ -2,24 +2,25 @@
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string, basic_string
|
||||
#include <vector> // Para vector
|
||||
class Sprite; // lines 8-8
|
||||
class Surface; // lines 10-10
|
||||
class Text; // lines 9-9
|
||||
class DeltaTimer; // lines 11-11
|
||||
#include <cstdint> // Para uint8_t
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string, basic_string
|
||||
#include <vector> // Para vector
|
||||
class Sprite; // lines 8-8
|
||||
class Surface; // lines 10-10
|
||||
class Text; // lines 9-9
|
||||
class DeltaTimer; // lines 11-11
|
||||
|
||||
class Notifier {
|
||||
public:
|
||||
// Justificado para las notificaciones
|
||||
enum class TextAlign {
|
||||
enum class TextAlign : std::uint8_t {
|
||||
LEFT,
|
||||
CENTER,
|
||||
};
|
||||
|
||||
// Forma de las notificaciones
|
||||
enum class Shape {
|
||||
enum class Shape : std::uint8_t {
|
||||
ROUNDED,
|
||||
SQUARED,
|
||||
};
|
||||
@@ -65,7 +66,7 @@ class Notifier {
|
||||
|
||||
private:
|
||||
// Tipos anidados
|
||||
enum class Status {
|
||||
enum class Status : std::uint8_t {
|
||||
RISING,
|
||||
STAY,
|
||||
VANISHING,
|
||||
|
||||
Reference in New Issue
Block a user