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
6d47e093
Commit
6d47e093
authored
Sep 29, 2019
by
Victor Zverovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove utility.hpp
parent
d1626e96
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
252 deletions
+9
-252
include/fmt/format.h
include/fmt/format.h
+6
-1
src/text/boost/text/detail/lzw.hpp
src/text/boost/text/detail/lzw.hpp
+1
-0
src/text/boost/text/grapheme_break.hpp
src/text/boost/text/grapheme_break.hpp
+2
-3
src/text/boost/text/utility.hpp
src/text/boost/text/utility.hpp
+0
-248
No files found.
include/fmt/format.h
View file @
6d47e093
...
...
@@ -50,6 +50,7 @@
#endif
#if FMT_USE_TEXT
# include <boost/text/grapheme_break.hpp>
# include <boost/text/transcode_iterator.hpp>
#endif
#ifdef __clang__
...
...
@@ -922,7 +923,11 @@ inline size_t compute_width(basic_string_view<Char> s) {
inline
size_t
compute_width
(
string_view
s
)
{
#if FMT_USE_TEXT
basic_memory_buffer
<
uint32_t
>
code_points
;
for
(
auto
cp
:
boost
::
text
::
make_to_utf32_range
(
s
))
code_points
.
push_back
(
cp
);
const
char
*
s_end
=
s
.
data
()
+
s
.
size
();
boost
::
text
::
utf_8_to_32_iterator
<
const
char
*>
begin
(
s
.
data
(),
s
.
data
(),
s_end
),
end
(
s
.
data
(),
s_end
,
s_end
);
for
(
auto
it
=
begin
;
it
!=
end
;
++
it
)
code_points
.
push_back
(
*
it
);
size_t
width
=
0
;
for
(
auto
it
=
code_points
.
begin
(),
end
=
code_points
.
end
();
it
!=
end
;
it
=
boost
::
text
::
next_grapheme_break
(
it
,
end
))
{
...
...
src/text/boost/text/detail/lzw.hpp
View file @
6d47e093
#ifndef BOOST_TEXT_DETAIL_LZW_HPP
#define BOOST_TEXT_DETAIL_LZW_HPP
#include <boost/assert.hpp>
#include <boost/container/small_vector.hpp>
#include <vector>
...
...
src/text/boost/text/grapheme_break.hpp
View file @
6d47e093
...
...
@@ -2,7 +2,7 @@
#define BOOST_TEXT_GRAPHEME_BREAK_HPP
#include <boost/text/algorithm.hpp>
#include <boost/text/
utility
.hpp>
#include <boost/text/
config
.hpp>
#include <array>
#include <unordered_map>
...
...
@@ -157,8 +157,7 @@ constexpr std::array<std::array<bool, 15>, 15> grapheme_breaks = {{
}
template
<
typename
CPIter
,
typename
Sentinel
>
auto
next_grapheme_break
(
CPIter
first
,
Sentinel
last
)
noexcept
->
detail
::
cp_iter_ret_t
<
CPIter
,
CPIter
>
CPIter
next_grapheme_break
(
CPIter
first
,
Sentinel
last
)
noexcept
{
if
(
first
==
last
)
return
first
;
...
...
src/text/boost/text/utility.hpp
deleted
100644 → 0
View file @
d1626e96
#ifndef BOOST_TEXT_UTILITY_HPP
#define BOOST_TEXT_UTILITY_HPP
#include <boost/text/transcode_iterator.hpp>
#include <boost/text/detail/algorithm.hpp>
#include <boost/text/detail/sentinel_tag.hpp>
namespace
boost
{
namespace
text
{
/** A range that adapts a sequence of `char const *` to a sequence of code
points. */
struct
utf32_range
{
using
iterator
=
utf_8_to_32_iterator
<
char
const
*>
;
utf32_range
()
:
first_
(
nullptr
,
nullptr
,
nullptr
),
last_
(
nullptr
,
nullptr
,
nullptr
)
{}
utf32_range
(
char
const
*
f
,
char
const
*
l
)
:
first_
(
f
,
f
,
l
),
last_
(
f
,
l
,
l
)
{}
utf32_range
(
iterator
f
,
iterator
l
)
:
first_
(
f
),
last_
(
l
)
{}
template
<
typename
CharRange
>
utf32_range
(
CharRange
const
&
r
)
:
first_
(
std
::
begin
(
r
),
std
::
begin
(
r
),
std
::
end
(
r
)),
last_
(
std
::
begin
(
r
),
std
::
end
(
r
),
std
::
end
(
r
))
{}
bool
empty
()
const
noexcept
{
return
first_
==
last_
;
}
iterator
begin
()
const
noexcept
{
return
first_
;
}
iterator
end
()
const
noexcept
{
return
last_
;
}
friend
bool
operator
==
(
utf32_range
lhs
,
utf32_range
rhs
)
{
return
lhs
.
first_
==
rhs
.
first_
&&
lhs
.
last_
==
rhs
.
last_
;
}
friend
bool
operator
!=
(
utf32_range
lhs
,
utf32_range
rhs
)
{
return
!
(
lhs
==
rhs
);
}
private:
iterator
first_
;
iterator
last_
;
};
/** A range of code points. */
template
<
typename
CPIter
,
typename
Sentinel
=
CPIter
>
struct
cp_range
{
using
iterator
=
CPIter
;
using
sentinel
=
Sentinel
;
static_assert
(
detail
::
is_cp_iter
<
CPIter
>::
value
,
"CPIter must be a code point iterator"
);
cp_range
()
{}
cp_range
(
iterator
first
,
sentinel
last
)
:
first_
(
first
),
last_
(
last
)
{}
bool
empty
()
const
noexcept
{
return
first_
==
last_
;
}
iterator
begin
()
const
{
return
first_
;
}
sentinel
end
()
const
{
return
last_
;
}
friend
bool
operator
==
(
cp_range
lhs
,
cp_range
rhs
)
{
return
lhs
.
first_
==
rhs
.
first_
&&
lhs
.
last_
==
rhs
.
last_
;
}
friend
bool
operator
!=
(
cp_range
lhs
,
cp_range
rhs
)
{
return
!
(
lhs
==
rhs
);
}
private:
iterator
first_
;
sentinel
last_
;
};
/** A generic range. */
template
<
typename
Iter
,
typename
Sentinel
=
Iter
>
struct
range
{
using
iterator
=
Iter
;
using
sentinel
=
Sentinel
;
range
()
{}
range
(
iterator
first
,
sentinel
last
)
:
first_
(
first
),
last_
(
last
)
{}
bool
empty
()
const
noexcept
{
return
first_
==
last_
;
}
iterator
begin
()
const
{
return
first_
;
}
sentinel
end
()
const
{
return
last_
;
}
friend
bool
operator
==
(
range
lhs
,
range
rhs
)
{
return
lhs
.
first_
==
rhs
.
first_
&&
lhs
.
last_
==
rhs
.
last_
;
}
friend
bool
operator
!=
(
range
lhs
,
range
rhs
)
{
return
!
(
lhs
==
rhs
);
}
private:
iterator
first_
;
sentinel
last_
;
};
namespace
detail
{
template
<
typename
T
>
using
remove_cv_ref_t
=
typename
std
::
remove_cv
<
typename
std
::
remove_reference
<
T
>::
type
>::
type
;
template
<
typename
Range
>
using
iterator_t
=
remove_cv_ref_t
<
decltype
(
std
::
declval
<
Range
>
().
begin
())
>
;
template
<
typename
Range
>
using
sentinel_t
=
remove_cv_ref_t
<
decltype
(
std
::
declval
<
Range
>
().
end
())
>
;
template
<
template
<
class
,
class
,
class
>
class
IterTemplate
,
typename
Iter
,
typename
Sentinel
>
struct
make_range_impl_t
{
using
iter_t
=
IterTemplate
<
Iter
,
Sentinel
,
use_replacement_character
>
;
static
range
<
iter_t
,
Sentinel
>
call
(
Iter
first
,
Sentinel
last
)
noexcept
{
return
{
iter_t
{
first
,
first
,
last
},
last
};
}
};
template
<
template
<
class
,
class
,
class
>
class
IterTemplate
,
typename
Iter
>
struct
make_range_impl_t
<
IterTemplate
,
Iter
,
Iter
>
{
using
iter_t
=
IterTemplate
<
Iter
,
Iter
,
use_replacement_character
>
;
static
range
<
iter_t
,
iter_t
>
call
(
Iter
first
,
Iter
last
)
noexcept
{
return
{
iter_t
{
first
,
first
,
last
},
iter_t
{
first
,
last
,
last
}};
}
};
template
<
template
<
class
,
class
,
class
>
class
IterTemplate
,
typename
Range
>
struct
make_range_t
{
using
impl_t
=
make_range_impl_t
<
IterTemplate
,
iterator_t
<
Range
const
>
,
sentinel_t
<
Range
const
>>
;
static
auto
call
(
Range
const
&
r
)
noexcept
->
decltype
(
impl_t
::
call
(
std
::
begin
(
r
),
std
::
end
(
r
)))
{
return
impl_t
::
call
(
std
::
begin
(
r
),
std
::
end
(
r
));
}
};
}
#ifdef BOOST_TEXT_DOXYGEN
/** Returns a range of code points transcoded from the given range of
UTF-8 code units.
This function only participates in overload resolution if `CharRange`
models the CharRange concept. */
template
<
typename
CharRange
>
detail
::
unspecified
make_to_utf32_range
(
CharRange
const
&
r
)
noexcept
;
/** Returns a range of UTF-8 code units transcoded from the given range of
code points.
This function only participates in overload resolution if `CPRange`
models the CPRange concept. */
template
<
typename
CPRange
>
detail
::
unspecified
make_from_utf32_range
(
CPRange
const
&
r
)
noexcept
;
/** Returns a range of UTF-16 code units transcoded from the given range
of UTF-8 code units.
This function only participates in overload resolution if `CharRange`
models the CharRange concept. */
template
<
typename
CharRange
>
detail
::
unspecified
make_to_utf16_range
(
CharRange
const
&
r
)
noexcept
;
/** Returns a range of UTF-8 code units transcoded from the given range of
UTF-16 code units.
This function only participates in overload resolution if
`Char16Range` is a range of 16-bit integral values, each of which is
convertible to `uint16_t`. */
template
<
typename
Char16Range
>
detail
::
unspecified
make_from_utf16_range
(
Char16Range
const
&
r
)
noexcept
;
#else
template
<
typename
CharRange
>
auto
make_to_utf32_range
(
CharRange
const
&
r
)
noexcept
->
detail
::
rng_alg_ret_t
<
decltype
(
detail
::
make_range_t
<
utf_8_to_32_iterator
,
CharRange
>::
call
(
r
)),
CharRange
>
{
return
detail
::
make_range_t
<
utf_8_to_32_iterator
,
CharRange
>::
call
(
r
);
}
template
<
typename
CPRange
>
auto
make_from_utf32_range
(
CPRange
const
&
r
)
noexcept
->
detail
::
cp_rng_alg_ret_t
<
decltype
(
detail
::
make_range_t
<
utf_32_to_8_iterator
,
CPRange
>::
call
(
r
)),
CPRange
>
{
return
detail
::
make_range_t
<
utf_32_to_8_iterator
,
CPRange
>::
call
(
r
);
}
template
<
typename
CharRange
>
auto
make_to_utf16_range
(
CharRange
const
&
r
)
noexcept
->
detail
::
rng_alg_ret_t
<
decltype
(
detail
::
make_range_t
<
utf_8_to_16_iterator
,
CharRange
>::
call
(
r
)),
CharRange
>
{
return
detail
::
make_range_t
<
utf_8_to_16_iterator
,
CharRange
>::
call
(
r
);
}
template
<
typename
Char16Range
>
auto
make_from_utf16_range
(
Char16Range
const
&
r
)
noexcept
->
detail
::
rng16_alg_ret_t
<
decltype
(
detail
::
make_range_t
<
utf_16_to_8_iterator
,
Char16Range
>::
call
(
r
)),
Char16Range
>
{
return
detail
::
make_range_t
<
utf_16_to_8_iterator
,
Char16Range
>::
call
(
r
);
}
#endif
}}
#endif
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