#pragma once
#include <iterator>
#include <stdexcept>
#include <folly/CppAttributes.h>
#include <folly/container/Reserve.h>
#ifndef FOLLY_STRING_H_
#error This file may only be included from String.h
#endif
namespace folly {
namespace detail {
extern const std::array<char, 256> cEscapeTable;
}
template <class String>
void cEscape(StringPiece str, String& out) { … }
namespace detail {
extern const std::array<char, 256> cUnescapeTable;
extern const std::array<unsigned char, 256> hexTable;
}
template <class String>
void cUnescape(StringPiece str, String& out, bool strict) { … }
namespace detail {
extern const std::array<unsigned char, 256> uriEscapeTable;
}
template <class String>
void uriEscape(StringPiece str, String& out, UriEscapeMode mode) { … }
template <class String>
bool tryUriUnescape(StringPiece str, String& out, UriEscapeMode mode) { … }
template <class String>
void uriUnescape(StringPiece str, String& out, UriEscapeMode mode) { … }
namespace detail {
inline size_t delimSize(char) { … }
inline size_t delimSize(StringPiece s) { … }
inline bool atDelim(const char* s, char c) { … }
inline bool atDelim(const char* s, StringPiece sp) { … }
inline char delimFront(char) { … }
inline char delimFront(StringPiece s) { … }
template <class OutStringT, class DelimT, class OutputIterator>
void internalSplit(
DelimT delim, StringPiece sp, OutputIterator out, bool ignoreEmpty);
template <class OutStringT, class Container>
std::enable_if_t<
IsSplitSupportedContainer<Container>::value &&
HasSimdSplitCompatibleValueType<Container>::value>
internalSplitRecurseChar(
char delim,
folly::StringPiece sp,
std::back_insert_iterator<Container> it,
bool ignoreEmpty) { … }
template <class OutStringT, class Iterator>
void internalSplitRecurseChar(
char delim, folly::StringPiece sp, Iterator it, bool ignoreEmpty) { … }
template <class OutStringT, class DelimT, class OutputIterator>
void internalSplit(
DelimT delim, StringPiece sp, OutputIterator out, bool ignoreEmpty) { … }
template <class String>
StringPiece prepareDelim(const String& s) { … }
inline char prepareDelim(char c) { … }
template <class OutputType>
void toOrIgnore(StringPiece input, OutputType& output) { … }
inline void toOrIgnore(StringPiece, decltype(std::ignore)&) { … }
template <bool exact, class Delim, class OutputType>
bool splitFixed(const Delim& delimiter, StringPiece input, OutputType& output) { … }
template <bool exact, class Delim, class OutputType, class... OutputTypes>
bool splitFixed(
const Delim& delimiter,
StringPiece input,
OutputType& outHead,
OutputTypes&... outTail) { … }
}
template <class Delim, class String, class OutputType>
std::enable_if_t<
(!detail::IsSimdSupportedDelim<Delim>::value ||
!detail::HasSimdSplitCompatibleValueType<OutputType>::value) &&
detail::IsSplitSupportedContainer<OutputType>::value>
split(
const Delim& delimiter,
const String& input,
OutputType& out,
bool ignoreEmpty) { … }
template <
class OutputValueType,
class Delim,
class String,
class OutputIterator>
void splitTo(
const Delim& delimiter,
const String& input,
OutputIterator out,
bool ignoreEmpty) { … }
template <bool exact, class Delim, class... OutputTypes>
typename std::enable_if<
StrictConjunction<IsConvertible<OutputTypes>...>::value &&
sizeof...(OutputTypes) >= 1,
bool>::type
split(const Delim& delimiter, StringPiece input, OutputTypes&... outputs) { … }
namespace detail {
template <class T>
struct IsSizableString { … };
template <class Iterator>
struct IsSizableStringContainerIterator
: IsSizableString<typename std::iterator_traits<Iterator>::value_type> { … };
template <class Delim, class Iterator, class String>
void internalJoinAppend(
Delim delimiter, Iterator begin, Iterator end, String& output) { … }
template <class Delim, class Iterator, class String>
typename std::enable_if<IsSizableStringContainerIterator<Iterator>::value>::type
internalJoin(Delim delimiter, Iterator begin, Iterator end, String& output) { … }
template <class Delim, class Iterator, class String>
typename std::enable_if<
!IsSizableStringContainerIterator<Iterator>::value>::type
internalJoin(Delim delimiter, Iterator begin, Iterator end, String& output) { … }
}
template <class Delim, class Iterator, class String>
void join(
const Delim& delimiter, Iterator begin, Iterator end, String& output) { … }
template <class OutputString>
void backslashify(
folly::StringPiece input, OutputString& output, bool hex_style) { … }
template <class String1, class String2>
void humanify(const String1& input, String2& output) { … }
template <class InputString, class OutputString>
bool hexlify(
const InputString& input, OutputString& output, bool append_output) { … }
template <class InputString, class OutputString>
bool unhexlify(const InputString& input, OutputString& output) { … }
namespace detail {
size_t hexDumpLine(
const void* ptr, size_t offset, size_t size, std::string& line);
}
template <class OutIt>
void hexDump(const void* ptr, size_t size, OutIt out) { … }
}