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
f8027414
Commit
f8027414
authored
Sep 30, 2018
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Impelement char8_t support
parent
76a47d41
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
77 deletions
+107
-77
include/fmt/format-inl.h
include/fmt/format-inl.h
+16
-11
include/fmt/format.h
include/fmt/format.h
+91
-66
No files found.
include/fmt/format-inl.h
View file @
f8027414
...
...
@@ -192,6 +192,16 @@ void report_error(FormatFunc func, int error_code,
}
}
// namespace
FMT_FUNC
size_t
internal
::
count_code_points
(
u8string_view
s
)
{
const
char8_t
*
data
=
s
.
data
();
size_t
num_code_points
=
0
;
for
(
size_t
i
=
0
,
size
=
s
.
size
();
i
!=
size
;
++
i
)
{
if
((
data
[
i
]
&
0xc0
)
!=
0x80
)
++
num_code_points
;
}
return
num_code_points
;
}
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
class
locale
{
private:
...
...
@@ -202,21 +212,16 @@ class locale {
std
::
locale
get
()
{
return
locale_
;
}
};
FMT_FUNC
size_t
internal
::
count_code_points
(
u8string_view
s
)
{
const
char8_t
*
data
=
s
.
data
();
int
num_code_points
=
0
;
for
(
size_t
i
=
0
,
size
=
s
.
size
();
i
!=
size
;
++
i
)
{
if
((
data
[
i
]
&
0xc0
)
!=
0x80
)
++
num_code_points
;
}
return
num_code_points
;
}
namespace
internal
{
template
<
typename
Char
>
FMT_FUNC
Char
internal
::
thousands_sep
(
locale_provider
*
lp
)
{
FMT_FUNC
Char
thousands_sep
(
locale_provider
*
lp
)
{
std
::
locale
loc
=
lp
?
lp
->
locale
().
get
()
:
std
::
locale
();
return
std
::
use_facet
<
std
::
numpunct
<
Char
>>
(
loc
).
thousands_sep
();
}
template
<
>
FMT_FUNC
char8_t
thousands_sep
<
char8_t
>
(
locale_provider
*
)
{
return
static_cast
<
char8_t
>
(
','
);
}
}
#else
template
<
typename
Char
>
FMT_FUNC
Char
internal
::
thousands_sep
(
locale_provider
*
lp
)
{
...
...
include/fmt/format.h
View file @
f8027414
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