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
d9c605c6
Commit
d9c605c6
authored
Nov 28, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial support for header-only configuration
parent
aca49379
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
format.cc
format.cc
+14
-10
format.h
format.h
+4
-0
No files found.
format.cc
View file @
d9c605c6
...
...
@@ -81,6 +81,10 @@ using fmt::internal::Arg;
# endif
#endif
#ifdef FMT_HEADER_ONLY
# define FMT_FUNC inline
#endif
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4127) // conditional expression is constant
...
...
@@ -348,7 +352,7 @@ inline Arg::StringValue<wchar_t> ignore_incompatible_str(
Arg
::
StringValue
<
wchar_t
>
s
)
{
return
s
;
}
}
// namespace
void
fmt
::
SystemError
::
init
(
FMT_FUNC
void
fmt
::
SystemError
::
init
(
int
error_code
,
StringRef
format_str
,
ArgList
args
)
{
error_code_
=
error_code
;
MemoryWriter
w
;
...
...
@@ -413,7 +417,7 @@ const uint64_t fmt::internal::POWERS_OF_10_64[] = {
ULongLong
(
1000000000
)
*
ULongLong
(
1000000000
)
*
10
};
void
fmt
::
internal
::
report_unknown_type
(
char
code
,
const
char
*
type
)
{
FMT_FUNC
void
fmt
::
internal
::
report_unknown_type
(
char
code
,
const
char
*
type
)
{
if
(
std
::
isprint
(
static_cast
<
unsigned
char
>
(
code
)))
{
FMT_THROW
(
fmt
::
FormatError
(
fmt
::
format
(
"unknown format code '{}' for {}"
,
code
,
type
)));
...
...
@@ -468,7 +472,7 @@ void fmt::WindowsError::init(
#endif
void
fmt
::
internal
::
format_system_error
(
FMT_FUNC
void
fmt
::
internal
::
format_system_error
(
fmt
::
Writer
&
out
,
int
error_code
,
fmt
::
StringRef
message
)
FMT_NOEXCEPT
(
true
)
{
FMT_TRY
{
...
...
@@ -619,7 +623,7 @@ inline Arg fmt::BasicFormatter<Char>::parse_arg_index(const Char *&s) {
return
arg
;
}
Arg
fmt
::
internal
::
FormatterBase
::
do_get_arg
(
FMT_FUNC
Arg
fmt
::
internal
::
FormatterBase
::
do_get_arg
(
unsigned
arg_index
,
const
char
*&
error
)
{
Arg
arg
=
args_
[
arg_index
];
if
(
arg
.
type
==
Arg
::
NONE
)
...
...
@@ -1042,7 +1046,7 @@ void fmt::BasicFormatter<Char>::format(
write
(
writer_
,
start_
,
s
);
}
void
fmt
::
report_system_error
(
FMT_FUNC
void
fmt
::
report_system_error
(
int
error_code
,
fmt
::
StringRef
message
)
FMT_NOEXCEPT
(
true
)
{
report_error
(
internal
::
format_system_error
,
error_code
,
message
);
}
...
...
@@ -1054,23 +1058,23 @@ void fmt::report_windows_error(
}
#endif
void
fmt
::
print
(
std
::
FILE
*
f
,
StringRef
format_str
,
ArgList
args
)
{
FMT_FUNC
void
fmt
::
print
(
std
::
FILE
*
f
,
StringRef
format_str
,
ArgList
args
)
{
MemoryWriter
w
;
w
.
write
(
format_str
,
args
);
std
::
fwrite
(
w
.
data
(),
1
,
w
.
size
(),
f
);
}
void
fmt
::
print
(
StringRef
format_str
,
ArgList
args
)
{
FMT_FUNC
void
fmt
::
print
(
StringRef
format_str
,
ArgList
args
)
{
print
(
stdout
,
format_str
,
args
);
}
void
fmt
::
print
(
std
::
ostream
&
os
,
StringRef
format_str
,
ArgList
args
)
{
FMT_FUNC
void
fmt
::
print
(
std
::
ostream
&
os
,
StringRef
format_str
,
ArgList
args
)
{
MemoryWriter
w
;
w
.
write
(
format_str
,
args
);
os
.
write
(
w
.
data
(),
w
.
size
());
}
void
fmt
::
print_colored
(
Color
c
,
StringRef
format
,
ArgList
args
)
{
FMT_FUNC
void
fmt
::
print_colored
(
Color
c
,
StringRef
format
,
ArgList
args
)
{
char
escape
[]
=
"
\x1b
[30m"
;
escape
[
3
]
=
'0'
+
static_cast
<
char
>
(
c
);
std
::
fputs
(
escape
,
stdout
);
...
...
@@ -1078,7 +1082,7 @@ void fmt::print_colored(Color c, StringRef format, ArgList args) {
std
::
fputs
(
RESET_COLOR
,
stdout
);
}
int
fmt
::
fprintf
(
std
::
FILE
*
f
,
StringRef
format
,
ArgList
args
)
{
FMT_FUNC
int
fmt
::
fprintf
(
std
::
FILE
*
f
,
StringRef
format
,
ArgList
args
)
{
MemoryWriter
w
;
printf
(
w
,
format
,
args
);
std
::
size_t
size
=
w
.
size
();
...
...
format.h
View file @
d9c605c6
...
...
@@ -2427,4 +2427,8 @@ FMT_VARIADIC(int, fprintf, std::FILE *, StringRef)
# pragma GCC diagnostic pop
#endif
#ifdef FMT_HEADER_ONLY
# include "format.cc"
#endif
#endif // FMT_FORMAT_H_
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