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
2972de4b
Commit
2972de4b
authored
Sep 06, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Char -> char_type
parent
9ee7c216
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
fmt/format.h
fmt/format.h
+18
-18
No files found.
fmt/format.h
View file @
2972de4b
...
...
@@ -1211,7 +1211,7 @@ class value {
custom_value
<
typename
Context
::
char_type
>
custom
;
};
typedef
typename
Context
::
char_type
Char
;
using
char_type
=
typename
Context
::
char_type
;
private:
// The following two methods are private to disallow formatting of
...
...
@@ -1229,12 +1229,12 @@ class value {
// fmt::format("{}", L"test");
// To fix this, use a wide format string: fmt::format(L"{}", L"test").
#if !FMT_MSC_VER || defined(_NATIVE_WCHAR_T_DEFINED)
value
(
typename
wchar_helper
<
wchar_t
,
Char
>::
unsupported
);
value
(
typename
wchar_helper
<
wchar_t
,
char_type
>::
unsupported
);
#endif
value
(
typename
wchar_helper
<
wchar_t
*
,
Char
>::
unsupported
);
value
(
typename
wchar_helper
<
const
wchar_t
*
,
Char
>::
unsupported
);
value
(
typename
wchar_helper
<
const
std
::
wstring
&
,
Char
>::
unsupported
);
value
(
typename
wchar_helper
<
wstring_view
,
Char
>::
unsupported
);
value
(
typename
wchar_helper
<
wchar_t
*
,
char_type
>::
unsupported
);
value
(
typename
wchar_helper
<
const
wchar_t
*
,
char_type
>::
unsupported
);
value
(
typename
wchar_helper
<
const
std
::
wstring
&
,
char_type
>::
unsupported
);
value
(
typename
wchar_helper
<
wstring_view
,
char_type
>::
unsupported
);
void
set_string
(
string_view
str
)
{
this
->
string
.
value
=
str
.
data
();
...
...
@@ -1249,8 +1249,8 @@ class value {
// Formats an argument of a custom type, such as a user-defined class.
template
<
typename
T
>
static
void
format_custom_arg
(
basic_buffer
<
Char
>
&
buffer
,
const
void
*
arg
,
basic_string_view
<
Char
>
&
format
,
void
*
context
)
{
basic_buffer
<
char_type
>
&
buffer
,
const
void
*
arg
,
basic_string_view
<
char_type
>
&
format
,
void
*
context
)
{
Context
&
ctx
=
*
static_cast
<
Context
*>
(
context
);
// Get the formatter type through the context to allow different contexts
// have different extension points, e.g. `formatter<T>` for `format` and
...
...
@@ -1305,16 +1305,16 @@ class value {
FMT_MAKE_VALUE
(
char
,
int_value
,
CHAR
)
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
typedef
typename
wchar_helper
<
wchar_t
,
Char
>::
supported
WChar
;
typedef
typename
wchar_helper
<
wchar_t
,
char_type
>::
supported
WChar
;
value
(
WChar
value
)
{
static_assert
(
get_type
<
WChar
>
()
==
internal
::
CHAR
,
"invalid type"
);
static_assert
(
get_type
<
WChar
>
()
==
CHAR
,
"invalid type"
);
this
->
int_value
=
value
;
}
#endif
#define FMT_MAKE_STR_VALUE(Type, TYPE) \
value(Type value) { \
static_assert(get_type<Type>() ==
internal::
TYPE, "invalid type"); \
static_assert(get_type<Type>() == TYPE, "invalid type"); \
set_string(value); \
}
...
...
@@ -1328,8 +1328,8 @@ class value {
FMT_MAKE_STR_VALUE
(
string_view
,
STRING
)
#define FMT_MAKE_WSTR_VALUE(Type, TYPE) \
value(typename wchar_helper<Type,
Char
>::supported value) { \
static_assert(get_type<Type>() ==
internal::
TYPE, "invalid type"); \
value(typename wchar_helper<Type,
char_type
>::supported value) { \
static_assert(get_type<Type>() == TYPE, "invalid type"); \
set_string(value); \
}
...
...
@@ -1345,7 +1345,7 @@ class value {
template
<
typename
T
>
value
(
const
T
&
value
,
typename
std
::
enable_if
<!
convert_to_int
<
T
>::
value
,
int
>::
type
=
0
)
{
static_assert
(
get_type
<
T
>
()
==
internal
::
CUSTOM
,
"invalid type"
);
static_assert
(
get_type
<
T
>
()
==
CUSTOM
,
"invalid type"
);
this
->
custom
.
value
=
&
value
;
this
->
custom
.
format
=
&
format_custom_arg
<
T
>
;
}
...
...
@@ -1353,16 +1353,16 @@ class value {
template
<
typename
T
>
value
(
const
T
&
value
,
typename
std
::
enable_if
<
convert_to_int
<
T
>::
value
,
int
>::
type
=
0
)
{
static_assert
(
get_type
<
T
>
()
==
internal
::
INT
,
"invalid type"
);
static_assert
(
get_type
<
T
>
()
==
INT
,
"invalid type"
);
this
->
int_value
=
value
;
}
// Additional template param `Char_` is needed here because make_type always
// uses char.
template
<
typename
Char
_
>
value
(
const
named_arg
<
Char
_
>
&
value
)
{
template
<
typename
Char
>
value
(
const
named_arg
<
Char
>
&
value
)
{
static_assert
(
get_type
<
const
named_arg
<
Char
_
>
&>
()
==
NAMED_ARG
,
"invalid type"
);
get_type
<
const
named_arg
<
Char
>
&>
()
==
NAMED_ARG
,
"invalid type"
);
this
->
pointer
=
&
value
;
}
};
...
...
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