class StringView

Defined at line 23 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

A FIDL string that borrows its contents.

StringView instances can be passed by value, as copying is cheap.

Public Methods

void StringView ()

Defined at line 25 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

void StringView (const VectorView<char> & vector_view)

Defined at line 27 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

void StringView (const VectorView<const char> & vector_view)

Defined at line 28 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

void StringView (AnyArena & allocator, std::string_view from)

Allocates a string using an arena.

Defined at line 32 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

template <size_t N, typename T, typename = std::enable_if_t<std::is_const_v<T> && std::is_same_v<std::remove_cv_t<T>, char>>>
void StringView (T (&)[N] literal)

Disable `explicit` requirements because we want implicit conversions from string literals.

NOLINTNEXTLINE

Defined at line 48 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

StringView FromExternal (std::string_view from)

Constructs a fidl::StringView by unsafely borrowing other strings.

These methods are the only way to reference data which is not managed by an |Arena|.

Their usage is discouraged. The lifetime of the referenced string must be longer than the

lifetime of the created StringView.

For example:

std::string foo = path + "/foo";

auto foo_view = fidl::StringView::FromExternal(foo);

char name[kLength];

snprintf(name, sizeof(name), "Hello %d", 123);

auto name_view = fidl::StringView::FromExternal(name);

Defined at line 67 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

StringView FromExternal (const char * data, size_t size)

Defined at line 68 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

void Set (AnyArena & allocator, std::string_view from)

Defined at line 72 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h

std::string_view get ()

Defined at line 77 of file ../../sdk/lib/fidl/cpp/wire/include/lib/fidl/cpp/wire/string_view.h