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
7446818f
Commit
7446818f
authored
Oct 21, 2020
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify vformat_to
parent
280b5612
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
27 deletions
+18
-27
include/fmt/core.h
include/fmt/core.h
+1
-1
include/fmt/format.h
include/fmt/format.h
+15
-15
include/fmt/locale.h
include/fmt/locale.h
+1
-10
src/format.cc
src/format.cc
+1
-1
No files found.
include/fmt/core.h
View file @
7446818f
...
@@ -1949,7 +1949,7 @@ std::basic_string<Char> vformat(
...
@@ -1949,7 +1949,7 @@ std::basic_string<Char> vformat(
FMT_API
std
::
string
vformat
(
string_view
format_str
,
format_args
args
);
FMT_API
std
::
string
vformat
(
string_view
format_str
,
format_args
args
);
template
<
typename
Char
>
template
<
typename
Char
>
buffer_appender
<
Char
>
vformat_to
(
void
vformat_to
(
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
FMT_BUFFER_CONTEXT
(
type_identity_t
<
Char
>
)
>
args
,
basic_format_args
<
FMT_BUFFER_CONTEXT
(
type_identity_t
<
Char
>
)
>
args
,
detail
::
locale_ref
loc
=
{});
detail
::
locale_ref
loc
=
{});
...
...
include/fmt/format.h
View file @
7446818f
...
@@ -3746,29 +3746,28 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char, SIZE>& buf) {
...
@@ -3746,29 +3746,28 @@ std::basic_string<Char> to_string(const basic_memory_buffer<Char, SIZE>& buf) {
}
}
template
<
typename
Char
>
template
<
typename
Char
>
detail
::
buffer_appender
<
Char
>
detail
::
vformat_to
(
void
detail
::
vformat_to
(
detail
::
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
detail
::
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
buffer_context
<
type_identity_t
<
Char
>>>
args
,
basic_format_args
<
buffer_context
<
type_identity_t
<
Char
>>>
args
,
detail
::
locale_ref
loc
)
{
detail
::
locale_ref
loc
)
{
using
iterator
=
typename
buffer_context
<
Char
>::
iterator
;
using
iterator
=
typename
buffer_context
<
Char
>::
iterator
;
auto
out
=
buffer_appender
<
Char
>
(
buf
);
auto
out
=
buffer_appender
<
Char
>
(
buf
);
if
(
format_str
.
size
()
==
2
&&
detail
::
equal2
(
format_str
.
data
(),
"{}"
))
{
if
(
format_str
.
size
()
==
2
&&
equal2
(
format_str
.
data
(),
"{}"
))
{
auto
arg
=
args
.
get
(
0
);
auto
arg
=
args
.
get
(
0
);
if
(
!
arg
)
detail
::
error_handler
().
on_error
(
"argument not found"
);
if
(
!
arg
)
error_handler
().
on_error
(
"argument not found"
);
return
visit_format_arg
(
visit_format_arg
(
default_arg_formatter
<
iterator
,
Char
>
{
out
,
args
,
loc
},
detail
::
default_arg_formatter
<
iterator
,
Char
>
{
out
,
args
,
loc
},
arg
);
arg
);
return
;
}
}
detail
::
format_handler
<
arg_formatter
<
iterator
,
Char
>
,
Char
,
format_handler
<
arg_formatter
<
iterator
,
Char
>
,
Char
,
buffer_context
<
Char
>>
h
(
buffer_context
<
Char
>>
out
,
format_str
,
args
,
loc
);
h
(
out
,
format_str
,
args
,
loc
);
parse_format_string
<
false
>
(
format_str
,
h
);
detail
::
parse_format_string
<
false
>
(
format_str
,
h
);
return
h
.
context
.
out
();
}
}
#ifndef FMT_HEADER_ONLY
#ifndef FMT_HEADER_ONLY
extern
template
format_context
::
iterator
detail
::
vformat_to
(
extern
template
void
detail
::
vformat_to
(
detail
::
buffer
<
char
>
&
,
string_view
,
detail
::
buffer
<
char
>
&
,
string_view
,
basic_format_args
<
format_context
>
,
basic_format_args
<
format_context
>
,
detail
::
locale_ref
);
detail
::
locale_ref
);
namespace
detail
{
namespace
detail
{
extern
template
FMT_API
std
::
string
grouping_impl
<
char
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
char
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
wchar_t
>(
locale_ref
loc
);
extern
template
FMT_API
std
::
string
grouping_impl
<
wchar_t
>(
locale_ref
loc
);
...
@@ -3795,7 +3794,7 @@ extern template int snprintf_float<long double>(long double value,
...
@@ -3795,7 +3794,7 @@ extern template int snprintf_float<long double>(long double value,
template
<
typename
S
,
typename
Char
=
char_t
<
S
>,
template
<
typename
S
,
typename
Char
=
char_t
<
S
>,
FMT_ENABLE_IF
(
detail
::
is_string
<
S
>::
value
)
>
FMT_ENABLE_IF
(
detail
::
is_string
<
S
>::
value
)
>
inline
typename
FMT_BUFFER_CONTEXT
(
Char
)
::
iterator
vformat_to
(
inline
void
vformat_to
(
detail
::
buffer
<
Char
>&
buf
,
const
S
&
format_str
,
detail
::
buffer
<
Char
>&
buf
,
const
S
&
format_str
,
basic_format_args
<
FMT_BUFFER_CONTEXT
(
type_identity_t
<
Char
>
)
>
args
)
{
basic_format_args
<
FMT_BUFFER_CONTEXT
(
type_identity_t
<
Char
>
)
>
args
)
{
return
detail
::
vformat_to
(
buf
,
to_string_view
(
format_str
),
args
);
return
detail
::
vformat_to
(
buf
,
to_string_view
(
format_str
),
args
);
...
@@ -3806,7 +3805,8 @@ template <typename S, typename... Args, size_t SIZE = inline_buffer_size,
...
@@ -3806,7 +3805,8 @@ template <typename S, typename... Args, size_t SIZE = inline_buffer_size,
inline
typename
buffer_context
<
Char
>::
iterator
format_to
(
inline
typename
buffer_context
<
Char
>::
iterator
format_to
(
basic_memory_buffer
<
Char
,
SIZE
>&
buf
,
const
S
&
format_str
,
Args
&&
...
args
)
{
basic_memory_buffer
<
Char
,
SIZE
>&
buf
,
const
S
&
format_str
,
Args
&&
...
args
)
{
const
auto
&
vargs
=
fmt
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...);
const
auto
&
vargs
=
fmt
::
make_args_checked
<
Args
...
>
(
format_str
,
args
...);
return
detail
::
vformat_to
(
buf
,
to_string_view
(
format_str
),
vargs
);
detail
::
vformat_to
(
buf
,
to_string_view
(
format_str
),
vargs
);
return
detail
::
buffer_appender
<
Char
>
(
buf
);
}
}
template
<
typename
OutputIt
,
typename
Char
=
char
>
template
<
typename
OutputIt
,
typename
Char
=
char
>
...
...
include/fmt/locale.h
View file @
7446818f
...
@@ -15,21 +15,12 @@
...
@@ -15,21 +15,12 @@
FMT_BEGIN_NAMESPACE
FMT_BEGIN_NAMESPACE
namespace
detail
{
namespace
detail
{
template
<
typename
Char
>
typename
buffer_context
<
Char
>::
iterator
vformat_to
(
const
std
::
locale
&
loc
,
buffer
<
Char
>&
buf
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
buffer_context
<
type_identity_t
<
Char
>>>
args
)
{
return
vformat_to
(
buf
,
to_string_view
(
format_str
),
args
,
detail
::
locale_ref
(
loc
));
}
template
<
typename
Char
>
template
<
typename
Char
>
std
::
basic_string
<
Char
>
vformat
(
std
::
basic_string
<
Char
>
vformat
(
const
std
::
locale
&
loc
,
basic_string_view
<
Char
>
format_str
,
const
std
::
locale
&
loc
,
basic_string_view
<
Char
>
format_str
,
basic_format_args
<
buffer_context
<
type_identity_t
<
Char
>>>
args
)
{
basic_format_args
<
buffer_context
<
type_identity_t
<
Char
>>>
args
)
{
basic_memory_buffer
<
Char
>
buffer
;
basic_memory_buffer
<
Char
>
buffer
;
detail
::
vformat_to
(
loc
,
buffer
,
format_str
,
args
);
detail
::
vformat_to
(
buffer
,
format_str
,
args
,
detail
::
locale_ref
(
loc
)
);
return
fmt
::
to_string
(
buffer
);
return
fmt
::
to_string
(
buffer
);
}
}
}
// namespace detail
}
// namespace detail
...
...
src/format.cc
View file @
7446818f
...
@@ -44,7 +44,7 @@ template FMT_API char detail::decimal_point_impl(locale_ref);
...
@@ -44,7 +44,7 @@ template FMT_API char detail::decimal_point_impl(locale_ref);
template
FMT_API
void
detail
::
buffer
<
char
>
::
append
(
const
char
*
,
const
char
*
);
template
FMT_API
void
detail
::
buffer
<
char
>
::
append
(
const
char
*
,
const
char
*
);
template
FMT_API
FMT_BUFFER_CONTEXT
(
char
)
::
iterator
detail
::
vformat_to
(
template
FMT_API
void
detail
::
vformat_to
(
detail
::
buffer
<
char
>
&
,
string_view
,
detail
::
buffer
<
char
>
&
,
string_view
,
basic_format_args
<
FMT_BUFFER_CONTEXT
(
char
)>,
detail
::
locale_ref
);
basic_format_args
<
FMT_BUFFER_CONTEXT
(
char
)>,
detail
::
locale_ref
);
...
...
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