Aurore
A Switch-like interface for your app, on every screen
Loading...
Searching...
No Matches
format_text.hpp
Go to the documentation of this file.
1// ui — durations, days and short answers as text: the formatting helpers
2// that only translate (ui.hpp includes this header). Plain C++ over
3// ui/tr.hpp, so a host suite can run them against a catalog of its own
4// (tests/host/format_text_tests.cpp).
5// Copyright (C) 2026 JigSawFr, (C) 2026 Taylor. GPLv3-or-later (see LICENSE.GPL).
6#pragma once
7
8#include <cstdint>
9#include <string>
10
11namespace ui
12{
13
14std::string fmt_minutes(uint32_t minutes);
15std::string fmt_duration_ns(uint64_t ns);
16std::string fmt_duration(uint64_t seconds);
17std::string day_name(int day);
18std::string day_name_in_text(int day);
19std::string bool_text(bool ok, bool value, const std::string& yes, const std::string& no);
20std::string yes_no(bool value);
24std::string opens(const std::string& value = "");
25
26} // namespace ui
Definition action_sheet.hpp:11
std::string fmt_duration(uint64_t seconds)
"0 min", "< 1 min", "45 min", "52 h 30", "278 h" (no 24 h cap)
std::string day_name_in_text(int day)
inside a sentence (fr: "lundi")
std::string yes_no(bool value)
std::string opens(const std::string &value="")
std::string bool_text(bool ok, bool value, const std::string &yes, const std::string &no)
std::string fmt_minutes(uint32_t minutes)
"0 min", "45 min", "2 h", "2 h 30"
std::string fmt_duration_ns(uint64_t ns)
rounded to minutes, as fmt_minutes
std::string day_name(int day)
0 = Sunday, as a title ("Monday")