class TaggedStringPtr

Defined at line 75 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

Public Methods

void TaggedStringPtr ()

Defined at line 109 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

void TaggedStringPtr (ExplicitlyConstructedArenaString * ptr)

Defined at line 110 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

const std::string * SetDefault (const std::string * p)

Sets the value to `p`, tagging the value as being a 'default' value.

See documentation for kDefault for more info.

Defined at line 115 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

std::string * SetAllocated (std::string * p)

Sets the value to `p`, tagging the value as a heap allocated value.

Allocated strings are mutable and (as the name implies) owned.

`p` must not be null

Defined at line 122 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

std::string * SetFixedSizeArena (std::string * p)

Sets the value to `p`, tagging the value as a fixed size arena string.

See documentation for kFixedSizeArena for more info.

`p` must not be null

Defined at line 129 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

std::string * SetMutableArena (std::string * p)

Sets the value to `p`, tagging the value as a mutable arena string.

See documentation for kMutableArena for more info.

`p` must not be null

Defined at line 136 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

bool IsMutable ()

Returns true if the contents of the current string are fully mutable.

Defined at line 141 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

bool IsDefault ()

Returns true if the current string is an immutable default value.

Defined at line 144 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

std::string * GetIfAllocated ()

If the current string is a heap-allocated mutable value, returns a pointer

to it. Returns nullptr otherwise.

Defined at line 148 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

bool IsArena ()

Returns true if the current string is an arena allocated value.

This means it's either a mutable or fixed size arena string.

Defined at line 159 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

bool IsFixedSizeArena ()

Returns true if the current string is a fixed size arena allocated value.

Defined at line 162 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

std::string * Get ()

Returns the contained string pointer.

Defined at line 167 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

bool IsNull ()

Returns true if the contained pointer is null, indicating some error.

The Null value is only used during parsing for temporary values.

A persisted ArenaStringPtr value is never null.

Defined at line 174 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

TaggedStringPtr Copy (Arena * arena)

Returns a copy of this instance. In debug builds, the returned value may be

a forced copy regardless if the current instance is a compile time default.

Defined at line 430 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

TaggedStringPtr Copy (Arena * arena, const LazyString & default_value)

Identical to the above `Copy` function except that in debug builds,

`default_value` can be used to substitute an empty default with a

hardened copy of the default value.

Defined at line 438 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

Enumerations

enum Flags
Name Value Comments
kArenaBit 0x1

ptr is arena allocated

kMutableBit 0x2

ptr contents are fully mutable

kMask 0x3

Bit mask

Bit flags qualifying string properties. We can use 2 bits as

ptr_ is guaranteed and enforced to be aligned on 4 byte boundaries.

Defined at line 79 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h

enum Type
Name Value Comments
kDefault 0

Default strings are immutable and never owned.

kAllocated kMutableBit

Allocated strings are mutable and (as the name implies) owned.
A heap allocated string must be deleted.

kMutableArena kArenaBit | kMutableBit

Mutable arena strings are strings where the string instance is owned
by the arena, but the string contents itself are owned by the string
instance. Mutable arena string instances need to be destroyed which is
typically done through a cleanup action added to the arena owning it.

kFixedSizeArena kArenaBit

Fixed size arena strings are strings where both the string instance and
the string contents are fully owned by the arena. Fixed size arena
strings are a platform and c++ library specific customization. Fixed
size arena strings are immutable, with the exception of custom internal
updates to the content that fit inside the existing capacity.
Fixed size arena strings must never be deleted or destroyed.

Composed logical types

Defined at line 86 of file ../../third_party/protobuf/src/src/google/protobuf/arenastring.h