Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
abseil-cpp
absl
strings
internal
cord_data_edge.h
Go to the documentation of this file.
1
// Copyright 2022 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_DATA_EDGE_H_
16
#define ABSL_STRINGS_INTERNAL_CORD_DATA_EDGE_H_
17
18
#include <cassert>
19
#include <cstddef>
20
21
#include "absl/base/config.h"
22
#include "absl/strings/internal/cord_internal.h"
23
#include "absl/strings/internal/cord_rep_flat.h"
24
#include "absl/strings/string_view.h"
25
26
namespace
absl
{
27
ABSL_NAMESPACE_BEGIN
28
namespace
cord_internal {
29
30
// Returns true if the provided rep is a FLAT, EXTERNAL or a SUBSTRING node
31
// holding a FLAT or EXTERNAL child rep. Requires `rep != nullptr`.
32
inline
bool
IsDataEdge
(
const
CordRep
* edge) {
33
assert(edge !=
nullptr
);
34
35
// The fast path is that `edge` is an EXTERNAL or FLAT node, making the below
36
// if a single, well predicted branch. We then repeat the FLAT or EXTERNAL
37
// check in the slow path of the SUBSTRING check to optimize for the hot path.
38
if
(edge->
tag
==
EXTERNAL
|| edge->
tag
>=
FLAT
)
return
true
;
39
if
(edge->
tag
==
SUBSTRING
) edge = edge->
substring
()->
child
;
40
return
edge->
tag
==
EXTERNAL
|| edge->
tag
>=
FLAT
;
41
}
42
43
// Returns the `absl::string_view` data reference for the provided data edge.
44
// Requires 'IsDataEdge(edge) == true`.
45
inline
absl::string_view
EdgeData
(
const
CordRep
* edge) {
46
assert(
IsDataEdge
(edge));
47
48
size_t
offset
= 0;
49
const
size_t
length
= edge->
length
;
50
if
(edge->
IsSubstring
()) {
51
offset
= edge->
substring
()->
start
;
52
edge = edge->
substring
()->
child
;
53
}
54
return
edge->
tag
>=
FLAT
55
?
absl::string_view
{edge->
flat
()->
Data
() +
offset
,
length
}
56
:
absl::string_view
{edge->
external
()->
base
+
offset
,
length
};
57
}
58
59
}
// namespace cord_internal
60
ABSL_NAMESPACE_END
61
}
// namespace absl
62
63
#endif // ABSL_STRINGS_INTERNAL_CORD_DATA_EDGE_H_
absl::cord_internal::EXTERNAL
@ EXTERNAL
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:183
absl::cord_internal::EdgeData
absl::string_view EdgeData(const CordRep *edge)
Definition:
cord_data_edge.h:45
absl::cord_internal::CordRep::external
CordRepExternal * external()
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:624
absl::string_view
Definition:
abseil-cpp/absl/strings/string_view.h:167
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::cord_internal::FLAT
@ FLAT
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:194
absl::cord_internal::CordRepSubstring::start
size_t start
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:281
absl::cord_internal::CordRep::IsSubstring
constexpr bool IsSubstring() const
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:246
absl::cord_internal::CordRep::length
size_t length
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:228
absl::cord_internal::CordRepFlat::Data
char * Data()
Definition:
abseil-cpp/absl/strings/internal/cord_rep_flat.h:162
absl::cord_internal::SUBSTRING
@ SUBSTRING
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:179
absl::cord_internal::CordRepSubstring::child
CordRep * child
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:282
absl::cord_internal::IsDataEdge
bool IsDataEdge(const CordRep *edge)
Definition:
cord_data_edge.h:32
absl::cord_internal::CordRepExternal::base
const char * base
Definition:
abseil-cpp/absl/strings/internal/cord_internal.h:313
absl
Definition:
abseil-cpp/absl/algorithm/algorithm.h:31
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
absl::cord_internal::CordRep::flat
CordRepFlat * flat()
Definition:
abseil-cpp/absl/strings/internal/cord_rep_flat.h:173
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:58:56