Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fmt
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
fmt
Commits
b0867f3f
Commit
b0867f3f
authored
Aug 27, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AlignSpec -> align_spec and fix a warning
parent
f194a418
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
fmt/format.h
fmt/format.h
+13
-14
No files found.
fmt/format.h
View file @
b0867f3f
...
...
@@ -1751,14 +1751,14 @@ typedef format_spec<char, type_tag> type_spec;
struct
empty_spec
{};
// An alignment specifier.
struct
AlignS
pec
:
empty_spec
{
struct
align_s
pec
:
empty_spec
{
unsigned
width_
;
// Fill is always wchar_t and cast to char if necessary to avoid having
// two specialization of AlignSpec and its subclasses.
wchar_t
fill_
;
alignment
align_
;
AlignS
pec
(
unsigned
width
,
wchar_t
fill
,
alignment
align
=
ALIGN_DEFAULT
)
align_s
pec
(
unsigned
width
,
wchar_t
fill
,
alignment
align
=
ALIGN_DEFAULT
)
:
width_
(
width
),
fill_
(
fill
),
align_
(
align
)
{}
unsigned
width
()
const
{
return
width_
;
}
...
...
@@ -1770,7 +1770,7 @@ struct AlignSpec : empty_spec {
// Format specifiers.
template
<
typename
Char
>
class
basic_format_specs
:
public
AlignS
pec
{
class
basic_format_specs
:
public
align_s
pec
{
private:
template
<
typename
FillChar
>
typename
std
::
enable_if
<
std
::
is_same
<
FillChar
,
Char
>::
value
||
...
...
@@ -1799,11 +1799,11 @@ class basic_format_specs : public AlignSpec {
char
type_
;
basic_format_specs
(
unsigned
width
=
0
,
char
type
=
0
,
wchar_t
fill
=
' '
)
:
AlignS
pec
(
width
,
fill
),
flags_
(
0
),
precision_
(
-
1
),
type_
(
type
)
{}
:
align_s
pec
(
width
,
fill
),
flags_
(
0
),
precision_
(
-
1
),
type_
(
type
)
{}
template
<
typename
...
FormatSpecs
>
explicit
basic_format_specs
(
FormatSpecs
...
specs
)
:
AlignS
pec
(
0
,
' '
),
flags_
(
0
),
precision_
(
-
1
),
type_
(
0
){
:
align_s
pec
(
0
,
' '
),
flags_
(
0
),
precision_
(
-
1
),
type_
(
0
){
set
(
specs
...);
}
...
...
@@ -2297,7 +2297,7 @@ class basic_writer {
// Writes a formatted string.
template
<
typename
StrChar
>
CharPtr
write_str
(
const
StrChar
*
s
,
std
::
size_t
size
,
const
AlignS
pec
&
spec
);
CharPtr
write_str
(
const
StrChar
*
s
,
std
::
size_t
size
,
const
align_s
pec
&
spec
);
template
<
typename
StrChar
>
void
write_str
(
basic_string_view
<
StrChar
>
str
,
const
format_specs
&
spec
);
...
...
@@ -2444,7 +2444,7 @@ class basic_writer {
template
<
typename
Char
>
template
<
typename
StrChar
>
typename
basic_writer
<
Char
>::
CharPtr
basic_writer
<
Char
>::
write_str
(
const
StrChar
*
s
,
std
::
size_t
size
,
const
AlignS
pec
&
spec
)
{
const
StrChar
*
s
,
std
::
size_t
size
,
const
align_s
pec
&
spec
)
{
CharPtr
out
=
CharPtr
();
if
(
spec
.
width
()
>
size
)
{
out
=
grow_buffer
(
spec
.
width
());
...
...
@@ -2515,7 +2515,7 @@ typename basic_writer<Char>::CharPtr basic_writer<Char>::prepare_int_buffer(
--
prefix_size
;
unsigned
number_size
=
prefix_size
+
internal
::
to_unsigned
(
spec
.
precision
());
AlignS
pec
subspec
(
number_size
,
'0'
,
ALIGN_NUMERIC
);
align_s
pec
subspec
(
number_size
,
'0'
,
ALIGN_NUMERIC
);
if
(
number_size
>=
width
)
return
prepare_int_buffer
(
num_digits
,
subspec
,
prefix
,
prefix_size
);
buffer_
.
reserve
(
width
);
...
...
@@ -3605,21 +3605,20 @@ void vformat_to(basic_buffer<Char> &buffer, basic_string_view<Char> format_str,
auto
it
=
start
;
using
internal
::
pointer_from
;
while
(
*
it
)
{
Char
c
=
*
it
++
;
if
(
c
!=
'{'
&&
c
!=
'}'
)
continue
;
if
(
*
it
==
c
)
{
Char
c
h
=
*
it
++
;
if
(
c
h
!=
'{'
&&
ch
!=
'}'
)
continue
;
if
(
*
it
==
c
h
)
{
buffer
.
append
(
pointer_from
(
start
),
pointer_from
(
it
));
start
=
++
it
;
continue
;
}
if
(
c
==
'}'
)
if
(
c
h
==
'}'
)
FMT_THROW
(
format_error
(
"unmatched '}' in format string"
));
buffer
.
append
(
pointer_from
(
start
),
pointer_from
(
it
)
-
1
);
basic_arg
<
Context
>
arg
;
struct
id_handler
{
explicit
id_handler
(
Context
&
ctx
,
basic_arg
<
Context
>
&
arg
)
:
context
(
ctx
),
arg
(
arg
)
{}
id_handler
(
Context
&
c
,
basic_arg
<
Context
>
&
a
)
:
context
(
c
),
arg
(
a
)
{}
void
operator
()()
{
arg
=
context
.
next_arg
();
}
void
operator
()(
unsigned
id
)
{
arg
=
context
.
get_arg
(
id
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment