grpc
third_party
abseil-cpp
absl
strings
internal
cord_rep_consume.h
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
#ifndef ABSL_STRINGS_INTERNAL_CORD_REP_CONSUME_H_
16
#define ABSL_STRINGS_INTERNAL_CORD_REP_CONSUME_H_
17
18
#include <functional>
19
20
#include "absl/functional/function_ref.h"
21
#include "absl/strings/internal/cord_internal.h"
22
23
namespace
absl
{
24
ABSL_NAMESPACE_BEGIN
25
namespace
cord_internal {
26
27
// Functor for the Consume() and ReverseConsume() functions:
28
// void ConsumeFunc(CordRep* rep, size_t offset, size_t length);
29
// See the Consume() and ReverseConsume() function comments for documentation.
30
using
ConsumeFn
=
FunctionRef
<void(
CordRep
*,
size_t
,
size_t
)>;
31
32
// Consume() and ReverseConsume() consume CONCAT based trees and invoke the
33
// provided functor with the contained nodes in the proper forward or reverse
34
// order, which is used to convert CONCAT trees into other tree or cord data.
35
// All CONCAT and SUBSTRING nodes are processed internally. The 'offset`
36
// parameter of the functor is non-zero for any nodes below SUBSTRING nodes.
37
// It's up to the caller to form these back into SUBSTRING nodes or otherwise
38
// store offset / prefix information. These functions are intended to be used
39
// only for migration / transitional code where due to factors such as ODR
40
// violations, we can not 100% guarantee that all code respects 'new format'
41
// settings and flags, so we need to be able to parse old data on the fly until
42
// all old code is deprecated / no longer the default format.
43
void
Consume
(
CordRep
*
rep
,
ConsumeFn
consume_fn);
44
void
ReverseConsume
(
CordRep
*
rep
,
ConsumeFn
consume_fn);
45
46
}
// namespace cord_internal
47
ABSL_NAMESPACE_END
48
}
// namespace absl
49
50
#endif // ABSL_STRINGS_INTERNAL_CORD_REP_CONSUME_H_
absl::cord_internal::ReverseConsume
void ReverseConsume(CordRep *rep, ConsumeFn consume_fn)
Definition:
cord_rep_consume.cc:56
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_NAMESPACE_BEGIN
#define ABSL_NAMESPACE_BEGIN
Definition:
third_party/abseil-cpp/absl/base/config.h:170
rep
const CordRep * rep
Definition:
cord_analysis.cc:53
absl::FunctionRef
Definition:
abseil-cpp/absl/functional/function_ref.h:65
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:03