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
ea5dce39
Commit
ea5dce39
authored
Jan 28, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify format specs.
parent
a1bd3358
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
65 deletions
+68
-65
format-test.cc
format-test.cc
+1
-1
format.cc
format.cc
+9
-9
format.h
format.h
+58
-55
No files found.
format-test.cc
View file @
ea5dce39
...
@@ -1227,7 +1227,7 @@ TEST(FormatterTest, FormatUsingIOStreams) {
...
@@ -1227,7 +1227,7 @@ TEST(FormatterTest, FormatUsingIOStreams) {
class
Answer
{};
class
Answer
{};
template
<
typename
Char
>
template
<
typename
Char
>
void
Format
(
BasicWriter
<
Char
>
&
f
,
const
fmt
::
FormatSpec
<
Char
>
&
spec
,
Answer
)
{
void
Format
(
BasicWriter
<
Char
>
&
f
,
const
fmt
::
FormatSpec
&
spec
,
Answer
)
{
f
.
Write
(
"42"
,
spec
);
f
.
Write
(
"42"
,
spec
);
}
}
...
...
format.cc
View file @
ea5dce39
...
@@ -170,7 +170,7 @@ void fmt::BasicWriter<Char>::FormatDecimal(
...
@@ -170,7 +170,7 @@ void fmt::BasicWriter<Char>::FormatDecimal(
template
<
typename
Char
>
template
<
typename
Char
>
typename
fmt
::
BasicWriter
<
Char
>::
CharPtr
typename
fmt
::
BasicWriter
<
Char
>::
CharPtr
fmt
::
BasicWriter
<
Char
>::
PrepareFilledBuffer
(
fmt
::
BasicWriter
<
Char
>::
PrepareFilledBuffer
(
unsigned
size
,
const
AlignSpec
<
Char
>
&
spec
,
char
sign
)
{
unsigned
size
,
const
AlignSpec
&
spec
,
char
sign
)
{
unsigned
width
=
spec
.
width
();
unsigned
width
=
spec
.
width
();
if
(
width
<=
size
)
{
if
(
width
<=
size
)
{
CharPtr
p
=
GrowBuffer
(
size
);
CharPtr
p
=
GrowBuffer
(
size
);
...
@@ -208,7 +208,7 @@ typename fmt::BasicWriter<Char>::CharPtr
...
@@ -208,7 +208,7 @@ typename fmt::BasicWriter<Char>::CharPtr
template
<
typename
Char
>
template
<
typename
Char
>
template
<
typename
T
>
template
<
typename
T
>
void
fmt
::
BasicWriter
<
Char
>::
FormatDouble
(
void
fmt
::
BasicWriter
<
Char
>::
FormatDouble
(
T
value
,
const
FormatSpec
<
Char
>
&
spec
,
int
precision
)
{
T
value
,
const
FormatSpec
&
spec
,
int
precision
)
{
// Check type.
// Check type.
char
type
=
spec
.
type
();
char
type
=
spec
.
type
();
bool
upper
=
false
;
bool
upper
=
false
;
...
@@ -438,7 +438,7 @@ void fmt::BasicFormatter<Char>::DoFormat() {
...
@@ -438,7 +438,7 @@ void fmt::BasicFormatter<Char>::DoFormat() {
const
Arg
&
arg
=
ParseArgIndex
(
s
);
const
Arg
&
arg
=
ParseArgIndex
(
s
);
FormatSpec
<
Char
>
spec
;
FormatSpec
spec
;
int
precision
=
-
1
;
int
precision
=
-
1
;
if
(
*
s
==
':'
)
{
if
(
*
s
==
':'
)
{
++
s
;
++
s
;
...
@@ -666,10 +666,10 @@ void fmt::BasicFormatter<Char>::DoFormat() {
...
@@ -666,10 +666,10 @@ void fmt::BasicFormatter<Char>::DoFormat() {
// Explicit instantiations for char.
// Explicit instantiations for char.
template
void
fmt
::
BasicWriter
<
char
>
::
FormatDouble
<
double
>
(
template
void
fmt
::
BasicWriter
<
char
>
::
FormatDouble
<
double
>
(
double
value
,
const
FormatSpec
<
char
>
&
spec
,
int
precision
);
double
value
,
const
FormatSpec
&
spec
,
int
precision
);
template
void
fmt
::
BasicWriter
<
char
>
::
FormatDouble
<
long
double
>
(
template
void
fmt
::
BasicWriter
<
char
>
::
FormatDouble
<
long
double
>
(
long
double
value
,
const
FormatSpec
<
char
>
&
spec
,
int
precision
);
long
double
value
,
const
FormatSpec
&
spec
,
int
precision
);
template
fmt
::
BasicWriter
<
char
>
::
CharPtr
template
fmt
::
BasicWriter
<
char
>
::
CharPtr
fmt
::
BasicWriter
<
char
>::
FillPadding
(
CharPtr
buffer
,
fmt
::
BasicWriter
<
char
>::
FillPadding
(
CharPtr
buffer
,
...
@@ -680,7 +680,7 @@ template void fmt::BasicWriter<char>::FormatDecimal(
...
@@ -680,7 +680,7 @@ template void fmt::BasicWriter<char>::FormatDecimal(
template
fmt
::
BasicWriter
<
char
>
::
CharPtr
template
fmt
::
BasicWriter
<
char
>
::
CharPtr
fmt
::
BasicWriter
<
char
>::
PrepareFilledBuffer
(
fmt
::
BasicWriter
<
char
>::
PrepareFilledBuffer
(
unsigned
size
,
const
AlignSpec
<
char
>
&
spec
,
char
sign
);
unsigned
size
,
const
AlignSpec
&
spec
,
char
sign
);
template
void
fmt
::
BasicFormatter
<
char
>
::
ReportError
(
template
void
fmt
::
BasicFormatter
<
char
>
::
ReportError
(
const
char
*
s
,
StringRef
message
)
const
;
const
char
*
s
,
StringRef
message
)
const
;
...
@@ -698,10 +698,10 @@ template void fmt::BasicFormatter<char>::DoFormat();
...
@@ -698,10 +698,10 @@ template void fmt::BasicFormatter<char>::DoFormat();
// Explicit instantiations for wchar_t.
// Explicit instantiations for wchar_t.
template
void
fmt
::
BasicWriter
<
wchar_t
>
::
FormatDouble
<
double
>
(
template
void
fmt
::
BasicWriter
<
wchar_t
>
::
FormatDouble
<
double
>
(
double
value
,
const
FormatSpec
<
wchar_t
>
&
spec
,
int
precision
);
double
value
,
const
FormatSpec
&
spec
,
int
precision
);
template
void
fmt
::
BasicWriter
<
wchar_t
>
::
FormatDouble
<
long
double
>
(
template
void
fmt
::
BasicWriter
<
wchar_t
>
::
FormatDouble
<
long
double
>
(
long
double
value
,
const
FormatSpec
<
wchar_t
>
&
spec
,
int
precision
);
long
double
value
,
const
FormatSpec
&
spec
,
int
precision
);
template
fmt
::
BasicWriter
<
wchar_t
>
::
CharPtr
template
fmt
::
BasicWriter
<
wchar_t
>
::
CharPtr
fmt
::
BasicWriter
<
wchar_t
>::
FillPadding
(
CharPtr
buffer
,
fmt
::
BasicWriter
<
wchar_t
>::
FillPadding
(
CharPtr
buffer
,
...
@@ -712,7 +712,7 @@ template void fmt::BasicWriter<wchar_t>::FormatDecimal(
...
@@ -712,7 +712,7 @@ template void fmt::BasicWriter<wchar_t>::FormatDecimal(
template
fmt
::
BasicWriter
<
wchar_t
>
::
CharPtr
template
fmt
::
BasicWriter
<
wchar_t
>
::
CharPtr
fmt
::
BasicWriter
<
wchar_t
>::
PrepareFilledBuffer
(
fmt
::
BasicWriter
<
wchar_t
>::
PrepareFilledBuffer
(
unsigned
size
,
const
AlignSpec
<
wchar_t
>
&
spec
,
char
sign
);
unsigned
size
,
const
AlignSpec
&
spec
,
char
sign
);
template
void
fmt
::
BasicFormatter
<
wchar_t
>
::
ReportError
(
template
void
fmt
::
BasicFormatter
<
wchar_t
>
::
ReportError
(
const
wchar_t
*
s
,
StringRef
message
)
const
;
const
wchar_t
*
s
,
StringRef
message
)
const
;
...
...
format.h
View file @
ea5dce39
This diff is collapsed.
Click to expand it.
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