#include "absl/strings/internal/cord_rep_btree.h"
#include <atomic>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <ostream>
#include <string>
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/optimization.h"
#include "absl/strings/internal/cord_data_edge.h"
#include "absl/strings/internal/cord_internal.h"
#include "absl/strings/internal/cord_rep_consume.h"
#include "absl/strings/internal/cord_rep_flat.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace cord_internal {
#ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL
constexpr size_t CordRepBtree::kMaxCapacity;
#endif
namespace {
NodeStack;
EdgeType;
OpResult;
CopyResult;
constexpr auto kFront = …;
constexpr auto kBack = …;
ABSL_CONST_INIT std::atomic<bool> cord_btree_exhaustive_validation(false);
void DumpAll(const CordRep* rep,
bool include_contents,
std::ostream& stream,
size_t depth = 0) { … }
CordRepSubstring* CreateSubstring(CordRep* rep, size_t offset, size_t n) { … }
inline CordRep* MakeSubstring(CordRep* rep, size_t offset, size_t n) { … }
inline CordRep* MakeSubstring(CordRep* rep, size_t offset) { … }
CordRep* ResizeEdge(CordRep* edge, size_t length, bool is_mutable) { … }
template <EdgeType edge_type>
inline absl::string_view Consume(absl::string_view s, size_t n) { … }
template <EdgeType edge_type>
inline absl::string_view Consume(char* dst, absl::string_view s, size_t n) { … }
template <typename R, typename Fn>
inline void FastUnref(R* r, Fn&& fn) { … }
void DeleteSubstring(CordRepSubstring* substring) { … }
void DeleteLeafEdge(CordRep* rep) { … }
template <EdgeType edge_type>
struct StackOperations { … };
}
void SetCordBtreeExhaustiveValidation(bool do_exaustive_validation) { … }
bool IsCordBtreeExhaustiveValidationEnabled() { … }
void CordRepBtree::Dump(const CordRep* rep, absl::string_view label,
bool include_contents, std::ostream& stream) { … }
void CordRepBtree::Dump(const CordRep* rep, absl::string_view label,
std::ostream& stream) { … }
void CordRepBtree::Dump(const CordRep* rep, std::ostream& stream) { … }
template <size_t size>
static void DestroyTree(CordRepBtree* tree) { … }
void CordRepBtree::Destroy(CordRepBtree* tree) { … }
bool CordRepBtree::IsValid(const CordRepBtree* tree, bool shallow) { … }
#ifndef NDEBUG
CordRepBtree* CordRepBtree::AssertValid(CordRepBtree* tree, bool shallow) { … }
const CordRepBtree* CordRepBtree::AssertValid(const CordRepBtree* tree,
bool shallow) { … }
#endif
template <EdgeType edge_type>
inline OpResult CordRepBtree::AddEdge(bool owned, CordRep* edge, size_t delta) { … }
template <EdgeType edge_type>
OpResult CordRepBtree::SetEdge(bool owned, CordRep* edge, size_t delta) { … }
template <EdgeType edge_type>
CordRepBtree* CordRepBtree::AddCordRep(CordRepBtree* tree, CordRep* rep) { … }
template <>
CordRepBtree* CordRepBtree::NewLeaf<kBack>(absl::string_view data,
size_t extra) { … }
template <>
CordRepBtree* CordRepBtree::NewLeaf<kFront>(absl::string_view data,
size_t extra) { … }
template <>
absl::string_view CordRepBtree::AddData<kBack>(absl::string_view data,
size_t extra) { … }
template <>
absl::string_view CordRepBtree::AddData<kFront>(absl::string_view data,
size_t extra) { … }
template <EdgeType edge_type>
CordRepBtree* CordRepBtree::AddData(CordRepBtree* tree, absl::string_view data,
size_t extra) { … }
template <EdgeType edge_type>
CordRepBtree* CordRepBtree::Merge(CordRepBtree* dst, CordRepBtree* src) { … }
CopyResult CordRepBtree::CopySuffix(size_t offset) { … }
CopyResult CordRepBtree::CopyPrefix(size_t n, bool allow_folding) { … }
CordRep* CordRepBtree::ExtractFront(CordRepBtree* tree) { … }
CordRepBtree* CordRepBtree::ConsumeBeginTo(CordRepBtree* tree, size_t end,
size_t new_length) { … }
CordRep* CordRepBtree::RemoveSuffix(CordRepBtree* tree, size_t n) { … }
CordRep* CordRepBtree::SubTree(size_t offset, size_t n) { … }
CordRepBtree* CordRepBtree::MergeTrees(CordRepBtree* left,
CordRepBtree* right) { … }
bool CordRepBtree::IsFlat(absl::string_view* fragment) const { … }
bool CordRepBtree::IsFlat(size_t offset, const size_t n,
absl::string_view* fragment) const { … }
char CordRepBtree::GetCharacter(size_t offset) const { … }
Span<char> CordRepBtree::GetAppendBufferSlow(size_t size) { … }
CordRepBtree* CordRepBtree::CreateSlow(CordRep* rep) { … }
CordRepBtree* CordRepBtree::AppendSlow(CordRepBtree* tree, CordRep* rep) { … }
CordRepBtree* CordRepBtree::PrependSlow(CordRepBtree* tree, CordRep* rep) { … }
CordRepBtree* CordRepBtree::Append(CordRepBtree* tree, absl::string_view data,
size_t extra) { … }
CordRepBtree* CordRepBtree::Prepend(CordRepBtree* tree, absl::string_view data,
size_t extra) { … }
template CordRepBtree* CordRepBtree::AddCordRep<kFront>(CordRepBtree* tree,
CordRep* rep);
template CordRepBtree* CordRepBtree::AddCordRep<kBack>(CordRepBtree* tree,
CordRep* rep);
template CordRepBtree* CordRepBtree::AddData<kFront>(CordRepBtree* tree,
absl::string_view data,
size_t extra);
template CordRepBtree* CordRepBtree::AddData<kBack>(CordRepBtree* tree,
absl::string_view data,
size_t extra);
void CordRepBtree::Rebuild(CordRepBtree** stack, CordRepBtree* tree,
bool consume) { … }
CordRepBtree* CordRepBtree::Rebuild(CordRepBtree* tree) { … }
CordRepBtree::ExtractResult CordRepBtree::ExtractAppendBuffer(
CordRepBtree* tree, size_t extra_capacity) { … }
}
ABSL_NAMESPACE_END
}