class NullSafeStringView

Defined at line 98 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

A null-safe wrapper around std::optional

<std

::string_view>

This class is used to represent a string that may be nullptr. It is used

to avoid the need to check for nullptr before passing a string to the

syslog macros.

This class is implicitly convertible to std::optional

<std

::string_view>.

NOLINT is used as implicit conversions are intentional here.

Public Methods

void NullSafeStringView (std::string_view string_view)

Constructs a NullSafeStringView from a std::string_view.

Defined at line 101 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

void NullSafeStringView (std::nullptr_t )

Constructs a NullSafeStringView from a nullptr.

Defined at line 105 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

void NullSafeStringView (const NullSafeStringView & )

Defined at line 107 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

void NullSafeStringView (const char * input)

Constructs a NullSafeStringView from a const char* which may be nullptr.

string Nullable string to construct from.

Defined at line 111 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

NullSafeStringView CreateFromOptional (std::optional<std::string_view> string_view)

Creates a NullSafeStringView fro, an optional

<std

::string_view>.

This is not a constructor to prevent accidental misuse.

Defined at line 121 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

void NullSafeStringView (const std::string & input)

Constructs a NullSafeStringView from an std::string.

Defined at line 129 of file ../../sdk/lib/syslog/cpp/log_message_impl.h

std::optional<std::string_view> operator optional ()

Converts this NullSafeStringView to a std::optional

<std

::string_view>.

Defined at line 132 of file ../../sdk/lib/syslog/cpp/log_message_impl.h