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
bc15e370
Commit
bc15e370
authored
Jul 07, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typedef -> using
parent
cf5ebf20
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
include/fmt/format.h
include/fmt/format.h
+23
-26
No files found.
include/fmt/format.h
View file @
bc15e370
...
@@ -2093,8 +2093,6 @@ enum class arg_id_kind { none, index, name };
...
@@ -2093,8 +2093,6 @@ enum class arg_id_kind { none, index, name };
// An argument reference.
// An argument reference.
template
<
typename
Char
>
struct
arg_ref
{
template
<
typename
Char
>
struct
arg_ref
{
typedef
Char
char_type
;
FMT_CONSTEXPR
arg_ref
()
:
kind
(
arg_id_kind
::
none
),
val
()
{}
FMT_CONSTEXPR
arg_ref
()
:
kind
(
arg_id_kind
::
none
),
val
()
{}
FMT_CONSTEXPR
explicit
arg_ref
(
unsigned
index
)
FMT_CONSTEXPR
explicit
arg_ref
(
unsigned
index
)
:
kind
(
arg_id_kind
::
index
),
val
(
index
)
{}
:
kind
(
arg_id_kind
::
index
),
val
(
index
)
{}
...
@@ -2133,7 +2131,7 @@ template <typename ParseContext>
...
@@ -2133,7 +2131,7 @@ template <typename ParseContext>
class
dynamic_specs_handler
class
dynamic_specs_handler
:
public
specs_setter
<
typename
ParseContext
::
char_type
>
{
:
public
specs_setter
<
typename
ParseContext
::
char_type
>
{
public:
public:
typedef
typename
ParseContext
::
char_type
char_type
;
using
char_type
=
typename
ParseContext
::
char_type
;
FMT_CONSTEXPR
dynamic_specs_handler
(
dynamic_format_specs
<
char_type
>&
specs
,
FMT_CONSTEXPR
dynamic_specs_handler
(
dynamic_format_specs
<
char_type
>&
specs
,
ParseContext
&
ctx
)
ParseContext
&
ctx
)
...
@@ -2157,7 +2155,7 @@ class dynamic_specs_handler
...
@@ -2157,7 +2155,7 @@ class dynamic_specs_handler
}
}
private:
private:
typedef
arg_ref
<
char_type
>
arg_ref_type
;
using
arg_ref_type
=
arg_ref
<
char_type
>
;
FMT_CONSTEXPR
arg_ref_type
make_arg_ref
(
unsigned
arg_id
)
{
FMT_CONSTEXPR
arg_ref_type
make_arg_ref
(
unsigned
arg_id
)
{
context_
.
check_arg_id
(
arg_id
);
context_
.
check_arg_id
(
arg_id
);
...
@@ -2493,7 +2491,7 @@ class format_string_checker {
...
@@ -2493,7 +2491,7 @@ class format_string_checker {
FMT_CONSTEXPR
const
Char
*
on_format_specs
(
const
Char
*
begin
,
const
Char
*
)
{
FMT_CONSTEXPR
const
Char
*
on_format_specs
(
const
Char
*
begin
,
const
Char
*
)
{
advance_to
(
context_
,
begin
);
advance_to
(
context_
,
begin
);
return
arg_id_
<
NUM_ARGS
?
parse_funcs_
[
arg_id_
](
context_
)
:
begin
;
return
arg_id_
<
num_args
?
parse_funcs_
[
arg_id_
](
context_
)
:
begin
;
}
}
FMT_CONSTEXPR
void
on_error
(
const
char
*
message
)
{
FMT_CONSTEXPR
void
on_error
(
const
char
*
message
)
{
...
@@ -2501,19 +2499,19 @@ class format_string_checker {
...
@@ -2501,19 +2499,19 @@ class format_string_checker {
}
}
private:
private:
typedef
basic_parse_context
<
Char
,
ErrorHandler
>
parse_context_type
;
using
parse_context_type
=
basic_parse_context
<
Char
,
ErrorHandler
>
;
enum
{
NUM_ARGS
=
sizeof
...(
Args
)
};
enum
{
num_args
=
sizeof
...(
Args
)
};
FMT_CONSTEXPR
void
check_arg_id
()
{
FMT_CONSTEXPR
void
check_arg_id
()
{
if
(
arg_id_
>=
NUM_ARGS
)
context_
.
on_error
(
"argument index out of range"
);
if
(
arg_id_
>=
num_args
)
context_
.
on_error
(
"argument index out of range"
);
}
}
// Format specifier parsing function.
// Format specifier parsing function.
typedef
const
Char
*
(
*
parse_func
)(
parse_context_type
&
);
using
parse_func
=
const
Char
*
(
*
)(
parse_context_type
&
);
unsigned
arg_id_
;
unsigned
arg_id_
;
parse_context_type
context_
;
parse_context_type
context_
;
parse_func
parse_funcs_
[
NUM_ARGS
>
0
?
NUM_ARGS
:
1
];
parse_func
parse_funcs_
[
num_args
>
0
?
num_args
:
1
];
};
};
template
<
typename
Char
,
typename
ErrorHandler
,
typename
...
Args
>
template
<
typename
Char
,
typename
ErrorHandler
,
typename
...
Args
>
...
@@ -2527,10 +2525,10 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
...
@@ -2527,10 +2525,10 @@ FMT_CONSTEXPR bool do_check_format_string(basic_string_view<Char> s,
template
<
typename
...
Args
,
typename
S
,
template
<
typename
...
Args
,
typename
S
,
enable_if_t
<
(
is_compile_string
<
S
>
::
value
),
int
>>
enable_if_t
<
(
is_compile_string
<
S
>
::
value
),
int
>>
void
check_format_string
(
S
format_str
)
{
void
check_format_string
(
S
format_str
)
{
typedef
typename
S
::
char_type
char_t
;
FMT_CONSTEXPR_DECL
bool
invalid_format
=
FMT_CONSTEXPR_DECL
bool
invalid_format
=
internal
::
do_check_format_string
<
char_t
,
internal
::
error_handler
,
internal
::
do_check_format_string
<
typename
S
::
char_type
,
Args
...
>
(
to_string_view
(
format_str
));
internal
::
error_handler
,
Args
...
>
(
to_string_view
(
format_str
));
(
void
)
invalid_format
;
(
void
)
invalid_format
;
}
}
...
@@ -2565,17 +2563,17 @@ using wwriter FMT_DEPRECATED =
...
@@ -2565,17 +2563,17 @@ using wwriter FMT_DEPRECATED =
template
<
typename
Range
>
template
<
typename
Range
>
class
arg_formatter
:
public
internal
::
arg_formatter_base
<
Range
>
{
class
arg_formatter
:
public
internal
::
arg_formatter_base
<
Range
>
{
private:
private:
typedef
typename
Range
::
value_type
char
_type
;
using
char_type
=
typename
Range
::
value
_type
;
typedef
internal
::
arg_formatter_base
<
Range
>
base
;
using
base
=
internal
::
arg_formatter_base
<
Range
>
;
typedef
basic_format_context
<
typename
base
::
iterator
,
char_type
>
context_type
;
using
context_type
=
basic_format_context
<
typename
base
::
iterator
,
char_type
>
;
context_type
&
ctx_
;
context_type
&
ctx_
;
basic_parse_context
<
char_type
>*
parse_ctx_
;
basic_parse_context
<
char_type
>*
parse_ctx_
;
public:
public:
typedef
Range
r
ange
;
using
range
=
R
ange
;
typedef
typename
base
::
iterator
iterator
;
using
iterator
=
typename
base
::
iterator
;
typedef
typename
base
::
format_specs
format_specs
;
using
format_specs
=
typename
base
::
format_specs
;
/**
/**
\rst
\rst
...
@@ -3026,7 +3024,7 @@ struct formatter<Char[N], Char> : formatter<basic_string_view<Char>, Char> {
...
@@ -3026,7 +3024,7 @@ struct formatter<Char[N], Char> : formatter<basic_string_view<Char>, Char> {
// A formatter for types known only at run time such as variant alternatives.
// A formatter for types known only at run time such as variant alternatives.
//
//
// Usage:
// Usage:
//
typedef std::variant<int, std::string> variant
;
//
using variant = std::variant<int, std::string>
;
// template <>
// template <>
// struct formatter<variant>: dynamic_formatter<> {
// struct formatter<variant>: dynamic_formatter<> {
// void format(buffer &buf, const variant &v, context &ctx) {
// void format(buffer &buf, const variant &v, context &ctx) {
...
@@ -3074,9 +3072,8 @@ template <typename Char = char> class dynamic_formatter {
...
@@ -3074,9 +3072,8 @@ template <typename Char = char> class dynamic_formatter {
}
}
if
(
specs_
.
alt
)
checker
.
on_hash
();
if
(
specs_
.
alt
)
checker
.
on_hash
();
if
(
specs_
.
precision
>=
0
)
checker
.
end_precision
();
if
(
specs_
.
precision
>=
0
)
checker
.
end_precision
();
typedef
internal
::
output_range
<
typename
FormatContext
::
iterator
,
using
range
=
internal
::
output_range
<
typename
FormatContext
::
iterator
,
typename
FormatContext
::
char_type
>
typename
FormatContext
::
char_type
>
;
range
;
visit_format_arg
(
arg_formatter
<
range
>
(
ctx
,
nullptr
,
&
specs_
),
visit_format_arg
(
arg_formatter
<
range
>
(
ctx
,
nullptr
,
&
specs_
),
internal
::
make_arg
<
FormatContext
>
(
val
));
internal
::
make_arg
<
FormatContext
>
(
val
));
return
ctx
.
out
();
return
ctx
.
out
();
...
@@ -3111,7 +3108,7 @@ FMT_CONSTEXPR void advance_to(basic_parse_context<Char, ErrorHandler>& ctx,
...
@@ -3111,7 +3108,7 @@ FMT_CONSTEXPR void advance_to(basic_parse_context<Char, ErrorHandler>& ctx,
template
<
typename
ArgFormatter
,
typename
Char
,
typename
Context
>
template
<
typename
ArgFormatter
,
typename
Char
,
typename
Context
>
struct
format_handler
:
internal
::
error_handler
{
struct
format_handler
:
internal
::
error_handler
{
typedef
typename
ArgFormatter
::
range
range
;
using
range
=
typename
ArgFormatter
::
range
;
format_handler
(
range
r
,
basic_string_view
<
Char
>
str
,
format_handler
(
range
r
,
basic_string_view
<
Char
>
str
,
basic_format_args
<
Context
>
format_args
,
basic_format_args
<
Context
>
format_args
,
...
@@ -3149,7 +3146,7 @@ struct format_handler : internal::error_handler {
...
@@ -3149,7 +3146,7 @@ struct format_handler : internal::error_handler {
if
(
visit_format_arg
(
f
,
arg
))
return
parse_context
.
begin
();
if
(
visit_format_arg
(
f
,
arg
))
return
parse_context
.
begin
();
basic_format_specs
<
Char
>
specs
;
basic_format_specs
<
Char
>
specs
;
using
internal
::
specs_handler
;
using
internal
::
specs_handler
;
typedef
basic_parse_context
<
Char
>
parse_context_t
;
using
parse_context_t
=
basic_parse_context
<
Char
>
;
internal
::
specs_checker
<
specs_handler
<
parse_context_t
,
Context
>>
handler
(
internal
::
specs_checker
<
specs_handler
<
parse_context_t
,
Context
>>
handler
(
specs_handler
<
parse_context_t
,
Context
>
(
specs
,
parse_context
,
context
),
specs_handler
<
parse_context_t
,
Context
>
(
specs
,
parse_context
,
context
),
arg
.
type
());
arg
.
type
());
...
@@ -3200,7 +3197,7 @@ struct formatter<arg_join<It, Char>, Char>
...
@@ -3200,7 +3197,7 @@ struct formatter<arg_join<It, Char>, Char>
template
<
typename
FormatContext
>
template
<
typename
FormatContext
>
auto
format
(
const
arg_join
<
It
,
Char
>&
value
,
FormatContext
&
ctx
)
auto
format
(
const
arg_join
<
It
,
Char
>&
value
,
FormatContext
&
ctx
)
->
decltype
(
ctx
.
out
())
{
->
decltype
(
ctx
.
out
())
{
typedef
formatter
<
typename
std
::
iterator_traits
<
It
>::
value_type
,
Char
>
base
;
using
base
=
formatter
<
typename
std
::
iterator_traits
<
It
>::
value_type
,
Char
>
;
auto
it
=
value
.
begin
;
auto
it
=
value
.
begin
;
auto
out
=
ctx
.
out
();
auto
out
=
ctx
.
out
();
if
(
it
!=
value
.
end
)
{
if
(
it
!=
value
.
end
)
{
...
...
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