Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
17702969
Commit
17702969
authored
Oct 02, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrded to fmt version 5.2.1
parent
cc3613e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
100 deletions
+104
-100
color.h
include/spdlog/fmt/bundled/color.h
+0
-0
core.h
include/spdlog/fmt/bundled/core.h
+64
-4
format.h
include/spdlog/fmt/bundled/format.h
+31
-63
locale.h
include/spdlog/fmt/bundled/locale.h
+0
-27
printf.h
include/spdlog/fmt/bundled/printf.h
+6
-6
ranges.h
include/spdlog/fmt/bundled/ranges.h
+3
-0
No files found.
include/spdlog/fmt/bundled/color.h
deleted
100644 → 0
View file @
cc3613e0
This diff is collapsed.
Click to expand it.
include/spdlog/fmt/bundled/core.h
View file @
17702969
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
#include <type_traits>
#include <type_traits>
// The fmt library version in the form major * 10000 + minor * 100 + patch.
// The fmt library version in the form major * 10000 + minor * 100 + patch.
#define FMT_VERSION 5020
0
#define FMT_VERSION 5020
1
#ifdef __has_feature
#ifdef __has_feature
# define FMT_HAS_FEATURE(x) __has_feature(x)
# define FMT_HAS_FEATURE(x) __has_feature(x)
...
@@ -340,9 +340,22 @@ class basic_format_arg;
...
@@ -340,9 +340,22 @@ class basic_format_arg;
template
<
typename
Context
>
template
<
typename
Context
>
class
basic_format_args
;
class
basic_format_args
;
template
<
typename
T
>
struct
no_formatter_error
:
std
::
false_type
{};
// A formatter for objects of type T.
// A formatter for objects of type T.
template
<
typename
T
,
typename
Char
=
char
,
typename
Enable
=
void
>
template
<
typename
T
,
typename
Char
=
char
,
typename
Enable
=
void
>
struct
formatter
;
struct
formatter
{
static_assert
(
no_formatter_error
<
T
>::
value
,
"don't know how to format the type, include fmt/ostream.h if it provides "
"an operator<< that should be used"
);
// The following functions are not defined intentionally.
template
<
typename
ParseContext
>
typename
ParseContext
::
iterator
parse
(
ParseContext
&
);
template
<
typename
FormatContext
>
auto
format
(
const
T
&
val
,
FormatContext
&
ctx
)
->
decltype
(
ctx
.
out
());
};
template
<
typename
T
,
typename
Char
,
typename
Enable
=
void
>
template
<
typename
T
,
typename
Char
,
typename
Enable
=
void
>
struct
convert_to_int
{
struct
convert_to_int
{
...
@@ -755,6 +768,54 @@ class basic_format_arg {
...
@@ -755,6 +768,54 @@ class basic_format_arg {
bool
is_arithmetic
()
const
{
return
internal
::
is_arithmetic
(
type_
);
}
bool
is_arithmetic
()
const
{
return
internal
::
is_arithmetic
(
type_
);
}
};
};
struct
monostate
{};
/**
\rst
Visits an argument dispatching to the appropriate visit method based on
the argument type. For example, if the argument type is ``double`` then
``vis(value)`` will be called with the value of type ``double``.
\endrst
*/
template
<
typename
Visitor
,
typename
Context
>
FMT_CONSTEXPR
typename
internal
::
result_of
<
Visitor
(
int
)
>::
type
visit
(
Visitor
&&
vis
,
const
basic_format_arg
<
Context
>
&
arg
)
{
typedef
typename
Context
::
char_type
char_type
;
switch
(
arg
.
type_
)
{
case
internal
:
:
none_type
:
break
;
case
internal
:
:
named_arg_type
:
FMT_ASSERT
(
false
,
"invalid argument type"
);
break
;
case
internal
:
:
int_type
:
return
vis
(
arg
.
value_
.
int_value
);
case
internal
:
:
uint_type
:
return
vis
(
arg
.
value_
.
uint_value
);
case
internal
:
:
long_long_type
:
return
vis
(
arg
.
value_
.
long_long_value
);
case
internal
:
:
ulong_long_type
:
return
vis
(
arg
.
value_
.
ulong_long_value
);
case
internal
:
:
bool_type
:
return
vis
(
arg
.
value_
.
int_value
!=
0
);
case
internal
:
:
char_type
:
return
vis
(
static_cast
<
char_type
>
(
arg
.
value_
.
int_value
));
case
internal
:
:
double_type
:
return
vis
(
arg
.
value_
.
double_value
);
case
internal
:
:
long_double_type
:
return
vis
(
arg
.
value_
.
long_double_value
);
case
internal
:
:
cstring_type
:
return
vis
(
arg
.
value_
.
string
.
value
);
case
internal
:
:
string_type
:
return
vis
(
basic_string_view
<
char_type
>
(
arg
.
value_
.
string
.
value
,
arg
.
value_
.
string
.
size
));
case
internal
:
:
pointer_type
:
return
vis
(
arg
.
value_
.
pointer
);
case
internal
:
:
custom_type
:
return
vis
(
typename
basic_format_arg
<
Context
>::
handle
(
arg
.
value_
.
custom
));
}
return
vis
(
monostate
());
}
// Parsing context consisting of a format string range being parsed and an
// Parsing context consisting of a format string range being parsed and an
// argument counter for automatic indexing.
// argument counter for automatic indexing.
template
<
typename
Char
,
typename
ErrorHandler
=
internal
::
error_handler
>
template
<
typename
Char
,
typename
ErrorHandler
=
internal
::
error_handler
>
...
@@ -1382,8 +1443,7 @@ inline std::basic_string<
...
@@ -1382,8 +1443,7 @@ inline std::basic_string<
typedef
typename
buffer_context
<
char_t
>::
type
context_t
;
typedef
typename
buffer_context
<
char_t
>::
type
context_t
;
format_arg_store
<
context_t
,
Args
...
>
as
{
args
...};
format_arg_store
<
context_t
,
Args
...
>
as
{
args
...};
return
internal
::
vformat
(
return
internal
::
vformat
(
basic_string_view
<
char_t
>
(
format_str
),
basic_string_view
<
char_t
>
(
format_str
),
basic_format_args
<
context_t
>
(
as
));
basic_format_args
<
context_t
>
(
as
));
}
}
FMT_API
void
vprint
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
);
FMT_API
void
vprint
(
std
::
FILE
*
f
,
string_view
format_str
,
format_args
args
);
...
...
include/spdlog/fmt/bundled/format.h
View file @
17702969
...
@@ -51,6 +51,12 @@
...
@@ -51,6 +51,12 @@
# define FMT_ICC_VERSION 0
# define FMT_ICC_VERSION 0
#endif
#endif
#ifdef __NVCC__
# define FMT_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 100 + __CUDACC_VER_MINOR__)
#else
# define FMT_CUDA_VERSION 0
#endif
#include "core.h"
#include "core.h"
#if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
#if FMT_GCC_VERSION >= 406 || FMT_CLANG_VERSION
...
@@ -114,17 +120,23 @@ FMT_END_NAMESPACE
...
@@ -114,17 +120,23 @@ FMT_END_NAMESPACE
#endif
#endif
#ifndef FMT_USE_USER_DEFINED_LITERALS
#ifndef FMT_USE_USER_DEFINED_LITERALS
// For Intel's compiler both it and the system gcc/msc must support UDLs.
// For Intel's compiler and NVIDIA's compiler both it and the system gcc/msc
// must support UDLs.
# if (FMT_HAS_FEATURE(cxx_user_literals) || \
# if (FMT_HAS_FEATURE(cxx_user_literals) || \
FMT_GCC_VERSION >= 407 || FMT_MSC_VER >= 1900) && \
FMT_GCC_VERSION >= 407 || FMT_MSC_VER >= 1900) && \
(!FMT_ICC_VERSION || FMT_ICC_VERSION >= 1500)
(!(FMT_ICC_VERSION || FMT_CUDA_VERSION) || \
FMT_ICC_VERSION >= 1500 || FMT_CUDA_VERSION >= 700)
# define FMT_USE_USER_DEFINED_LITERALS 1
# define FMT_USE_USER_DEFINED_LITERALS 1
# else
# else
# define FMT_USE_USER_DEFINED_LITERALS 0
# define FMT_USE_USER_DEFINED_LITERALS 0
# endif
# endif
#endif
#endif
#if FMT_USE_USER_DEFINED_LITERALS && FMT_ICC_VERSION == 0 && \
// EDG C++ Front End based compilers (icc, nvcc) do not currently support UDL
// templates.
#if FMT_USE_USER_DEFINED_LITERALS && \
FMT_ICC_VERSION == 0 && \
FMT_CUDA_VERSION == 0 && \
((FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L) || \
((FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L) || \
(defined(FMT_CLANG_VERSION) && FMT_CLANG_VERSION >= 304))
(defined(FMT_CLANG_VERSION) && FMT_CLANG_VERSION >= 304))
# define FMT_UDL_TEMPLATE 1
# define FMT_UDL_TEMPLATE 1
...
@@ -1154,54 +1166,6 @@ template <typename T = void>
...
@@ -1154,54 +1166,6 @@ template <typename T = void>
struct
null
{};
struct
null
{};
}
// namespace internal
}
// namespace internal
struct
monostate
{};
/**
\rst
Visits an argument dispatching to the appropriate visit method based on
the argument type. For example, if the argument type is ``double`` then
``vis(value)`` will be called with the value of type ``double``.
\endrst
*/
template
<
typename
Visitor
,
typename
Context
>
FMT_CONSTEXPR
typename
internal
::
result_of
<
Visitor
(
int
)
>::
type
visit
(
Visitor
&&
vis
,
const
basic_format_arg
<
Context
>
&
arg
)
{
typedef
typename
Context
::
char_type
char_type
;
switch
(
arg
.
type_
)
{
case
internal
:
:
none_type
:
break
;
case
internal
:
:
named_arg_type
:
FMT_ASSERT
(
false
,
"invalid argument type"
);
break
;
case
internal
:
:
int_type
:
return
vis
(
arg
.
value_
.
int_value
);
case
internal
:
:
uint_type
:
return
vis
(
arg
.
value_
.
uint_value
);
case
internal
:
:
long_long_type
:
return
vis
(
arg
.
value_
.
long_long_value
);
case
internal
:
:
ulong_long_type
:
return
vis
(
arg
.
value_
.
ulong_long_value
);
case
internal
:
:
bool_type
:
return
vis
(
arg
.
value_
.
int_value
!=
0
);
case
internal
:
:
char_type
:
return
vis
(
static_cast
<
char_type
>
(
arg
.
value_
.
int_value
));
case
internal
:
:
double_type
:
return
vis
(
arg
.
value_
.
double_value
);
case
internal
:
:
long_double_type
:
return
vis
(
arg
.
value_
.
long_double_value
);
case
internal
:
:
cstring_type
:
return
vis
(
arg
.
value_
.
string
.
value
);
case
internal
:
:
string_type
:
return
vis
(
basic_string_view
<
char_type
>
(
arg
.
value_
.
string
.
value
,
arg
.
value_
.
string
.
size
));
case
internal
:
:
pointer_type
:
return
vis
(
arg
.
value_
.
pointer
);
case
internal
:
:
custom_type
:
return
vis
(
typename
basic_format_arg
<
Context
>::
handle
(
arg
.
value_
.
custom
));
}
return
vis
(
monostate
());
}
enum
alignment
{
enum
alignment
{
ALIGN_DEFAULT
,
ALIGN_LEFT
,
ALIGN_RIGHT
,
ALIGN_CENTER
,
ALIGN_NUMERIC
ALIGN_DEFAULT
,
ALIGN_LEFT
,
ALIGN_RIGHT
,
ALIGN_CENTER
,
ALIGN_NUMERIC
};
};
...
@@ -3231,8 +3195,8 @@ struct formatter<
...
@@ -3231,8 +3195,8 @@ struct formatter<
specs_
.
precision_
,
specs_
.
precision_ref
,
ctx
);
specs_
.
precision_
,
specs_
.
precision_ref
,
ctx
);
typedef
output_range
<
typename
FormatContext
::
iterator
,
typedef
output_range
<
typename
FormatContext
::
iterator
,
typename
FormatContext
::
char_type
>
range_type
;
typename
FormatContext
::
char_type
>
range_type
;
return
visit
(
arg_formatter
<
range_type
>
(
ctx
,
&
specs_
),
return
fmt
::
visit
(
arg_formatter
<
range_type
>
(
ctx
,
&
specs_
),
internal
::
make_arg
<
FormatContext
>
(
val
));
internal
::
make_arg
<
FormatContext
>
(
val
));
}
}
private
:
private
:
...
@@ -3292,8 +3256,8 @@ class dynamic_formatter {
...
@@ -3292,8 +3256,8 @@ class dynamic_formatter {
checker
.
end_precision
();
checker
.
end_precision
();
typedef
output_range
<
typename
FormatContext
::
iterator
,
typedef
output_range
<
typename
FormatContext
::
iterator
,
typename
FormatContext
::
char_type
>
range
;
typename
FormatContext
::
char_type
>
range
;
visit
(
arg_formatter
<
range
>
(
ctx
,
&
specs_
),
fmt
::
visit
(
arg_formatter
<
range
>
(
ctx
,
&
specs_
),
internal
::
make_arg
<
FormatContext
>
(
val
));
internal
::
make_arg
<
FormatContext
>
(
val
));
return
ctx
.
out
();
return
ctx
.
out
();
}
}
...
@@ -3493,16 +3457,17 @@ inline wformat_context::iterator vformat_to(
...
@@ -3493,16 +3457,17 @@ inline wformat_context::iterator vformat_to(
return
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
return
vformat_to
<
arg_formatter
<
range
>>
(
buf
,
format_str
,
args
);
}
}
template
<
typename
String
,
typename
...
Args
,
template
<
std
::
size_t
SIZE
=
inline_buffer_size
>
typename
String
,
typename
...
Args
,
inline
format_context
::
iterator
format_to
(
std
::
size_t
SIZE
=
inline_buffer_size
,
basic_memory_buffer
<
char
,
SIZE
>
&
buf
,
const
String
&
format_str
,
typename
Char
=
typename
internal
::
format_string_traits
<
String
>::
char_type
>
inline
typename
buffer_context
<
Char
>::
type
::
iterator
format_to
(
basic_memory_buffer
<
Char
,
SIZE
>
&
buf
,
const
String
&
format_str
,
const
Args
&
...
args
)
{
const
Args
&
...
args
)
{
internal
::
check_format_string
<
Args
...
>
(
format_str
);
internal
::
check_format_string
<
Args
...
>
(
format_str
);
typedef
typename
internal
::
format_string_traits
<
String
>::
char_type
char_t
;
return
vformat_to
(
return
vformat_to
(
buf
,
basic_string_view
<
char_t
>
(
format_str
),
buf
,
basic_string_view
<
Char
>
(
format_str
),
make_format_args
<
typename
buffer_context
<
char_t
>::
type
>
(
args
...));
make_format_args
<
typename
buffer_context
<
Char
>::
type
>
(
args
...));
}
}
template
<
typename
OutputIt
,
typename
Char
=
char
>
template
<
typename
OutputIt
,
typename
Char
=
char
>
...
@@ -3725,10 +3690,13 @@ FMT_END_NAMESPACE
...
@@ -3725,10 +3690,13 @@ FMT_END_NAMESPACE
#if defined(FMT_STRING_ALIAS) && FMT_STRING_ALIAS
#if defined(FMT_STRING_ALIAS) && FMT_STRING_ALIAS
/**
/**
\rst
\rst
Constructs a compile-time format string.
Constructs a compile-time format string. This macro is disabled by default to
prevent potential name collisions. To enable it define ``FMT_STRING_ALIAS`` to
1 before including ``fmt/format.h``.
**Example**::
**Example**::
#define FMT_STRING_ALIAS 1
#include <fmt/format.h>
#include <fmt/format.h>
// A compile-time error because 'd' is an invalid specifier for strings.
// A compile-time error because 'd' is an invalid specifier for strings.
std::string s = format(fmt("{:d}"), "foo");
std::string s = format(fmt("{:d}"), "foo");
...
...
include/spdlog/fmt/bundled/locale.h
deleted
100644 → 0
View file @
cc3613e0
// Formatting library for C++ - locale support
//
// Copyright (c) 2012 - 2016, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#include "format.h"
#include <locale>
namespace
fmt
{
class
locale
{
private
:
std
::
locale
locale_
;
public
:
explicit
locale
(
std
::
locale
loc
=
std
::
locale
())
:
locale_
(
loc
)
{
}
std
::
locale
get
()
{
return
locale_
;
}
};
}
// namespace fmt
include/spdlog/fmt/bundled/printf.h
View file @
17702969
...
@@ -133,7 +133,7 @@ class arg_converter: public function<void> {
...
@@ -133,7 +133,7 @@ class arg_converter: public function<void> {
// unsigned).
// unsigned).
template
<
typename
T
,
typename
Context
,
typename
Char
>
template
<
typename
T
,
typename
Context
,
typename
Char
>
void
convert_arg
(
basic_format_arg
<
Context
>
&
arg
,
Char
type
)
{
void
convert_arg
(
basic_format_arg
<
Context
>
&
arg
,
Char
type
)
{
visit
(
arg_converter
<
T
,
Context
>
(
arg
,
type
),
arg
);
fmt
::
visit
(
arg_converter
<
T
,
Context
>
(
arg
,
type
),
arg
);
}
}
// Converts an integer argument to char for printf.
// Converts an integer argument to char for printf.
...
@@ -454,7 +454,7 @@ unsigned basic_printf_context<OutputIt, Char, AF>::parse_header(
...
@@ -454,7 +454,7 @@ unsigned basic_printf_context<OutputIt, Char, AF>::parse_header(
}
else
if
(
*
it
==
'*'
)
{
}
else
if
(
*
it
==
'*'
)
{
++
it
;
++
it
;
spec
.
width_
=
spec
.
width_
=
visit
(
internal
::
printf_width_handler
<
char_type
>
(
spec
),
get_arg
(
it
));
fmt
::
visit
(
internal
::
printf_width_handler
<
char_type
>
(
spec
),
get_arg
(
it
));
}
}
return
arg_index
;
return
arg_index
;
}
}
...
@@ -490,14 +490,14 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
...
@@ -490,14 +490,14 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
}
else
if
(
*
it
==
'*'
)
{
}
else
if
(
*
it
==
'*'
)
{
++
it
;
++
it
;
spec
.
precision_
=
spec
.
precision_
=
visit
(
internal
::
printf_precision_handler
(),
get_arg
(
it
));
fmt
::
visit
(
internal
::
printf_precision_handler
(),
get_arg
(
it
));
}
else
{
}
else
{
spec
.
precision_
=
0
;
spec
.
precision_
=
0
;
}
}
}
}
format_arg
arg
=
get_arg
(
it
,
arg_index
);
format_arg
arg
=
get_arg
(
it
,
arg_index
);
if
(
spec
.
flag
(
HASH_FLAG
)
&&
visit
(
internal
::
is_zero_int
(),
arg
))
if
(
spec
.
flag
(
HASH_FLAG
)
&&
fmt
::
visit
(
internal
::
is_zero_int
(),
arg
))
spec
.
flags_
&=
~
internal
::
to_unsigned
<
int
>
(
HASH_FLAG
);
spec
.
flags_
&=
~
internal
::
to_unsigned
<
int
>
(
HASH_FLAG
);
if
(
spec
.
fill_
==
'0'
)
{
if
(
spec
.
fill_
==
'0'
)
{
if
(
arg
.
is_arithmetic
())
if
(
arg
.
is_arithmetic
())
...
@@ -551,7 +551,7 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
...
@@ -551,7 +551,7 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
break
;
break
;
case
'c'
:
case
'c'
:
// TODO: handle wchar_t better?
// TODO: handle wchar_t better?
visit
(
internal
::
char_converter
<
basic_printf_context
>
(
arg
),
arg
);
fmt
::
visit
(
internal
::
char_converter
<
basic_printf_context
>
(
arg
),
arg
);
break
;
break
;
}
}
}
}
...
@@ -559,7 +559,7 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
...
@@ -559,7 +559,7 @@ void basic_printf_context<OutputIt, Char, AF>::format() {
start
=
it
;
start
=
it
;
// Format argument.
// Format argument.
visit
(
AF
(
buffer
,
spec
,
*
this
),
arg
);
fmt
::
visit
(
AF
(
buffer
,
spec
,
*
this
),
arg
);
}
}
buffer
.
append
(
pointer_from
(
start
),
pointer_from
(
it
));
buffer
.
append
(
pointer_from
(
start
),
pointer_from
(
it
));
}
}
...
...
include/spdlog/fmt/bundled/ranges.h
View file @
17702969
...
@@ -87,6 +87,9 @@ class is_like_std_string {
...
@@ -87,6 +87,9 @@ class is_like_std_string {
!
std
::
is_void
<
decltype
(
check
<
T
>
(
FMT_NULL
))
>::
value
;
!
std
::
is_void
<
decltype
(
check
<
T
>
(
FMT_NULL
))
>::
value
;
};
};
template
<
typename
Char
>
struct
is_like_std_string
<
fmt
::
basic_string_view
<
Char
>>
:
std
::
true_type
{};
template
<
typename
...
Ts
>
template
<
typename
...
Ts
>
struct
conditional_helper
{};
struct
conditional_helper
{};
...
...
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