Go to the documentation of this file.
24 #ifndef ABSL_STRINGS_CORD_BUFFER_H_
25 #define ABSL_STRINGS_CORD_BUFFER_H_
34 #include "absl/base/config.h"
35 #include "absl/base/macros.h"
36 #include "absl/numeric/bits.h"
37 #include "absl/strings/internal/cord_internal.h"
38 #include "absl/strings/internal/cord_rep_flat.h"
39 #include "absl/types/span.h"
45 class CordBufferTestPeer;
315 static constexpr
size_t kInlineCapacity =
sizeof(
intptr_t) * 2 - 1;
322 assert(
rep !=
nullptr);
327 constexpr
size_t offset = offsetof(
Short, raw_size);
328 return (
reinterpret_cast<const char*
>(
this)[
offset] & 1) != 0;
334 const size_t length = (short_rep.raw_size >> 1);
336 kInlineCapacity -
length);
342 const size_t length = long_rep.rep->length;
344 long_rep.rep->Capacity() -
length);
350 return short_rep.raw_size >> 1;
356 short_rep.raw_size =
static_cast<char>((
length << 1) + 1);
362 short_rep.raw_size +=
static_cast<char>(
n << 1);
368 return short_rep.data;
372 return short_rep.data;
385 #if defined(ABSL_IS_BIG_ENDIAN)
392 char data[
sizeof(Long) - 1];
421 template <
typename... AllocationHints>
424 AllocationHints... hints);
446 assert(
rep !=
nullptr);
474 template <
typename... AllocationHints>
476 size_t block_size,
size_t capacity, AllocationHints... hints) {
477 assert(
IsPow2(block_size));
488 const size_t slop = rounded_up -
capacity;
517 rhs.rep_.set_short_length(0);
523 rhs.rep_.set_short_length(0);
572 #endif // ABSL_STRINGS_CORD_BUFFER_H_
static constexpr size_t kMaxLargeFlatSize
absl::Span< char > long_available()
static size_t Log2Ceil(size_t size)
absl::Span< char > short_available()
absl::Span< char > available_up_to(size_t size)
cord_internal::CordRepFlat * rep() const
absl::Span< char > available()
static CordRepFlat * New(size_t len)
static CordBuffer CreateWithCustomLimit(size_t block_size, size_t capacity)
static void Delete(CordRep *rep)
static constexpr size_t kMaxFlatLength
static constexpr size_t MaximumPayload()
cord_internal::CordRep * ConsumeValue(absl::string_view &short_value)
#define ABSL_NAMESPACE_END
void SetLength(size_t length)
#define ABSL_HARDENING_ASSERT(expr)
cord_internal::CordRepFlat * rep
static constexpr size_t kCustomLimit
CordBuffer(cord_internal::CordRepFlat *rep)
const char * data() const
#define ABSL_NAMESPACE_BEGIN
static size_t Log2Floor(size_t size)
static constexpr size_t kOverhead
CordBuffer & operator=(CordBuffer &&) noexcept
void add_short_length(size_t n)
static constexpr size_t kInlineCapacity
static constexpr size_t kFlatOverhead
constexpr std::enable_if< std::is_unsigned< T >::value, bool >::type has_single_bit(T x) noexcept
void IncreaseLengthBy(size_t n)
ABSL_INTERNAL_CONSTEXPR_CLZ std::enable_if< std::is_unsigned< T >::value, T >::type bit_width(T x) noexcept
static CordBuffer CreateWithDefaultLimit(size_t capacity)
size_t short_length() const
Long(cord_internal::CordRepFlat *rep_arg)
static bool IsPow2(size_t size)
static constexpr size_t kMaxPageSlop
absl::string_view string_view
static constexpr size_t kDefaultLimit
Rep(cord_internal::CordRepFlat *rep)
void set_short_length(size_t length)
static CordBuffer CreateWithCustomLimitImpl(size_t block_size, size_t capacity, AllocationHints... hints)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:56