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
af00e4f9
Commit
af00e4f9
authored
Sep 04, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove printf_arg_formatter from format.h and cleanup
parent
44a26e5e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
37 deletions
+13
-37
fmt/format.h
fmt/format.h
+7
-19
fmt/printf.h
fmt/printf.h
+5
-17
test/printf-test.cc
test/printf-test.cc
+1
-1
No files found.
fmt/format.h
View file @
af00e4f9
...
...
@@ -356,30 +356,22 @@ namespace fmt {
using
std
::
move
;
#endif
template
<
typename
Char
>
class
basic_buffer
;
typedef
basic_buffer
<
char
>
buffer
;
typedef
basic_buffer
<
wchar_t
>
wbuffer
;
template
<
typename
Char
>
class
basic_writer
;
template
<
typename
Context
>
class
basic_arg
;
template
<
typename
Char
>
class
arg_formatter
;
template
<
typename
Char
>
class
printf_arg_formatter
;
template
<
typename
Char
>
class
basic_context
;
typedef
basic_context
<
char
>
context
;
typedef
basic_context
<
wchar_t
>
wcontext
;
// A formatter for objects of type T.
template
<
typename
T
,
typename
Char
=
char
,
typename
Enable
=
void
>
struct
formatter
;
/**
\rst
An implementation of ``std::basic_string_view`` for pre-C++17. It provides a
...
...
@@ -482,10 +474,6 @@ class format_error : public std::runtime_error {
~
format_error
()
throw
();
};
// A formatter for objects of type T.
template
<
typename
T
,
typename
Char
=
char
,
typename
Enable
=
void
>
struct
formatter
;
namespace
internal
{
// Casts nonnegative integer to unsigned.
...
...
@@ -589,6 +577,9 @@ class basic_buffer {
virtual
std
::
locale
locale
()
const
{
return
std
::
locale
();
}
};
typedef
basic_buffer
<
char
>
buffer
;
typedef
basic_buffer
<
wchar_t
>
wbuffer
;
template
<
typename
T
>
template
<
typename
U
>
void
basic_buffer
<
T
>::
append
(
const
U
*
begin
,
const
U
*
end
)
{
...
...
@@ -2304,9 +2295,6 @@ class basic_writer {
template
<
typename
Char_
>
friend
class
internal
::
arg_formatter_base
;
template
<
typename
Char_
>
friend
class
printf_arg_formatter
;
public:
/**
Constructs a ``basic_writer`` object.
...
...
fmt/printf.h
View file @
af00e4f9
...
...
@@ -241,25 +241,13 @@ class printf_arg_formatter : public internal::arg_formatter_base<Char> {
/** Formats a character. */
void
operator
()(
Char
value
)
{
const
format_specs
&
fmt_spec
=
this
->
spec
();
format_specs
&
fmt_spec
=
this
->
spec
();
basic_writer
<
Char
>
&
w
=
this
->
writer
();
if
(
fmt_spec
.
type_
&&
fmt_spec
.
type_
!=
'c'
)
w
.
write_int
(
value
,
fmt_spec
);
typedef
typename
basic_writer
<
Char
>::
pointer_type
pointer_type
;
pointer_type
out
=
pointer_type
();
if
(
fmt_spec
.
width_
>
1
)
{
Char
fill
=
' '
;
out
=
w
.
grow_buffer
(
fmt_spec
.
width_
);
if
(
fmt_spec
.
align_
!=
ALIGN_LEFT
)
{
std
::
fill_n
(
out
,
fmt_spec
.
width_
-
1
,
fill
);
out
+=
fmt_spec
.
width_
-
1
;
}
else
{
std
::
fill_n
(
out
+
1
,
fmt_spec
.
width_
-
1
,
fill
);
}
}
else
{
out
=
w
.
grow_buffer
(
1
);
}
*
out
=
static_cast
<
Char
>
(
value
);
return
(
*
this
)(
static_cast
<
int
>
(
value
));
fmt_spec
.
flags_
=
0
;
fmt_spec
.
align_
=
ALIGN_RIGHT
;
Base
::
operator
()(
value
);
}
/** Formats a null-terminated C string. */
...
...
test/printf-test.cc
View file @
af00e4f9
...
...
@@ -137,7 +137,7 @@ TEST(PrintfTest, ZeroFlag) {
EXPECT_PRINTF
(
"+00042"
,
"%00+6d"
,
42
);
// '0' flag is ignored for non-numeric types.
EXPECT_PRINTF
(
"
x"
,
"%05c"
,
'x'
);
EXPECT_PRINTF
(
"
0000
x"
,
"%05c"
,
'x'
);
}
TEST
(
PrintfTest
,
PlusFlag
)
{
...
...
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