#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#ifndef BASE_STRINGS_STRING_UTIL_IMPL_HELPERS_H_
#define BASE_STRINGS_STRING_UTIL_IMPL_HELPERS_H_
#include <algorithm>
#include <optional>
#include <string_view>
#include "base/check.h"
#include "base/check_op.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/third_party/icu/icu_utf.h"
namespace base::internal {
struct ReplacementOffset { … };
static bool CompareParameter(const ReplacementOffset& elem1,
const ReplacementOffset& elem2) { … }
MachineWord;
inline bool IsMachineWordAligned(const void* pointer) { … }
template <typename T, typename CharT = typename T::value_type>
std::basic_string<CharT> ToLowerASCIIImpl(T str) { … }
template <typename T, typename CharT = typename T::value_type>
std::basic_string<CharT> ToUpperASCIIImpl(T str) { … }
template <typename T, typename CharT = typename T::value_type>
TrimPositions TrimStringT(T input,
T trim_chars,
TrimPositions positions,
std::basic_string<CharT>* output) { … }
template <typename T, typename CharT = typename T::value_type>
T TrimStringPieceT(T input, T trim_chars, TrimPositions positions) { … }
template <typename T, typename CharT = typename T::value_type>
std::basic_string<CharT> CollapseWhitespaceT(
T text,
bool trim_sequences_with_line_breaks) { … }
template <class Char>
bool DoIsStringASCII(const Char* characters, size_t length) { … }
template <bool (*Validator)(base_icu::UChar32)>
inline bool DoIsStringUTF8(std::string_view str) { … }
template <typename T, typename CharT = typename T::value_type>
bool StartsWithT(T str, T search_for, CompareCase case_sensitivity) { … }
template <typename T, typename CharT = typename T::value_type>
bool EndsWithT(T str, T search_for, CompareCase case_sensitivity) { … }
template <class CharT>
struct SubstringMatcher { … };
template <typename T, typename CharT = typename T::value_type>
auto MakeSubstringMatcher(T find_this) { … }
template <class CharT>
struct CharacterMatcher { … };
template <typename T, typename CharT = typename T::value_type>
auto MakeCharacterMatcher(T find_any_of_these) { … }
enum class ReplaceType { … };
template <typename Matcher, typename T, typename CharT = typename T::value_type>
bool DoReplaceMatchesAfterOffset(std::basic_string<CharT>* str,
size_t initial_offset,
Matcher matcher,
T replace_with,
ReplaceType replace_type) { … }
template <typename T, typename CharT = typename T::value_type>
bool ReplaceCharsT(T input,
T find_any_of_these,
T replace_with,
std::basic_string<CharT>* output) { … }
template <class string_type>
inline typename string_type::value_type* WriteIntoT(string_type* str,
size_t length_with_null) { … }
template <typename list_type,
typename T,
typename CharT = typename T::value_type>
static std::basic_string<CharT> JoinStringT(list_type parts, T sep) { … }
template <typename T, typename CharT = typename T::value_type>
std::optional<std::basic_string<CharT>> DoReplaceStringPlaceholders(
T format_string,
const std::vector<std::basic_string<CharT>>& subst,
const CharT placeholder_prefix,
const bool should_escape_multiple_placeholder_prefixes,
const bool is_strict_mode,
std::vector<size_t>* offsets) { … }
template <typename CHAR>
size_t lcpyT(CHAR* dst, const CHAR* src, size_t dst_size) { … }
}
#endif