|
xrpld
|
A string that is known to reach its terminating null. More...
#include <StringUtilities.h>

Public Member Functions | |
| consteval | NullTerminatedView (std::string_view view) |
| Build a view from one that reaches its terminating null. | |
| constexpr | operator std::string_view () const noexcept |
| constexpr std::string_view | view () const noexcept |
| constexpr char const * | asCString () const noexcept |
Private Attributes | |
| char const * | data_ |
| std::size_t | size_ |
A string that is known to reach its terminating null.
Converts to std::string_view, so it compares and hashes as one. Unlike a view, asCString() may be handed to a reader that expects a C string, such as json::StaticString.
The only constructor is consteval and rejects a view that stops before the null, so the property holds by construction and no caller asserts it.
Definition at line 202 of file StringUtilities.h.
|
explicitconsteval |
Build a view from one that reaches its terminating null.
Explicit, so that a plain view cannot become a proof of termination by accident. The conversion the other way stays implicit.
| view | The string to hold. Rejected at compile time if it stops before its terminating null, or has no data. |
Definition at line 214 of file StringUtilities.h.
|
constexprnoexcept |
Definition at line 222 of file StringUtilities.h.
|
nodiscardconstexprnoexcept |
Definition at line 231 of file StringUtilities.h.
|
nodiscardconstexprnoexcept |
Definition at line 240 of file StringUtilities.h.
|
private |
Definition at line 246 of file StringUtilities.h.
|
private |
Definition at line 247 of file StringUtilities.h.