![]() |
Ark Server API (ASA) - Wiki
|
#include <StringView.h>
Public Types | |
| using | ElementType = CharType |
| using | ViewType = TStringView<CharType> |
Protected Attributes | |
| const CharType * | DataPtr = nullptr |
| int32 | Size = 0 |
Static Private Member Functions | |
| static bool | PrivateEquals (TStringView Lhs, const CharType *Rhs) |
| static bool | PrivateEquals (TStringView Lhs, TStringView Rhs) |
| static bool | PrivateLess (TStringView Lhs, TStringView Rhs) |
A string view is a non-owning view of a range of characters.
Ensure that the underlying string is valid for the lifetime of the string view.
Be careful when constructing a string view from a temporary. Make a local copy if necessary.
FStringView View = Object->GetPathName(); // Invalid
FString PathName = Object->GetPathName(); // Valid FStringView View = PathName;
void ProcessPath(FStringView Path); // Valid ProcessPath(Object->GetPathName());
A string view is implicitly constructible from null-terminated strings, from contiguous ranges of characters such as FString and TStringBuilder, and from literals such as TEXTVIEW("...").
A string view is cheap to copy and is meant to be passed by value. Avoid passing by reference.
A string view is not guaranteed to represent a null-terminated string.
Log or format a string view using UE_LOG(TEXT("%.*s"), View.Len(), View.GetData());
A string view is a good fit for function parameters where the function has no requirements for how the string is stored. A caller may use FString, FStringView, TStringBuilder, a char array, a null-terminated string, or any other type which can convert to a string view.
The UE::String namespace contains many functions that can operate on string views. Most of these functions can be found in String/___.h in Core.
Definition at line 77 of file StringView.h.
| using TStringView< CharType >::ElementType = CharType |
Definition at line 80 of file StringView.h.
| using TStringView< CharType >::ViewType = TStringView<CharType> |
Definition at line 82 of file StringView.h.
|
constexprdefault |
Construct an empty view.
|
inlineconstexpr |
Construct a view of the null-terminated string pointed to by InData.
Definition at line 89 of file StringView.h.
|
inlineconstexpr |
Construct a view of InSize characters beginning at InData.
Definition at line 96 of file StringView.h.
|
inlineconstexpr |
Construct a view of the null-terminated string pointed to by InData.
Definition at line 112 of file StringView.h.
|
inlineconstexpr |
Construct a view of InSize characters beginning at InData.
Definition at line 128 of file StringView.h.
|
inlineconstexpr |
Construct a view from a contiguous range of characters, such as FString or TStringBuilder.
Definition at line 145 of file StringView.h.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlineconstexpr |
DO NOT USE DIRECTLY STL-like iterators to enable range-based for loop support.
Definition at line 443 of file StringView.h.
|
inline |
Compare this view with a null-terminated string.
| Other | A null-terminated string that is comparable with the character type of this view. |
| SearchCase | Whether the comparison should ignore case. |
Definition at line 691 of file StringView.h.
|
inline |
Compare this view with a character range.
| Other | A character range that is comparable with the character type of this view. |
| SearchCase | Whether the comparison should ignore case. |
Definition at line 257 of file StringView.h.
Here is the call graph for this function:
|
inline |
Compare this view with a string view.
| Other | A string view that is comparable with the character type of this view. |
| SearchCase | Whether the comparison should ignore case. |
Definition at line 660 of file StringView.h.
|
inline |
Returns whether this view contains the specified substring.
| Search | Text to search for |
Definition at line 310 of file StringView.h.
Here is the call graph for this function:
|
inline |
Copy characters from the view into a destination buffer without null termination.
| Dest | Buffer to write into. Must have space for at least CharCount characters. |
| CharCount | The maximum number of characters to copy. |
| Position | The offset into the view from which to start copying. |
Definition at line 551 of file StringView.h.
|
inlineconstexpr |
Definition at line 444 of file StringView.h.
|
inline |
Returns whether this view ends with the suffix character compared case-sensitively.
Definition at line 289 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns whether this view ends with the suffix with optional case sensitivity.
Definition at line 724 of file StringView.h.
|
inline |
Check whether this view is equivalent to a string view.
| Other | A string that is comparable with the character type of this view. |
| SearchCase | Whether the comparison should ignore case. |
Definition at line 640 of file StringView.h.
|
inline |
Check whether this view is equivalent to a character range.
| Other | A character range that is comparable with the character type of this view. |
| SearchCase | Whether the comparison should ignore case. |
Definition at line 233 of file StringView.h.
Here is the call graph for this function:
|
inline |
Search the view for the first occurrence of a search string.
| Search | The string to search for. Comparison is lexicographic. |
| StartPosition | The character position to start searching from. |
Definition at line 730 of file StringView.h.
|
inline |
Search the view for the first occurrence of a character.
| Search | The character to search for. Comparison is lexicographic. |
| OutIndex | [out] The position at which the character was found, or INDEX_NONE if not found. |
Definition at line 737 of file StringView.h.
|
inline |
Search the view for the last occurrence of a character.
| Search | The character to search for. Comparison is lexicographic. |
| OutIndex | [out] The position at which the character was found, or INDEX_NONE if not found. |
Definition at line 744 of file StringView.h.
|
inlineconstexpr |
Returns a pointer to the start of the view. This is NOT guaranteed to be null-terminated!
Definition at line 155 of file StringView.h.
|
inlineconstexpr |
Returns whether the string view is empty.
Definition at line 163 of file StringView.h.
|
inline |
Tests if index is valid, i.e. greater than or equal to zero, and less than the number of characters in the string view.
| Index | Index to test. |
Definition at line 340 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns the left-most part of the view by taking the given number of characters from the left.
Definition at line 559 of file StringView.h.
|
inline |
Returns the left-most part of the view by chopping the given number of characters from the right.
Definition at line 565 of file StringView.h.
|
inline |
Modifies the view by chopping the given number of characters from the right.
Definition at line 210 of file StringView.h.
Here is the call graph for this function:
|
inline |
Modifies the view to be the given number of characters from the left.
Definition at line 208 of file StringView.h.
Here is the call graph for this function:
|
inlineconstexpr |
Returns the length of the string view.
Definition at line 160 of file StringView.h.
|
inline |
Returns the middle part of the view by taking up to the given number of characters from the given position.
Definition at line 585 of file StringView.h.
|
inline |
Modifies the view to be the middle part by taking up to the given number of characters from the given position.
Definition at line 216 of file StringView.h.
Here is the call graph for this function:
|
inline |
Access the character at the given index in the view.
Definition at line 544 of file StringView.h.
|
inlinestaticprivate |
Definition at line 751 of file StringView.h.
|
inlinestaticprivate |
Definition at line 757 of file StringView.h.
|
inlinestaticprivate |
Definition at line 763 of file StringView.h.
|
inline |
Modifies the view to remove the given number of characters from the start.
Definition at line 168 of file StringView.h.
Here is the call graph for this function:
|
inline |
Modifies the view to remove the given number of characters from the end.
Definition at line 170 of file StringView.h.
Here is the call graph for this function:
|
inline |
Resets to an empty view
Definition at line 172 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns the right-most part of the view by taking the given number of characters from the right.
Definition at line 571 of file StringView.h.
|
inline |
Returns the right-most part of the view by chopping the given number of characters from the left.
Definition at line 578 of file StringView.h.
|
inline |
Modifies the view by chopping the given number of characters from the left.
Definition at line 214 of file StringView.h.
Here is the call graph for this function:
|
inline |
Modifies the view to be the given number of characters from the right.
Definition at line 212 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns whether this view starts with the prefix character compared case-sensitively.
Definition at line 284 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns whether this view starts with the prefix with optional case sensitivity.
Definition at line 718 of file StringView.h.
|
inline |
Alias for Mid.
Definition at line 188 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns the left part of the view before any whitespace at the end.
Definition at line 627 of file StringView.h.
|
inline |
Modifies the view to be the left part before any whitespace at the end.
Definition at line 222 of file StringView.h.
Here is the call graph for this function:
|
inline |
Returns the right part of the view after any whitespace at the start.
Definition at line 612 of file StringView.h.
|
inline |
Returns the middle part of the view between any whitespace at the start and end.
Definition at line 606 of file StringView.h.
|
inline |
Modifies the view to be the middle part between any whitespace at the start and end.
Definition at line 218 of file StringView.h.
Here is the call graph for this function:
|
inline |
Modifies the view to be the right part after any whitespace at the start.
Definition at line 220 of file StringView.h.
Here is the call graph for this function:
|
friend |
Definition at line 351 of file StringView.h.
|
friend |
Case insensitive string hash function.
Definition at line 357 of file StringView.h.
|
friend |
Definition at line 399 of file StringView.h.
|
friend |
Definition at line 433 of file StringView.h.
|
friend |
Definition at line 393 of file StringView.h.
|
friend |
Definition at line 428 of file StringView.h.
|
friend |
Definition at line 368 of file StringView.h.
|
friend |
Definition at line 412 of file StringView.h.
|
friend |
Definition at line 405 of file StringView.h.
|
friend |
Definition at line 373 of file StringView.h.
|
friend |
Definition at line 386 of file StringView.h.
|
friend |
Definition at line 423 of file StringView.h.
|
friend |
Definition at line 379 of file StringView.h.
|
friend |
Definition at line 418 of file StringView.h.
|
friend |
Definition at line 363 of file StringView.h.
|
protected |
Definition at line 447 of file StringView.h.
|
protected |
Definition at line 448 of file StringView.h.