Skip to content

Commit 42acd67

Browse files
committed
Remove unused iterator-based Unicode converters
1 parent baec3cf commit 42acd67

File tree

1 file changed

+7
-57
lines changed

1 file changed

+7
-57
lines changed

fly/types/string/detail/string_unicode.hpp

+7-57
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,6 @@ class BasicStringUnicode
6060
template <typename DesiredStringType, typename SourceStringType = StringType>
6161
static std::optional<DesiredStringType> convert_encoding(SourceStringType &&value);
6262

63-
/**
64-
* Convert the Unicode encoding of a string to another encoding.
65-
*
66-
* @tparam DesiredStringType The type of string to convert to.
67-
* @tparam IteratorType The type of the encoded Unicode string's iterator.
68-
*
69-
* @param it Pointer to the beginning of the encoded Unicode string.
70-
* @param end Pointer to the end of the encoded Unicode string.
71-
*
72-
* @return If successful, a copy of the source string with the desired encoding. Otherwise, an
73-
* uninitialized value.
74-
*/
75-
template <typename DesiredStringType, typename IteratorType>
76-
static std::optional<DesiredStringType>
77-
convert_encoding(IteratorType &it, const IteratorType &end);
78-
7963
/**
8064
* Convert the Unicode encoding of a string to another encoding, inserting the result into the
8165
* provided output iterator.
@@ -96,23 +80,6 @@ class BasicStringUnicode
9680
typename SourceStringType = StringType>
9781
static bool convert_encoding_into(SourceStringType &&value, OutputIteratorType out);
9882

99-
/**
100-
* Convert the Unicode encoding of a string to another encoding, inserting the result into the
101-
* provided output iterator.
102-
*
103-
* @tparam DesiredStringType The type of string to convert to.
104-
* @tparam OutputIteratorType The type of the output iterator to insert the result into.
105-
* @tparam SourceStringType The type of string to convert.
106-
*
107-
* @param value The encoded Unicode string to convert.
108-
* @param out The output iterator to insert the result into.
109-
*
110-
* @return Whether the conversion was successful.
111-
*/
112-
template <typename DesiredStringType, typename IteratorType, typename OutputIteratorType>
113-
static bool
114-
convert_encoding_into(IteratorType &it, const IteratorType &end, OutputIteratorType out);
115-
11683
/**
11784
* Decode a single Unicode codepoint, starting at the character pointed to by the provided
11885
* iterator. If successful, after invoking this method, that iterator will point at the first
@@ -427,21 +394,13 @@ template <typename StringType>
427394
template <typename DesiredStringType, typename SourceStringType>
428395
inline std::optional<DesiredStringType>
429396
BasicStringUnicode<StringType>::convert_encoding(SourceStringType &&value)
430-
{
431-
auto it = value.cbegin();
432-
return convert_encoding<DesiredStringType>(it, value.cend());
433-
}
434-
435-
//==================================================================================================
436-
template <typename StringType>
437-
template <typename DesiredStringType, typename IteratorType>
438-
std::optional<DesiredStringType>
439-
BasicStringUnicode<StringType>::convert_encoding(IteratorType &it, const IteratorType &end)
440397
{
441398
DesiredStringType result;
442-
result.reserve(static_cast<typename StringType::size_type>(std::distance(it, end)));
399+
result.reserve(static_cast<typename StringType::size_type>(value.size()));
443400

444-
if (convert_encoding_into<DesiredStringType>(it, end, std::back_inserter(result)))
401+
if (convert_encoding_into<DesiredStringType>(
402+
std::forward<SourceStringType>(value),
403+
std::back_inserter(result)))
445404
{
446405
return result;
447406
}
@@ -455,21 +414,12 @@ template <typename DesiredStringType, typename OutputIteratorType, typename Sour
455414
bool BasicStringUnicode<StringType>::convert_encoding_into(
456415
SourceStringType &&value,
457416
OutputIteratorType out)
458-
{
459-
auto it = value.cbegin();
460-
return convert_encoding_into<DesiredStringType>(it, value.cend(), out);
461-
}
462-
463-
//==================================================================================================
464-
template <typename StringType>
465-
template <typename DesiredStringType, typename IteratorType, typename OutputIteratorType>
466-
bool BasicStringUnicode<StringType>::convert_encoding_into(
467-
IteratorType &it,
468-
const IteratorType &end,
469-
OutputIteratorType out)
470417
{
471418
using DesiredUnicodeType = BasicStringUnicode<DesiredStringType>;
472419

420+
auto it = value.cbegin();
421+
const auto end = value.cend();
422+
473423
while (it != end)
474424
{
475425
if (auto codepoint = decode_codepoint(it, end); codepoint)

0 commit comments

Comments
 (0)