Renamed fmt_string_result_t do fmt_node_T

This commit is contained in:
Andreas Tsouchlos 2021-11-20 20:40:14 +01:00
parent c3ed767e82
commit 129b16d6e0

View File

@ -8,16 +8,8 @@
namespace detail {
/*
*
* Parse format string
*
*/
enum class FormatType { s, c, b, B, d, o, x, X, a, A, e, E, f, F, g, G, p };
// TODO: Maybe remove the length from here
template <typename result_t>
struct parse_result_t {
bool is_valid = false;
@ -25,7 +17,7 @@ struct parse_result_t {
result_t result;
};
struct fmt_string_result_t {
struct fmt_node_t {
bool has_zero_padding = false;
int length = 6;
int precision = 2;
@ -33,7 +25,7 @@ struct fmt_string_result_t {
};
template <std::size_t N>
using string_result_t = std::array<fmt_string_result_t, N>;
using string_result_t = std::array<fmt_node_t, N>;
// clang-format off
@ -74,14 +66,6 @@ constexpr bool is_digit(ConstString<N> s, unsigned i) {
}
/*
*
* Functions to convert X to char array
* and ConstString to X
*
*/
template <ConstString s>
constexpr parse_result_t<int> parse_number(unsigned i) {
int number = 0;
@ -157,9 +141,8 @@ constexpr parse_result_t<FormatType> parse_type(unsigned i) {
}
template <ConstString s>
constexpr parse_result_t<fmt_string_result_t> parse_fmt_string(unsigned i) {
fmt_string_result_t result;
constexpr parse_result_t<fmt_node_t> parse_fmt_string(unsigned i) {
fmt_node_t result;
if (s[i] == '0') {
++i;
@ -195,7 +178,7 @@ constexpr parse_result_t<fmt_string_result_t> parse_fmt_string(unsigned i) {
}
template <ConstString s>
constexpr parse_result_t<fmt_string_result_t> parse_braces(unsigned i) {
constexpr parse_result_t<fmt_node_t> parse_braces(unsigned i) {
if (s[i] == '}') {
++i;
return {true, i, {}};