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
3947a7a9
Commit
3947a7a9
authored
Aug 29, 2014
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move check_sign to anonymous namespace.
parent
ab35af53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
format.cc
format.cc
+14
-15
format.h
format.h
+0
-2
No files found.
format.cc
View file @
3947a7a9
...
...
@@ -188,6 +188,20 @@ const Char *find_closing_brace(const Char *s, int num_open_braces = 1) {
throw
fmt
::
FormatError
(
"unmatched '{' in format"
);
}
template
<
typename
Char
>
void
check_sign
(
const
Char
*&
s
,
const
Arg
&
arg
)
{
char
sign
=
static_cast
<
char
>
(
*
s
);
if
(
arg
.
type
>
Arg
::
LAST_NUMERIC_TYPE
)
{
throw
fmt
::
FormatError
(
fmt
::
format
(
"format specifier '{}' requires numeric argument"
,
sign
));
}
if
(
arg
.
type
==
Arg
::
UINT
||
arg
.
type
==
Arg
::
ULONG_LONG
)
{
throw
fmt
::
FormatError
(
fmt
::
format
(
"format specifier '{}' requires signed argument"
,
sign
));
}
++
s
;
}
// Checks if an argument is a valid printf width specifier and sets
// left alignment if it is negative.
class
WidthHandler
:
public
fmt
::
internal
::
ArgVisitor
<
WidthHandler
,
unsigned
>
{
...
...
@@ -759,21 +773,6 @@ inline const Arg &fmt::BasicFormatter<Char>::parse_arg_index(const Char *&s) {
return
*
arg
;
}
template
<
typename
Char
>
void
fmt
::
BasicFormatter
<
Char
>::
check_sign
(
const
Char
*&
s
,
const
Arg
&
arg
)
{
char
sign
=
static_cast
<
char
>
(
*
s
);
if
(
arg
.
type
>
Arg
::
LAST_NUMERIC_TYPE
)
{
throw
FormatError
(
fmt
::
format
(
"format specifier '{}' requires numeric argument"
,
sign
));
}
if
(
arg
.
type
==
Arg
::
UINT
||
arg
.
type
==
Arg
::
ULONG_LONG
)
{
throw
FormatError
(
fmt
::
format
(
"format specifier '{}' requires signed argument"
,
sign
));
}
++
s
;
}
const
Arg
*
fmt
::
internal
::
FormatterBase
::
next_arg
(
const
char
*&
error
)
{
if
(
next_arg_index_
<
0
)
{
error
=
"cannot switch from manual to automatic argument indexing"
;
...
...
format.h
View file @
3947a7a9
...
...
@@ -889,8 +889,6 @@ private:
// Parses argument index and returns corresponding argument.
const
internal
::
Arg
&
parse_arg_index
(
const
Char
*&
s
);
void
check_sign
(
const
Char
*&
s
,
const
internal
::
Arg
&
arg
);
public:
explicit
BasicFormatter
(
BasicWriter
<
Char
>
&
w
)
:
writer_
(
w
)
{}
...
...
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