Modules/Taskboard/public/TaskSearch.hpp
Шурупов Илья Викторович e1c8b045d9 Taskboard: move TaskPage and its relation rows into their own files
TaskTreeView.cpp held the page widgets as well as the view. TaskPage, TaskDetails,
RelationSection and TaskRow now live in TaskPage.hpp/.cpp; the search helpers
shared by both live in TaskSearch.hpp. No behaviour change.
2026-10-25 10:21:32 +03:00

23 lines
700 B
C++

#pragma once
#include "NodeGraph.hpp"
#include <algorithm>
#include <cctype>
#include <optional>
#include <string>
namespace tp::taskboard {
[[nodiscard]] inline std::string lowercaseText(std::string text) {
std::transform(text.begin(), text.end(), text.begin(), [](unsigned char c) { return char(std::tolower(c)); });
return text;
}
[[nodiscard]] inline std::optional<ui::NodeId> taskIdQuery(const std::string& query) {
const std::string digits = query.starts_with('#') ? query.substr(1) : query;
if (digits.empty() || !std::all_of(digits.begin(), digits.end(), [](unsigned char c) { return std::isdigit(c); }))
return std::nullopt;
return ui::NodeId(std::stoull(digits));
}
}