added firstline dedicated property + default width set to 8

This commit is contained in:
diego.mateos 2024-01-26 13:28:17 +01:00
parent 629ab26240
commit 916bc04680
2 changed files with 20 additions and 14 deletions

View file

@ -67,6 +67,7 @@ namespace glm
char_type fill;
char_type space;
char_type newline;
char_type firstline;
order_type order;
GLM_FUNC_DECL explicit format_punct(size_t a = 0);
@ -131,7 +132,7 @@ namespace glm
{
unsigned value;
GLM_FUNC_DECL explicit width(unsigned = 0);
GLM_FUNC_DECL explicit width(unsigned = 8);
};
template<typename CTy>
@ -145,9 +146,8 @@ namespace glm
template<typename CTy>
struct filler
{
CTy value[3];
GLM_FUNC_DECL explicit filler(CTy /* fill */ = ' ', CTy /* space */ = ' ', CTy /* newline */ = '\n');
CTy value[4];
GLM_FUNC_DECL explicit filler(CTy /* fill */ = ' ', CTy /* space */ = ' ', CTy /* newline */ = '\n', CTy /* firstline */ = '\n');
};
struct order

View file

@ -28,6 +28,7 @@ namespace io
, fill(' ')
, space(' ')
, newline('\n')
, firstline('\n')
, order(column_major)
{}
@ -43,6 +44,7 @@ namespace io
, fill(a.fill)
, space(a.space)
, newline(a.newline)
, firstline(a.firstline)
, order(a.order)
{}
@ -97,14 +99,15 @@ namespace io
value[2] = c;
}
template<typename CTy>
GLM_FUNC_QUALIFIER filler<CTy>::filler(CTy a, CTy b, CTy c)
: value()
{
value[0] = a;
value[1] = b;
value[2] = c;
}
template<typename CTy>
GLM_FUNC_QUALIFIER filler<CTy>::filler(CTy a, CTy b, CTy c, CTy d)
: value()
{
value[0] = a;
value[1] = b;
value[2] = c;
value[3] = d;
}
GLM_FUNC_QUALIFIER order::order(order_type a)
: value(a)
@ -167,6 +170,7 @@ namespace io
fmt.fill = a.value[0];
fmt.space = a.value[1];
fmt.newline = a.value[2];
fmt.firstline = a.value[3];
return os;
}
@ -270,7 +274,8 @@ namespace detail
if(fmt.formatted)
{
os << /*fmt.newline <<*/ fmt.delim_left;
if (fmt.firstline != '\0') os << fmt.firstline;
os << fmt.delim_left;
switch(fmt.order)
{
@ -413,7 +418,8 @@ namespace detail
if(fmt.formatted)
{
os << /*fmt.newline <<*/ fmt.delim_left;
if (fmt.firstline != '\0') os << fmt.firstline;
os << fmt.delim_left;
switch(fmt.order)
{