grpc
third_party
abseil-cpp
absl
strings
internal
cord_rep_consume.cc
Go to the documentation of this file.
1
// Copyright 2021 The Abseil Authors
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include "
absl/strings/internal/cord_rep_consume.h
"
16
17
#include <array>
18
#include <utility>
19
20
#include "absl/container/inlined_vector.h"
21
#include "absl/functional/function_ref.h"
22
#include "absl/strings/internal/cord_internal.h"
23
24
namespace
absl
{
25
ABSL_NAMESPACE_BEGIN
26
namespace
cord_internal {
27
28
namespace
{
29
30
// Unrefs the provided `substring`, and returns `substring->child`
31
// Adds or assumes a reference on `substring->child`
32
CordRep* ClipSubstring(CordRepSubstring* substring) {
33
CordRep*
child
= substring->child;
34
if
(substring->refcount.IsOne()) {
35
delete
substring;
36
}
else
{
37
CordRep::Ref
(
child
);
38
CordRep::Unref
(substring);
39
}
40
return
child
;
41
}
42
43
}
// namespace
44
45
void
Consume
(
CordRep
*
rep
,
ConsumeFn
consume_fn) {
46
size_t
offset
= 0;
47
size_t
length
=
rep
->
length
;
48
49
if
(
rep
->
tag
==
SUBSTRING
) {
50
offset
+=
rep
->
substring
()->
start
;
51
rep
= ClipSubstring(
rep
->
substring
());
52
}
53
consume_fn(
rep
,
offset
,
length
);
54
}
55
56
void
ReverseConsume
(
CordRep
*
rep
,
ConsumeFn
consume_fn) {
57
return
Consume
(
rep
,
std::move
(consume_fn));
58
}
59
60
}
// namespace cord_internal
61
ABSL_NAMESPACE_END
62
}
// namespace absl
absl::cord_internal::ReverseConsume
void ReverseConsume(CordRep *rep, ConsumeFn consume_fn)
Definition:
cord_rep_consume.cc:56
absl::cord_internal::CordRep::Unref
static void Unref(CordRep *rep)
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:642
absl::cord_internal::Consume
void Consume(CordRep *rep, ConsumeFn consume_fn)
Definition:
cord_rep_consume.cc:45
ABSL_NAMESPACE_END
#define ABSL_NAMESPACE_END
Definition:
third_party/abseil-cpp/absl/base/config.h:171
absl::cord_internal::CordRep
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:209
absl::cord_internal::CordRep::tag
uint8_t tag
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:232
ABSL_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition:
third_party/abseil-cpp/absl/base/config.h:170
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition:
abseil-cpp/absl/utility/utility.h:221
googletest-filter-unittest.child
child
Definition:
bloaty/third_party/googletest/googletest/test/googletest-filter-unittest.py:62
absl::cord_internal::CordRepSubstring::start
size_t start
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:281
absl::cord_internal::CordRep::length
size_t length
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:228
absl::cord_internal::SUBSTRING
@ SUBSTRING
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:179
rep
const CordRep * rep
Definition:
cord_analysis.cc:53
absl::cord_internal::CordRep::Ref
static CordRep * Ref(CordRep *rep)
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:634
absl::FunctionRef
Definition:
abseil-cpp/absl/functional/function_ref.h:65
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
cord_rep_consume.h
length
std::size_t length
Definition:
abseil-cpp/absl/time/internal/test_util.cc:57
absl::cord_internal::CordRep::substring
CordRepSubstring * substring()
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:614
offset
voidpf uLong offset
Definition:
bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:03