Go to the documentation of this file.
15 #ifndef ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_
16 #define ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_
24 #include "absl/base/config.h"
25 #include "absl/base/internal/raw_logging.h"
26 #include "absl/strings/internal/cord_internal.h"
28 #include "absl/strings/internal/cord_rep_flat.h"
29 #include "absl/strings/string_view.h"
33 namespace cordrep_testing {
48 flat->length =
value.length();
59 this->
base = s.data();
62 delete static_cast<Rep*
>(
self);
71 "abcdefghijklmnopqrstuvwxyz"
72 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
73 "0123456789~!@#$%^&*()_+=-<>?:\"{}[]|";
75 std::uniform_int_distribution<size_t> dist(0,
data.size() - 1);
77 for (
size_t i = 0;
i <
n; ++
i) {
88 assert(chunk_size > 0);
89 std::vector<cord_internal::CordRep*> flats;
91 flats.push_back(
MakeFlat(
s.substr(0, chunk_size)));
98 assert(!flats.
empty());
100 for (
size_t i = 1;
i < flats.
size(); ++
i) {
106 template <
typename Fn>
110 rep =
rep->substring()->child;
120 template <
typename Predicate>
123 std::vector<cord_internal::CordRep*> reps;
125 if (predicate(
rep)) reps.push_back(
rep);
132 std::vector<cord_internal::CordRep*> reps;
143 rep =
rep->substring()->child;
160 s.reserve(
rep->length);
173 template <
typename CordRepType>
181 template <
typename CordRepType>
189 template <
typename CordRepType>
190 CordRepType*
RefIf(
bool condition, CordRepType*
rep) {
205 #endif // ABSL_STRINGS_INTERNAL_CORD_REP_TEST_UTIL_H_
std::string CreateRandomString(size_t n)
std::vector< cord_internal::CordRep * > CordCollectRepsIf(Predicate &&predicate, cord_internal::CordRep *rep)
static void Unref(CordRep *rep)
static CordRepFlat * New(size_t len)
CordRepType * Ref(CordRepType *rep)
static constexpr size_t kMaxFlatLength
#define ABSL_NAMESPACE_END
constexpr bool empty() const noexcept
cord_internal::CordRepFlat * MakeFlat(absl::string_view value)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
std::vector< cord_internal::CordRep * > CreateFlatsFromString(absl::string_view data, size_t chunk_size)
#define ABSL_NAMESPACE_BEGIN
CordRepType * RefIf(bool condition, CordRepType *rep)
static void * tag(intptr_t t)
cord_internal::CordRepBtree * CordRepBtreeFromFlats(absl::Span< cord_internal::CordRep *const > flats)
static CordRepBtree * Create(CordRep *rep)
static CordRepBtree * Append(CordRepBtree *tree, CordRep *rep)
void CordVisitReps(cord_internal::CordRep *rep, Fn &&fn)
cord_internal::CordRepSubstring * MakeSubstring(size_t start, size_t len, cord_internal::CordRep *rep)
CordRepType * Add(CordRepType *rep)
std::vector< cord_internal::CordRep * > CordCollectReps(cord_internal::CordRep *rep)
constexpr size_type size() const noexcept
cord_internal::CordRepExternal * MakeExternal(absl::string_view s)
static CordRep * Ref(CordRep *rep)
std::vector< CordRep * > unrefs_
void CordToString(cord_internal::CordRep *rep, std::string &s)
#define ABSL_RAW_LOG(severity,...)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:56