1
0

feat: add utf8 format

- move utf8 stream and format patch from string to patch namespace.
- add ordinay format alias and utf8 format in our format patch.
- add char8_t and char inter-cast in string reinterpret namespace.
- fix bug of utf8 formatter.
- add test for utf8 format.
This commit is contained in:
2025-09-25 15:29:55 +08:00
parent a61955bb09
commit c8d763bdcf
17 changed files with 257 additions and 36 deletions

View File

@@ -0,0 +1,49 @@
#pragma once
#include "application.hpp"
#include "../../macro/class_copy_move.hpp"
#include "../tabulate.hpp"
#include <iostream>
#define NS_YYCC_CLAP ::yycc::carton::clap
#define NS_YYCC_TABULATE ::yycc::carton::tabulate
namespace yycc::carton::clap::manual::Manual {
struct ManualTr {
public:
ManualTr();
~ManualTr();
YYCC_DEFAULT_COPY_MOVE(ManualTr);
public:
std::u8string author_and_version;
std::u8string usage_title, usage_body;
std::u8string avail_opt, avail_var;
};
class Manual {
public:
Manual(const NS_YYCC_CLAP::application::Application& app, ManualTr&& trctx = ManualTr());
~Manual();
YYCC_DEFAULT_COPY_MOVE(Manual);
private:
void setup_table();
void fill_opt_table();
void fill_var_table();
public:
void print_version(std::ostream& dst = std::cout) const;
void print_help(std::ostream& dst = std::cout) const;
private:
ManualTr trctx;
const NS_YYCC_CLAP::application::Application app;
NS_YYCC_TABULATE::Tabulate opt_printer;
NS_YYCC_TABULATE::Tabulate var_printer;
};
}
#undef NS_YYCC_TABULATE
#undef NS_YYCC_CLAP