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
9ee7c216
Commit
9ee7c216
authored
Sep 06, 2017
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Type -> type
parent
1a09194a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
49 deletions
+48
-49
fmt/format.h
fmt/format.h
+48
-49
No files found.
fmt/format.h
View file @
9ee7c216
...
...
@@ -1100,7 +1100,7 @@ FMT_DISABLE_CONVERSION_TO_INT(float);
FMT_DISABLE_CONVERSION_TO_INT
(
double
);
FMT_DISABLE_CONVERSION_TO_INT
(
long
double
);
enum
T
ype
{
enum
t
ype
{
NONE
,
NAMED_ARG
,
// Integer types should go first,
INT
,
UINT
,
LONG_LONG
,
ULONG_LONG
,
BOOL
,
CHAR
,
LAST_INTEGER_TYPE
=
CHAR
,
...
...
@@ -1109,14 +1109,14 @@ enum Type {
CSTRING
,
STRING
,
TSTRING
,
POINTER
,
CUSTOM
};
inline
bool
is_integral
(
Type
type
)
{
FMT_ASSERT
(
t
ype
!=
internal
::
NAMED_ARG
,
"invalid argument type"
);
return
t
ype
>
internal
::
NONE
&&
type
<=
internal
::
LAST_INTEGER_TYPE
;
inline
bool
is_integral
(
type
t
)
{
FMT_ASSERT
(
t
!=
internal
::
NAMED_ARG
,
"invalid argument type"
);
return
t
>
internal
::
NONE
&&
t
<=
internal
::
LAST_INTEGER_TYPE
;
}
inline
bool
is_numeric
(
Type
type
)
{
FMT_ASSERT
(
t
ype
!=
internal
::
NAMED_ARG
,
"invalid argument type"
);
return
t
ype
>
internal
::
NONE
&&
type
<=
internal
::
LAST_NUMERIC_TYPE
;
inline
bool
is_numeric
(
type
t
)
{
FMT_ASSERT
(
t
!=
internal
::
NAMED_ARG
,
"invalid argument type"
);
return
t
>
internal
::
NONE
&&
t
<=
internal
::
LAST_NUMERIC_TYPE
;
}
template
<
typename
Char
>
...
...
@@ -1145,52 +1145,52 @@ template <typename Char>
struct
is_named_arg
<
named_arg
<
Char
>>
:
std
::
true_type
{};
template
<
typename
T
>
constexpr
T
ype
get_type
()
{
constexpr
t
ype
get_type
()
{
return
std
::
is_reference
<
T
>::
value
||
std
::
is_array
<
T
>::
value
?
get_type
<
typename
std
::
decay
<
T
>::
type
>
()
:
(
is_named_arg
<
T
>::
value
?
NAMED_ARG
:
(
convert_to_int
<
T
>::
value
?
INT
:
CUSTOM
));
}
template
<
>
constexpr
T
ype
get_type
<
bool
>
()
{
return
BOOL
;
}
template
<
>
constexpr
T
ype
get_type
<
short
>
()
{
return
INT
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
short
>
()
{
return
UINT
;
}
template
<
>
constexpr
T
ype
get_type
<
int
>
()
{
return
INT
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
>
()
{
return
UINT
;
}
template
<
>
constexpr
T
ype
get_type
<
long
>
()
{
template
<
>
constexpr
t
ype
get_type
<
bool
>
()
{
return
BOOL
;
}
template
<
>
constexpr
t
ype
get_type
<
short
>
()
{
return
INT
;
}
template
<
>
constexpr
t
ype
get_type
<
unsigned
short
>
()
{
return
UINT
;
}
template
<
>
constexpr
t
ype
get_type
<
int
>
()
{
return
INT
;
}
template
<
>
constexpr
t
ype
get_type
<
unsigned
>
()
{
return
UINT
;
}
template
<
>
constexpr
t
ype
get_type
<
long
>
()
{
return
sizeof
(
long
)
==
sizeof
(
int
)
?
INT
:
LONG_LONG
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
long
>
()
{
template
<
>
constexpr
t
ype
get_type
<
unsigned
long
>
()
{
return
sizeof
(
unsigned
long
)
==
sizeof
(
unsigned
)
?
UINT
:
ULONG_LONG
;
}
template
<
>
constexpr
T
ype
get_type
<
long
long
>
()
{
return
LONG_LONG
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
long
long
>
()
{
return
ULONG_LONG
;
}
template
<
>
constexpr
T
ype
get_type
<
float
>
()
{
return
DOUBLE
;
}
template
<
>
constexpr
T
ype
get_type
<
double
>
()
{
return
DOUBLE
;
}
template
<
>
constexpr
T
ype
get_type
<
long
double
>
()
{
return
LONG_DOUBLE
;
}
template
<
>
constexpr
T
ype
get_type
<
signed
char
>
()
{
return
INT
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
char
>
()
{
return
UINT
;
}
template
<
>
constexpr
T
ype
get_type
<
char
>
()
{
return
CHAR
;
}
template
<
>
constexpr
t
ype
get_type
<
long
long
>
()
{
return
LONG_LONG
;
}
template
<
>
constexpr
t
ype
get_type
<
unsigned
long
long
>
()
{
return
ULONG_LONG
;
}
template
<
>
constexpr
t
ype
get_type
<
float
>
()
{
return
DOUBLE
;
}
template
<
>
constexpr
t
ype
get_type
<
double
>
()
{
return
DOUBLE
;
}
template
<
>
constexpr
t
ype
get_type
<
long
double
>
()
{
return
LONG_DOUBLE
;
}
template
<
>
constexpr
t
ype
get_type
<
signed
char
>
()
{
return
INT
;
}
template
<
>
constexpr
t
ype
get_type
<
unsigned
char
>
()
{
return
UINT
;
}
template
<
>
constexpr
t
ype
get_type
<
char
>
()
{
return
CHAR
;
}
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED)
template
<
>
constexpr
T
ype
get_type
<
wchar_t
>
()
{
return
CHAR
;
}
template
<
>
constexpr
t
ype
get_type
<
wchar_t
>
()
{
return
CHAR
;
}
#endif
template
<
>
constexpr
T
ype
get_type
<
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
const
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
signed
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
const
signed
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
unsigned
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
const
unsigned
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
std
::
string
>
()
{
return
STRING
;
}
template
<
>
constexpr
T
ype
get_type
<
string_view
>
()
{
return
STRING
;
}
template
<
>
constexpr
T
ype
get_type
<
wchar_t
*>
()
{
return
TSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
const
wchar_t
*>
()
{
return
TSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
std
::
wstring
>
()
{
return
TSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
wstring_view
>
()
{
return
TSTRING
;
}
template
<
>
constexpr
T
ype
get_type
<
void
*>
()
{
return
POINTER
;
}
template
<
>
constexpr
T
ype
get_type
<
const
void
*>
()
{
return
POINTER
;
}
template
<
>
constexpr
T
ype
get_type
<
std
::
nullptr_t
>
()
{
return
POINTER
;
}
template
<
>
constexpr
t
ype
get_type
<
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
const
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
signed
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
const
signed
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
unsigned
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
const
unsigned
char
*>
()
{
return
CSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
std
::
string
>
()
{
return
STRING
;
}
template
<
>
constexpr
t
ype
get_type
<
string_view
>
()
{
return
STRING
;
}
template
<
>
constexpr
t
ype
get_type
<
wchar_t
*>
()
{
return
TSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
const
wchar_t
*>
()
{
return
TSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
std
::
wstring
>
()
{
return
TSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
wstring_view
>
()
{
return
TSTRING
;
}
template
<
>
constexpr
t
ype
get_type
<
void
*>
()
{
return
POINTER
;
}
template
<
>
constexpr
t
ype
get_type
<
const
void
*>
()
{
return
POINTER
;
}
template
<
>
constexpr
t
ype
get_type
<
std
::
nullptr_t
>
()
{
return
POINTER
;
}
// A formatting argument value.
template
<
typename
Context
>
...
...
@@ -1362,8 +1362,7 @@ class value {
template
<
typename
Char_
>
value
(
const
named_arg
<
Char_
>
&
value
)
{
static_assert
(
get_type
<
const
named_arg
<
Char_
>
&>
()
==
internal
::
NAMED_ARG
,
"invalid type"
);
get_type
<
const
named_arg
<
Char_
>
&>
()
==
NAMED_ARG
,
"invalid type"
);
this
->
pointer
=
&
value
;
}
};
...
...
@@ -1386,7 +1385,7 @@ template <typename Context>
class
basic_arg
{
private:
internal
::
value
<
Context
>
value_
;
internal
::
T
ype
type_
;
internal
::
t
ype
type_
;
template
<
typename
ContextType
,
typename
T
>
friend
basic_arg
<
ContextType
>
internal
::
make_arg
(
const
T
&
value
);
...
...
@@ -1403,7 +1402,7 @@ class basic_arg {
explicit
operator
bool
()
const
noexcept
{
return
type_
!=
internal
::
NONE
;
}
internal
::
T
ype
type
()
const
{
return
type_
;
}
internal
::
t
ype
type
()
const
{
return
type_
;
}
bool
is_integral
()
const
{
return
internal
::
is_integral
(
type_
);
}
bool
is_numeric
()
const
{
return
internal
::
is_numeric
(
type_
);
}
...
...
@@ -1583,10 +1582,10 @@ class basic_args {
const
format_arg
*
args_
;
};
typename
internal
::
T
ype
type
(
unsigned
index
)
const
{
typename
internal
::
t
ype
type
(
unsigned
index
)
const
{
unsigned
shift
=
index
*
4
;
uint64_t
mask
=
0xf
;
return
static_cast
<
typename
internal
::
T
ype
>
(
return
static_cast
<
typename
internal
::
t
ype
>
(
(
types_
&
(
mask
<<
shift
))
>>
shift
);
}
...
...
@@ -1773,7 +1772,7 @@ void arg_map<Context>::init(const basic_args<Context> &args) {
args
.
type
(
MAX_PACKED_ARGS
-
1
)
==
internal
::
NONE
;
if
(
use_values
)
{
for
(
unsigned
i
=
0
;
/*nothing*/
;
++
i
)
{
internal
::
T
ype
arg_type
=
args
.
type
(
i
);
internal
::
t
ype
arg_type
=
args
.
type
(
i
);
switch
(
arg_type
)
{
case
internal
:
:
NONE
:
return
;
...
...
@@ -1788,7 +1787,7 @@ void arg_map<Context>::init(const basic_args<Context> &args) {
return
;
}
for
(
unsigned
i
=
0
;
i
!=
MAX_PACKED_ARGS
;
++
i
)
{
internal
::
T
ype
arg_type
=
args
.
type
(
i
);
internal
::
t
ype
arg_type
=
args
.
type
(
i
);
if
(
arg_type
==
internal
::
NAMED_ARG
)
{
named_arg
=
static_cast
<
const
NamedArg
*>
(
args
.
args_
[
i
].
value_
.
pointer
);
map_
.
push_back
(
Pair
(
named_arg
->
name
,
*
named_arg
));
...
...
@@ -3155,7 +3154,7 @@ class specs_setter {
template
<
typename
Handler
>
class
specs_checker
:
public
Handler
{
public:
explicit
specs_checker
(
const
Handler
&
handler
,
T
ype
arg_type
)
explicit
specs_checker
(
const
Handler
&
handler
,
t
ype
arg_type
)
:
Handler
(
handler
),
arg_type_
(
arg_type
)
{}
void
on_align
(
alignment
align
)
{
...
...
@@ -3220,7 +3219,7 @@ class specs_checker : public Handler {
}
}
T
ype
arg_type_
;
t
ype
arg_type_
;
};
template
<
typename
Handler
,
typename
T
,
typename
Context
>
...
...
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