Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
FString.h
Go to the documentation of this file.
1// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include <string>
6#include <locale>
7#include <Logger/Logger.h>
8
9#include "TArray.h"
10#include "../Windows/MicrosoftPlatformString.h"
11#include "../Templates/MemoryOps.h"
12#include "../Templates/UnrealTemplate.h"
13#include "../Math/UnrealMathUtility.h"
14#include "../Misc/CString.h"
15#include "../Crc.h"
16
17#pragma warning(push)
18#pragma warning(disable : 4244)
19
20struct FStringFormatArg;
21
22/** Determines case sensitivity options for string comparisons. */
23namespace ESearchCase
24{
25 enum Type
26 {
27 /** Case sensitive. Upper/lower casing must match for strings to be considered equal. */
29
30 /** Ignore case. Upper/lower casing does not matter when making a comparison. */
32 };
33};
34
35/** Determines search direction for string operations. */
36namespace ESearchDir
37{
38 enum Type
39 {
40 /** Search from the start, moving forward through the string. */
42
43 /** Search from the end, moving backward through the string. */
45 };
46}
47
48/**
49* A dynamically sizeable string.
50* @see https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/StringHandling/FString/
51*/
53{
54private:
55 friend struct TContainerTraits<FString>;
56
57 /** Array holding the character data */
58 typedef TArray<TCHAR> DataType;
60
61public:
62 using ElementType = TCHAR;
63
64 FString() = default;
65 FString(FString&&) = default;
66 FString(const FString&) = default;
67 FString& operator=(FString&&) = default;
68 FString& operator=(const FString&) = default;
69
70 /**
71 * Create a copy of the Other string with extra space for characters at the end of the string
72 *
73 * @param Other the other string to create a new copy from
74 * @param ExtraSlack number of extra characters to add to the end of the other string in this string
75 */
76 FORCEINLINE FString(const FString& Other, int32 ExtraSlack)
77 : Data(Other.Data, ExtraSlack + ((Other.Data.Num() || !ExtraSlack) ? 0 : 1)) // Add 1 if the source string array is empty and we want some slack, because we'll need to include a null terminator which is currently missing
78 {
79 }
80
81 /**
82 * Create a copy of the Other string with extra space for characters at the end of the string
83 *
84 * @param Other the other string to create a new copy from
85 * @param ExtraSlack number of extra characters to add to the end of the other string in this string
86 */
87 FORCEINLINE FString(FString&& Other, int32 ExtraSlack)
88 : Data(MoveTemp(Other.Data), ExtraSlack + ((Other.Data.Num() || !ExtraSlack) ? 0 : 1)) // Add 1 if the source string array is empty and we want some slack, because we'll need to include a null terminator which is currently missing
89 {
90 }
91
92 /**
93 * Constructor using an array of TCHAR
94 *
95 * @param In array of TCHAR
96 */
97 template <typename CharType>
98 FORCEINLINE FString(const CharType* Src, typename TEnableIf<TIsCharType<CharType>::Value>::Type* Dummy = nullptr) // This TEnableIf is to ensure we don't instantiate this constructor for non-char types, like id* in Obj-C
99 {
100 if (Src && *Src)
101 {
102 int32 SrcLen = TCString<CharType>::Strlen(Src) + 1;
103 int32 DestLen = FPlatformString::ConvertedLength<TCHAR>(Src, SrcLen);
104 Data.AddUninitialized(DestLen);
105
106 FPlatformString::Convert(Data.GetData(), DestLen, Src, SrcLen);
107 }
108 }
109
110 /**
111 * Constructor to create FString with specified number of characters from another string with additional character zero
112 *
113 * @param InCount how many characters to copy
114 * @param InSrc String to copy from
115 */
116 FORCEINLINE explicit FString(int32 InCount, const TCHAR* InSrc)
117 {
118 Data.AddUninitialized(InCount ? InCount + 1 : 0);
119
120 if (Data.Num() > 0)
121 {
122 FCString::Strncpy(Data.GetData(), InSrc, InCount + 1);
123 }
124 }
125
126 /**
127 * Constructor to create FString from std::string
128 */
129 FORCEINLINE explicit FString(const std::string& str)
130 : FString(str.c_str())
131 {
132 }
133
134 /**
135 * Constructor to create FString from std::wstring
136 */
137 FORCEINLINE explicit FString(const std::wstring& str)
138 : FString(str.c_str())
139 {
140 }
141
142 /**
143 * Copy Assignment from array of TCHAR
144 *
145 * @param Other array of TCHAR
146 */
147 FORCEINLINE FString& operator=(const TCHAR* Other)
148 {
149 if (Data.GetData() != Other)
150 {
151 int32 Len = (Other && *Other) ? FCString::Strlen(Other) + 1 : 0;
152 Data.Empty(Len);
153 Data.AddUninitialized(Len);
154
155 if (Len)
156 {
157 FMemory::Memcpy(Data.GetData(), Other, Len * sizeof(TCHAR));
158 }
159 }
160 return *this;
161 }
162
163 /**
164 * Return specific character from this string
165 *
166 * @param Index into string
167 * @return Character at Index
168 */
169 FORCEINLINE TCHAR& operator[](int32 Index)
170 {
171 return Data.GetData()[Index];
172 }
173
174 /**
175 * Return specific const character from this string
176 *
177 * @param Index into string
178 * @return const Character at Index
179 */
180 FORCEINLINE const TCHAR& operator[](int32 Index) const
181 {
182 return Data.GetData()[Index];
183 }
184
185 /**
186 * Iterator typedefs
187 */
188 typedef TArray<TCHAR>::TIterator TIterator;
189 typedef TArray<TCHAR>::TConstIterator TConstIterator;
190
191 /** Creates an iterator for the characters in this string */
192 FORCEINLINE TIterator CreateIterator()
193 {
194 return Data.CreateIterator();
195 }
196
197 /** Creates a const iterator for the characters in this string */
198 FORCEINLINE TConstIterator CreateConstIterator() const
199 {
200 return Data.CreateConstIterator();
201 }
202
203private:
204 /**
205 * DO NOT USE DIRECTLY
206 * STL-like iterators to enable range-based for loop support.
207 */
208 FORCEINLINE friend DataType::RangedForIteratorType begin(FString& Str) { auto Result = begin(Str.Data); return Result; }
209 FORCEINLINE friend DataType::RangedForConstIteratorType begin(const FString& Str) { auto Result = begin(Str.Data); return Result; }
210 FORCEINLINE friend DataType::RangedForIteratorType end(FString& Str) { auto Result = end(Str.Data); if (Str.Data.Num()) { --Result; } return Result; }
211 FORCEINLINE friend DataType::RangedForConstIteratorType end(const FString& Str) { auto Result = end(Str.Data); if (Str.Data.Num()) { --Result; } return Result; }
212
213public:
214 FORCEINLINE uint32 GetAllocatedSize() const
215 {
216 return Data.GetAllocatedSize();
217 }
218
219 /**
220 * Run slow checks on this string
221 */
222 FORCEINLINE void CheckInvariants() const
223 {
224 }
225
226 /**
227 * Create empty string of given size with zero terminating character
228 *
229 * @param Slack length of empty string to create
230 */
231 FORCEINLINE void Empty(int32 Slack = 0)
232 {
233 Data.Empty(Slack);
234 }
235
236 /**
237 * Test whether this string is empty
238 *
239 * @return true if this string is empty, otherwise return false.
240 */
241 FORCEINLINE bool IsEmpty() const
242 {
243 return Data.Num() <= 1;
244 }
245
246 /**
247 * Empties the string, but doesn't change memory allocation, unless the new size is larger than the current string.
248 *
249 * @param NewReservedSize The expected usage size (in characters, not including the terminator) after calling this function.
250 */
251 FORCEINLINE void Reset(int32 NewReservedSize = 0)
252 {
253 const int32 NewSizeIncludingTerminator = (NewReservedSize > 0) ? (NewReservedSize + 1) : 0;
254 Data.Reset(NewSizeIncludingTerminator);
255 }
256
257 /**
258 * Remove unallocated empty character space from the end of this string
259 */
260 FORCEINLINE void Shrink()
261 {
262 Data.Shrink();
263 }
264
265 /**
266 * Tests if index is valid, i.e. greater than or equal to zero, and less than the number of characters in this string (excluding the null terminator).
267 *
268 * @param Index Index to test.
269 *
270 * @returns True if index is valid. False otherwise.
271 */
272 FORCEINLINE bool IsValidIndex(int32 Index) const
273 {
274 return Index >= 0 && Index < Len();
275 }
276
277 /**
278 * Get pointer to the string
279 *
280 * @Return Pointer to Array of TCHAR if Num, otherwise the empty string
281 */
282 FORCEINLINE const TCHAR* operator*() const
283 {
284 return Data.Num() ? Data.GetData() : TEXT("");
285 }
286
287 /**
288 *Get string as array of TCHARS
289 *
290 * @warning: Operations on the TArray<*CHAR> can be unsafe, such as adding
291 * non-terminating 0's or removing the terminating zero.
292 */
293 FORCEINLINE DataType& GetCharArray()
294 {
295 return Data;
296 }
297
298 /** Get string as const array of TCHARS */
299 FORCEINLINE const DataType& GetCharArray() const
300 {
301 return Data;
302 }
303
304#ifdef __OBJC__
305 /** Convert FString to Objective-C NSString */
307 {
308#if PLATFORM_TCHAR_IS_4_BYTES
310#else
312#endif
313 }
314#endif
315
316 /**
317 * Appends an array of characters to the string.
318 *
319 * @param Array A pointer to the start of an array of characters to append. This array need not be null-terminated, and null characters are not treated specially.
320 * @param Count The number of characters to copy from Array.
321 */
322 FORCEINLINE void AppendChars(const TCHAR* Array, int32 Count)
323 {
324 if (!Count)
325 return;
326
327 int32 Index = Data.Num();
328
329 // Reserve enough space - including an extra gap for a null terminator if we don't already have a string allocated
330 Data.AddUninitialized(Count + (Index ? 0 : 1));
331
332 TCHAR* EndPtr = Data.GetData() + Index - (Index ? 1 : 0);
333
334 // Copy characters to end of string, overwriting null terminator if we already have one
335 CopyAssignItems(EndPtr, Array, Count);
336
337 // (Re-)establish the null terminator
338 *(EndPtr + Count) = 0;
339 }
340
341 /**
342 * Concatenate this with given string
343 *
344 * @param Str array of TCHAR to be concatenated onto the end of this
345 * @return reference to this
346 */
347 FORCEINLINE FString& operator+=(const TCHAR* Str)
348 {
350
352
353 return *this;
354 }
355
356 /**
357 * Concatenate this with given char
358 *
359 * @param inChar other Char to be concatenated onto the end of this string
360 * @return reference to this
361 */
362 template <typename CharType>
363 FORCEINLINE typename TEnableIf<TIsCharType<CharType>::Value, FString&>::Type operator+=(CharType InChar)
364 {
366
367 if (InChar != 0)
368 {
369 // position to insert the character.
370 // At the end of the string if we have existing characters, otherwise at the 0 position
371 int32 InsertIndex = (Data.Num() > 0) ? Data.Num() - 1 : 0;
372
373 // number of characters to add. If we don't have any existing characters,
374 // we'll need to append the terminating zero as well.
375 int32 InsertCount = (Data.Num() > 0) ? 1 : 2;
376
377 Data.AddUninitialized(InsertCount);
378 Data[InsertIndex] = InChar;
379 Data[InsertIndex + 1] = 0;
380 }
381 return *this;
382 }
383
384 /**
385 * Concatenate this with given char
386 *
387 * @param InChar other Char to be concatenated onto the end of this string
388 * @return reference to this
389 */
390 FORCEINLINE FString& AppendChar(const TCHAR InChar)
391 {
392 *this += InChar;
393 return *this;
394 }
395
396 FORCEINLINE FString& Append(const FString& Text)
397 {
398 *this += Text;
399 return *this;
400 }
401
402 FString& Append(const TCHAR* Text, int32 Count)
403 {
405
406 if (Count != 0)
407 {
408 // position to insert the character.
409 // At the end of the string if we have existing characters, otherwise at the 0 position
410 int32 InsertIndex = (Data.Num() > 0) ? Data.Num() - 1 : 0;
411
412 // number of characters to add. If we don't have any existing characters,
413 // we'll need to append the terminating zero as well.
414 int32 FinalCount = (Data.Num() > 0) ? Count : Count + 1;
415
416 Data.AddUninitialized(FinalCount);
417
418 for (int32 Index = 0; Index < Count; Index++)
419 {
420 Data[InsertIndex + Index] = Text[Index];
421 }
422
423 Data[Data.Num() - 1] = 0;
424 }
425 return *this;
426 }
427
428 /**
429 * Removes characters within the string.
430 *
431 * @param Index The index of the first character to remove.
432 * @param Count The number of characters to remove.
433 * @param bAllowShrinking Whether or not to reallocate to shrink the storage after removal.
434 */
435 FORCEINLINE void RemoveAt(int32 Index, int32 Count = 1, bool bAllowShrinking = true)
436 {
437 Data.RemoveAt(Index, Count, bAllowShrinking);
438 }
439
440 FORCEINLINE void InsertAt(int32 Index, TCHAR Character)
441 {
442 if (Character != 0)
443 {
444 if (Data.Num() == 0)
445 {
446 *this += Character;
447 }
448 else
449 {
450 Data.Insert(Character, Index);
451 }
452 }
453 }
454
455 FORCEINLINE void InsertAt(int32 Index, const FString& Characters)
456 {
457 if (Characters.Len())
458 {
459 if (Data.Num() == 0)
460 {
461 *this += Characters;
462 }
463 else
464 {
465 Data.Insert(Characters.Data.GetData(), Characters.Len(), Index);
466 }
467 }
468 }
469
470 /**
471 * Removes the text from the start of the string if it exists.
472 *
473 * @param InPrefix the prefix to search for at the start of the string to remove.
474 * @return true if the prefix was removed, otherwise false.
475 */
476 bool RemoveFromStart(const FString& InPrefix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase);
477
478 /**
479 * Removes the text from the end of the string if it exists.
480 *
481 * @param InSuffix the suffix to search for at the end of the string to remove.
482 * @return true if the suffix was removed, otherwise false.
483 */
484 bool RemoveFromEnd(const FString& InSuffix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase);
485
486 /**
487 * Concatenate this path with given path ensuring the / character is used between them
488 *
489 * @param Str Pointer to an array of TCHARs (not necessarily null-terminated) to be concatenated onto the end of this.
490 * @param StrLength Exact number of characters from Str to append.
491 */
492 void PathAppend(const TCHAR* Str, int32 StrLength);
493
494 /**
495 * Concatenate this with given string
496 *
497 * @param Str other string to be concatenated onto the end of this
498 * @return reference to this
499 */
500 FORCEINLINE FString& operator+=(const FString& Str)
501 {
504
505 AppendChars(Str.Data.GetData(), Str.Len());
506
507 return *this;
508 }
509
510 /**
511 * Concatenates an FString with a TCHAR.
512 *
513 * @param Lhs The FString on the left-hand-side of the expression.
514 * @param Rhs The char on the right-hand-side of the expression.
515 *
516 * @return The concatenated string.
517 */
518 template <typename CharType>
519 FORCEINLINE friend typename TEnableIf<TIsCharType<CharType>::Value, FString>::Type operator+(const FString& Lhs, CharType Rhs)
520 {
522
523 FString Result(Lhs, 1);
524 Result += Rhs;
525
526 return Result;
527 }
528
529 /**
530 * Concatenates an FString with a TCHAR.
531 *
532 * @param Lhs The FString on the left-hand-side of the expression.
533 * @param Rhs The char on the right-hand-side of the expression.
534 *
535 * @return The concatenated string.
536 */
537 template <typename CharType>
538 FORCEINLINE friend typename TEnableIf<TIsCharType<CharType>::Value, FString>::Type operator+(FString&& Lhs, CharType Rhs)
539 {
541
543 Result += Rhs;
544
545 return Result;
546 }
547
548private:
549 template <typename LhsType, typename RhsType>
550 FORCEINLINE static FString ConcatFStrings(typename TIdentity<LhsType>::Type Lhs, typename TIdentity<RhsType>::Type Rhs)
551 {
552 Lhs.CheckInvariants();
553 Rhs.CheckInvariants();
554
555 if (Lhs.IsEmpty())
556 {
557 return MoveTempIfPossible(Rhs);
558 }
559
560 int32 RhsLen = Rhs.Len();
561
562 FString Result(MoveTempIfPossible(Lhs), RhsLen);
563 Result.AppendChars(Rhs.Data.GetData(), RhsLen);
564
565 return Result;
566 }
567
568 template <typename RhsType>
569 FORCEINLINE static FString ConcatTCHARsToFString(const TCHAR* Lhs, typename TIdentity<RhsType>::Type Rhs)
570 {
571 Rhs.CheckInvariants();
572
573 if (!Lhs || !*Lhs)
574 {
575 return MoveTempIfPossible(Rhs);
576 }
577
578 int32 LhsLen = FCString::Strlen(Lhs);
579 int32 RhsLen = Rhs.Len();
580
581 // This is not entirely optimal, as if the Rhs is an rvalue and has enough slack space to hold Lhs, then
582 // the memory could be reused here without constructing a new object. However, until there is proof otherwise,
583 // I believe this will be relatively rare and isn't worth making the code a lot more complex right now.
584 FString Result;
585 Result.Data.AddUninitialized(LhsLen + RhsLen + 1);
586
587 TCHAR* ResultData = Result.Data.GetData();
588 CopyAssignItems(ResultData, Lhs, LhsLen);
589 CopyAssignItems(ResultData + LhsLen, Rhs.Data.GetData(), RhsLen);
590 *(ResultData + LhsLen + RhsLen) = 0;
591
592 return Result;
593 }
594
595 template <typename LhsType>
596 FORCEINLINE static FString ConcatFStringToTCHARs(typename TIdentity<LhsType>::Type Lhs, const TCHAR* Rhs)
597 {
598 Lhs.CheckInvariants();
599
600 if (!Rhs || !*Rhs)
601 {
602 return MoveTempIfPossible(Lhs);
603 }
604
605 int32 RhsLen = FCString::Strlen(Rhs);
606
607 FString Result(MoveTempIfPossible(Lhs), RhsLen);
608 Result.AppendChars(Rhs, RhsLen);
609
610 return Result;
611 }
612
613public:
614 /**
615 * Concatenate two FStrings.
616 *
617 * @param Lhs The FString on the left-hand-side of the expression.
618 * @param Rhs The FString on the right-hand-side of the expression.
619 *
620 * @return The concatenated string.
621 */
622 FORCEINLINE friend FString operator+(const FString& Lhs, const FString& Rhs)
623 {
624 return ConcatFStrings<const FString&, const FString&>(Lhs, Rhs);
625 }
626
627 /**
628 * Concatenate two FStrings.
629 *
630 * @param Lhs The FString on the left-hand-side of the expression.
631 * @param Rhs The FString on the right-hand-side of the expression.
632 *
633 * @return The concatenated string.
634 */
635 FORCEINLINE friend FString operator+(FString&& Lhs, const FString& Rhs)
636 {
638 }
639
640 /**
641 * Concatenate two FStrings.
642 *
643 * @param Lhs The FString on the left-hand-side of the expression.
644 * @param Rhs The FString on the right-hand-side of the expression.
645 *
646 * @return The concatenated string.
647 */
648 FORCEINLINE friend FString operator+(const FString& Lhs, FString&& Rhs)
649 {
651 }
652
653 /**
654 * Concatenate two FStrings.
655 *
656 * @param Lhs The FString on the left-hand-side of the expression.
657 * @param Rhs The FString on the right-hand-side of the expression.
658 *
659 * @return The concatenated string.
660 */
661 FORCEINLINE friend FString operator+(FString&& Lhs, FString&& Rhs)
662 {
664 }
665
666 /**
667 * Concatenates a TCHAR array to an FString.
668 *
669 * @param Lhs The TCHAR array on the left-hand-side of the expression.
670 * @param Rhs The FString on the right-hand-side of the expression.
671 *
672 * @return The concatenated string.
673 */
674 FORCEINLINE friend FString operator+(const TCHAR* Lhs, const FString& Rhs)
675 {
676 return ConcatTCHARsToFString<const FString&>(Lhs, Rhs);
677 }
678
679 /**
680 * Concatenates a TCHAR array to an FString.
681 *
682 * @param Lhs The TCHAR array on the left-hand-side of the expression.
683 * @param Rhs The FString on the right-hand-side of the expression.
684 *
685 * @return The concatenated string.
686 */
687 FORCEINLINE friend FString operator+(const TCHAR* Lhs, FString&& Rhs)
688 {
690 }
691
692 /**
693 * Concatenates an FString to a TCHAR array.
694 *
695 * @param Lhs The FString on the left-hand-side of the expression.
696 * @param Rhs The TCHAR array on the right-hand-side of the expression.
697 *
698 * @return The concatenated string.
699 */
700 FORCEINLINE friend FString operator+(const FString& Lhs, const TCHAR* Rhs)
701 {
702 return ConcatFStringToTCHARs<const FString&>(Lhs, Rhs);
703 }
704
705 /**
706 * Concatenates an FString to a TCHAR array.
707 *
708 * @param Lhs The FString on the left-hand-side of the expression.
709 * @param Rhs The TCHAR array on the right-hand-side of the expression.
710 *
711 * @return The concatenated string.
712 */
713 FORCEINLINE friend FString operator+(FString&& Lhs, const TCHAR* Rhs)
714 {
716 }
717
718 /**
719 * Concatenate this path with given path ensuring the / character is used between them
720 *
721 * @param Str path array of TCHAR to be concatenated onto the end of this
722 * @return reference to path
723 */
724 FORCEINLINE FString& operator/=(const TCHAR* Str)
725 {
727 return *this;
728 }
729
730 /**
731 * Concatenate this path with given path ensuring the / character is used between them
732 *
733 * @param Str path FString to be concatenated onto the end of this
734 * @return reference to path
735 */
736 FORCEINLINE FString& operator/=(const FString& Str)
737 {
738 PathAppend(Str.Data.GetData(), Str.Len());
739 return *this;
740 }
741
742 /**
743 * Concatenate this path with given path ensuring the / character is used between them
744 *
745 * @param Lhs Path to concatenate onto.
746 * @param Rhs Path to concatenate.
747 * @return new FString of the path
748 */
749 FORCEINLINE friend FString operator/(const FString& Lhs, const TCHAR* Rhs)
750 {
751 int32 StrLength = FCString::Strlen(Rhs);
752
753 FString Result(Lhs, StrLength + 1);
754 Result.PathAppend(Rhs, StrLength);
755 return Result;
756 }
757
758 /**
759 * Concatenate this path with given path ensuring the / character is used between them
760 *
761 * @param Lhs Path to concatenate onto.
762 * @param Rhs Path to concatenate.
763 * @return new FString of the path
764 */
765 FORCEINLINE friend FString operator/(FString&& Lhs, const TCHAR* Rhs)
766 {
767 int32 StrLength = FCString::Strlen(Rhs);
768
769 FString Result(MoveTemp(Lhs), StrLength + 1);
770 Result.PathAppend(Rhs, StrLength);
771 return Result;
772 }
773
774 /**
775 * Concatenate this path with given path ensuring the / character is used between them
776 *
777 * @param Lhs Path to concatenate onto.
778 * @param Rhs Path to concatenate.
779 * @return new FString of the path
780 */
781 FORCEINLINE friend FString operator/(const FString& Lhs, const FString& Rhs)
782 {
783 int32 StrLength = Rhs.Len();
784
785 FString Result(Lhs, StrLength + 1);
786 Result.PathAppend(Rhs.Data.GetData(), StrLength);
787 return Result;
788 }
789
790 /**
791 * Concatenate this path with given path ensuring the / character is used between them
792 *
793 * @param Lhs Path to concatenate onto.
794 * @param Rhs Path to concatenate.
795 * @return new FString of the path
796 */
797 FORCEINLINE friend FString operator/(FString&& Lhs, const FString& Rhs)
798 {
799 int32 StrLength = Rhs.Len();
800
801 FString Result(MoveTemp(Lhs), StrLength + 1);
802 Result.PathAppend(Rhs.Data.GetData(), StrLength);
803 return Result;
804 }
805
806 /**
807 * Concatenate this path with given path ensuring the / character is used between them
808 *
809 * @param Lhs Path to concatenate onto.
810 * @param Rhs Path to concatenate.
811 * @return new FString of the path
812 */
813 FORCEINLINE friend FString operator/(const TCHAR* Lhs, const FString& Rhs)
814 {
815 int32 StrLength = Rhs.Len();
816
817 FString Result(FString(Lhs), StrLength + 1);
818 Result.PathAppend(Rhs.Data.GetData(), Rhs.Len());
819 return Result;
820 }
821
822 /**
823 * Lexicographically test whether the left string is <= the right string
824 *
825 * @param Lhs String to compare against.
826 * @param Rhs String to compare against.
827 * @return true if the left string is lexicographically <= the right string, otherwise false
828 * @note case insensitive
829 */
830 FORCEINLINE friend bool operator<=(const FString& Lhs, const FString& Rhs)
831 {
832 return FPlatformString::Stricmp(*Lhs, *Rhs) <= 0;
833 }
834
835 /**
836 * Lexicographically test whether the left string is <= the right string
837 *
838 * @param Lhs String to compare against.
839 * @param Rhs String to compare against.
840 * @return true if the left string is lexicographically <= the right string, otherwise false
841 * @note case insensitive
842 */
843 template <typename CharType>
844 FORCEINLINE friend bool operator<=(const FString& Lhs, const CharType* Rhs)
845 {
846 return FPlatformString::Stricmp(*Lhs, Rhs) <= 0;
847 }
848
849 /**
850 * Lexicographically test whether the left string is <= the right string
851 *
852 * @param Lhs String to compare against.
853 * @param Rhs String to compare against.
854 * @return true if the left string is lexicographically <= the right string, otherwise false
855 * @note case insensitive
856 */
857 template <typename CharType>
858 FORCEINLINE friend bool operator<=(const CharType* Lhs, const FString& Rhs)
859 {
860 return FPlatformString::Stricmp(Lhs, *Rhs) <= 0;
861 }
862
863 /**
864 * Lexicographically test whether the left string is < the right string
865 *
866 * @param Lhs String to compare against.
867 * @param Rhs String to compare against.
868 * @return true if the left string is lexicographically < the right string, otherwise false
869 * @note case insensitive
870 */
871 FORCEINLINE friend bool operator<(const FString& Lhs, const FString& Rhs)
872 {
873 return FPlatformString::Stricmp(*Lhs, *Rhs) < 0;
874 }
875
876 /**
877 * Lexicographically test whether the left string is < the right string
878 *
879 * @param Lhs String to compare against.
880 * @param Rhs String to compare against.
881 * @return true if the left string is lexicographically < the right string, otherwise false
882 * @note case insensitive
883 */
884 template <typename CharType>
885 FORCEINLINE friend bool operator<(const FString& Lhs, const CharType* Rhs)
886 {
887 return FPlatformString::Stricmp(*Lhs, Rhs) < 0;
888 }
889
890 /**
891 * Lexicographically test whether the left string is < the right string
892 *
893 * @param Lhs String to compare against.
894 * @param Rhs String to compare against.
895 * @return true if the left string is lexicographically < the right string, otherwise false
896 * @note case insensitive
897 */
898 template <typename CharType>
899 FORCEINLINE friend bool operator<(const CharType* Lhs, const FString& Rhs)
900 {
901 return FPlatformString::Stricmp(Lhs, *Rhs) < 0;
902 }
903
904 /**
905 * Lexicographically test whether the left string is >= the right string
906 *
907 * @param Lhs String to compare against.
908 * @param Rhs String to compare against.
909 * @return true if the left string is lexicographically >= the right string, otherwise false
910 * @note case insensitive
911 */
912 FORCEINLINE friend bool operator>=(const FString& Lhs, const FString& Rhs)
913 {
914 return FPlatformString::Stricmp(*Lhs, *Rhs) >= 0;
915 }
916
917 /**
918 * Lexicographically test whether the left string is >= the right string
919 *
920 * @param Lhs String to compare against.
921 * @param Rhs String to compare against.
922 * @return true if the left string is lexicographically >= the right string, otherwise false
923 * @note case insensitive
924 */
925 template <typename CharType>
926 FORCEINLINE friend bool operator>=(const FString& Lhs, const CharType* Rhs)
927 {
928 return FPlatformString::Stricmp(*Lhs, Rhs) >= 0;
929 }
930
931 /**
932 * Lexicographically test whether the left string is >= the right string
933 *
934 * @param Lhs String to compare against.
935 * @param Rhs String to compare against.
936 * @return true if the left string is lexicographically >= the right string, otherwise false
937 * @note case insensitive
938 */
939 template <typename CharType>
940 FORCEINLINE friend bool operator>=(const CharType* Lhs, const FString& Rhs)
941 {
942 return FPlatformString::Stricmp(Lhs, *Rhs) >= 0;
943 }
944
945 /**
946 * Lexicographically test whether the left string is > the right string
947 *
948 * @param Lhs String to compare against.
949 * @param Rhs String to compare against.
950 * @return true if the left string is lexicographically > the right string, otherwise false
951 * @note case insensitive
952 */
953 FORCEINLINE friend bool operator>(const FString& Lhs, const FString& Rhs)
954 {
955 return FPlatformString::Stricmp(*Lhs, *Rhs) > 0;
956 }
957
958 /**
959 * Lexicographically test whether the left string is > the right string
960 *
961 * @param Lhs String to compare against.
962 * @param Rhs String to compare against.
963 * @return true if the left string is lexicographically > the right string, otherwise false
964 * @note case insensitive
965 */
966 template <typename CharType>
967 FORCEINLINE friend bool operator>(const FString& Lhs, const CharType* Rhs)
968 {
969 return FPlatformString::Stricmp(*Lhs, Rhs) > 0;
970 }
971
972 /**
973 * Lexicographically test whether the left string is > the right string
974 *
975 * @param Lhs String to compare against.
976 * @param Rhs String to compare against.
977 * @return true if the left string is lexicographically > the right string, otherwise false
978 * @note case insensitive
979 */
980 template <typename CharType>
981 FORCEINLINE friend bool operator>(const CharType* Lhs, const FString& Rhs)
982 {
983 return FPlatformString::Stricmp(Lhs, *Rhs) > 0;
984 }
985
986 /**
987 * Lexicographically test whether the left string is == the right string
988 *
989 * @param Lhs String to compare against.
990 * @param Rhs String to compare against.
991 * @return true if the left string is lexicographically == the right string, otherwise false
992 * @note case insensitive
993 */
994 FORCEINLINE friend bool operator==(const FString& Lhs, const FString& Rhs)
995 {
996 return FPlatformString::Stricmp(*Lhs, *Rhs) == 0;
997 }
998
999 /**
1000 * Lexicographically test whether the left string is == the right string
1001 *
1002 * @param Lhs String to compare against.
1003 * @param Rhs String to compare against.
1004 * @return true if the left string is lexicographically == the right string, otherwise false
1005 * @note case insensitive
1006 */
1007 template <typename CharType>
1008 FORCEINLINE friend bool operator==(const FString& Lhs, const CharType* Rhs)
1009 {
1010 return FPlatformString::Stricmp(*Lhs, Rhs) == 0;
1011 }
1012
1013 /**
1014 * Lexicographically test whether the left string is == the right string
1015 *
1016 * @param Lhs String to compare against.
1017 * @param Rhs String to compare against.
1018 * @return true if the left string is lexicographically == the right string, otherwise false
1019 * @note case insensitive
1020 */
1021 template <typename CharType>
1022 FORCEINLINE friend bool operator==(const CharType* Lhs, const FString& Rhs)
1023 {
1024 return FPlatformString::Stricmp(Lhs, *Rhs) == 0;
1025 }
1026
1027 /**
1028 * Lexicographically test whether the left string is != the right string
1029 *
1030 * @param Lhs String to compare against.
1031 * @param Rhs String to compare against.
1032 * @return true if the left string is lexicographically != the right string, otherwise false
1033 * @note case insensitive
1034 */
1035 FORCEINLINE friend bool operator!=(const FString& Lhs, const FString& Rhs)
1036 {
1037 return FPlatformString::Stricmp(*Lhs, *Rhs) != 0;
1038 }
1039
1040 /**
1041 * Lexicographically test whether the left string is != the right string
1042 *
1043 * @param Lhs String to compare against.
1044 * @param Rhs String to compare against.
1045 * @return true if the left string is lexicographically != the right string, otherwise false
1046 * @note case insensitive
1047 */
1048 template <typename CharType>
1049 FORCEINLINE friend bool operator!=(const FString& Lhs, const CharType* Rhs)
1050 {
1051 return FPlatformString::Stricmp(*Lhs, Rhs) != 0;
1052 }
1053
1054 /**
1055 * Lexicographically test whether the left string is != the right string
1056 *
1057 * @param Lhs String to compare against.
1058 * @param Rhs String to compare against.
1059 * @return true if the left string is lexicographically != the right string, otherwise false
1060 * @note case insensitive
1061 */
1062 template <typename CharType>
1063 FORCEINLINE friend bool operator!=(const CharType* Lhs, const FString& Rhs)
1064 {
1065 return FPlatformString::Stricmp(Lhs, *Rhs) != 0;
1066 }
1067
1068 /** Get the length of the string, excluding terminating character */
1069 FORCEINLINE int32 Len() const
1070 {
1071 return Data.Num() ? Data.Num() - 1 : 0;
1072 }
1073
1074 /** @return the left most given number of characters */
1075 FORCEINLINE FString Left(int32 Count) const
1076 {
1077 return FString(FMath::Clamp(Count, 0, Len()), **this);
1078 }
1079
1080 /** @return the left most characters from the string chopping the given number of characters from the end */
1081 FORCEINLINE FString LeftChop(int32 Count) const
1082 {
1083 return FString(FMath::Clamp(Len() - Count, 0, Len()), **this);
1084 }
1085
1086 /** @return the string to the right of the specified location, counting back from the right (end of the word). */
1087 FORCEINLINE FString Right(int32 Count) const
1088 {
1089 return FString(**this + Len() - FMath::Clamp(Count, 0, Len()));
1090 }
1091
1092 /** @return the string to the right of the specified location, counting forward from the left (from the beginning of the word). */
1093 FORCEINLINE FString RightChop(int32 Count) const
1094 {
1095 return FString(**this + Len() - FMath::Clamp(Len() - Count, 0, Len()));
1096 }
1097
1098 /** @return the substring from Start position for Count characters. */
1099 FORCEINLINE FString Mid(int32 Start, int32 Count = INT_MAX) const
1100 {
1101 uint32 End = Start + Count;
1102 Start = FMath::Clamp((uint32)Start, (uint32)0, (uint32)Len());
1103 End = FMath::Clamp((uint32)End, (uint32)Start, (uint32)Len());
1104 return FString(End - Start, **this + Start);
1105 }
1106
1107 /**
1108 * Searches the string for a substring, and returns index into this string
1109 * of the first found instance. Can search from beginning or end, and ignore case or not.
1110 *
1111 * @param SubStr The string array of TCHAR to search for
1112 * @param StartPosition The start character position to search from
1113 * @param SearchCase Indicates whether the search is case sensitive or not
1114 * @param SearchDir Indicates whether the search starts at the begining or at the end.
1115 */
1116 int32 Find(const TCHAR* SubStr, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase,
1117 ESearchDir::Type SearchDir = ESearchDir::FromStart, int32 StartPosition = INDEX_NONE) const;
1118
1119 /**
1120 * Searches the string for a substring, and returns index into this string
1121 * of the first found instance. Can search from beginning or end, and ignore case or not.
1122 *
1123 * @param SubStr The string to search for
1124 * @param StartPosition The start character position to search from
1125 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1126 * @param SearchDir Indicates whether the search starts at the begining or at the end ( defaults to ESearchDir::FromStart )
1127 */
1128 FORCEINLINE int32 Find(const FString& SubStr, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase,
1129 ESearchDir::Type SearchDir = ESearchDir::FromStart, int32 StartPosition = INDEX_NONE) const
1130 {
1131 return Find(*SubStr, SearchCase, SearchDir, StartPosition);
1132 }
1133
1134 /**
1135 * Returns whether this string contains the specified substring.
1136 *
1137 * @param SubStr Find to search for
1138 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1139 * @param SearchDir Indicates whether the search starts at the begining or at the end ( defaults to ESearchDir::FromStart )
1140 * @return Returns whether the string contains the substring
1141 **/
1142 FORCEINLINE bool Contains(const TCHAR* SubStr, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase,
1143 ESearchDir::Type SearchDir = ESearchDir::FromStart) const
1144 {
1145 return Find(SubStr, SearchCase, SearchDir) != INDEX_NONE;
1146 }
1147
1148 /**
1149 * Returns whether this string contains the specified substring.
1150 *
1151 * @param SubStr Find to search for
1152 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1153 * @param SearchDir Indicates whether the search starts at the begining or at the end ( defaults to ESearchDir::FromStart )
1154 * @return Returns whether the string contains the substring
1155 **/
1156 FORCEINLINE bool Contains(const FString& SubStr, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase,
1157 ESearchDir::Type SearchDir = ESearchDir::FromStart) const
1158 {
1159 return Find(*SubStr, SearchCase, SearchDir) != INDEX_NONE;
1160 }
1161
1162 /**
1163 * Searches the string for a character
1164 *
1165 * @param InChar the character to search for
1166 * @param Index out the position the character was found at, INDEX_NONE if return is false
1167 * @return true if character was found in this string, otherwise false
1168 */
1169 FORCEINLINE bool FindChar(TCHAR InChar, int32& Index) const
1170 {
1171 return Data.Find(InChar, Index);
1172 }
1173
1174 /**
1175 * Searches the string for the last occurrence of a character
1176 *
1177 * @param InChar the character to search for
1178 * @param Index out the position the character was found at, INDEX_NONE if return is false
1179 * @return true if character was found in this string, otherwise false
1180 */
1181 FORCEINLINE bool FindLastChar(TCHAR InChar, int32& Index) const
1182 {
1183 return Data.FindLast(InChar, Index);
1184 }
1185
1186 /**
1187 * Searches an initial substring for the last occurrence of a character which matches the specified predicate.
1188 *
1189 * @param Pred Predicate that takes TCHAR and returns true if TCHAR matches search criteria, false otherwise.
1190 * @param Count The number of characters from the front of the string through which to search.
1191 *
1192 * @return Index of found TCHAR, INDEX_NONE otherwise.
1193 */
1194 template <typename Predicate>
1195 FORCEINLINE int32 FindLastCharByPredicate(Predicate Pred, int32 Count) const
1196 {
1198 }
1199
1200 /**
1201 * Searches the string for the last occurrence of a character which matches the specified predicate.
1202 *
1203 * @param Pred Predicate that takes TCHAR and returns true if TCHAR matches search criteria, false otherwise.
1204 * @param StartIndex Index of element from which to start searching. Defaults to last TCHAR in string.
1205 *
1206 * @return Index of found TCHAR, INDEX_NONE otherwise.
1207 */
1208 template <typename Predicate>
1209 FORCEINLINE int32 FindLastCharByPredicate(Predicate Pred) const
1210 {
1211 return Data.FindLastByPredicate(Pred, this->Len());
1212 }
1213
1214 /**
1215 * Lexicographically tests whether this string is equivalent to the Other given string
1216 *
1217 * @param Other The string test against
1218 * @param SearchCase Whether or not the comparison should ignore case
1219 * @return true if this string is lexicographically equivalent to the other, otherwise false
1220 */
1221 FORCEINLINE bool Equals(const FString& Other, ESearchCase::Type SearchCase = ESearchCase::CaseSensitive) const
1222 {
1223 if (SearchCase == ESearchCase::CaseSensitive)
1224 {
1225 return FCString::Strcmp(**this, *Other) == 0;
1226 }
1227 else
1228 {
1229 return FCString::Stricmp(**this, *Other) == 0;
1230 }
1231 }
1232
1233 /**
1234 * Lexicographically tests how this string compares to the Other given string
1235 *
1236 * @param Other The string test against
1237 * @param SearchCase Whether or not the comparison should ignore case
1238 * @return 0 if equal, negative if less than, positive if greater than
1239 */
1240 FORCEINLINE int32 Compare(const FString& Other, ESearchCase::Type SearchCase = ESearchCase::CaseSensitive) const
1241 {
1242 if (SearchCase == ESearchCase::CaseSensitive)
1243 {
1244 return FCString::Strcmp(**this, *Other);
1245 }
1246 else
1247 {
1248 return FCString::Stricmp(**this, *Other);
1249 }
1250 }
1251
1252 /**
1253 * Splits this string at given string position case sensitive.
1254 *
1255 * @param InStr The string to search and split at
1256 * @param LeftS out the string to the left of InStr, not updated if return is false
1257 * @param RightS out the string to the right of InStr, not updated if return is false
1258 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1259 * @param SearchDir Indicates whether the search starts at the begining or at the end ( defaults to ESearchDir::FromStart )
1260 * @return true if string is split, otherwise false
1261 */
1262 bool Split(const FString& InS, FString* LeftS, FString* RightS, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase,
1263 ESearchDir::Type SearchDir = ESearchDir::FromStart) const
1264 {
1265 int32 InPos = Find(InS, SearchCase, SearchDir);
1266
1267 if (InPos < 0) { return false; }
1268
1269 if (LeftS) { *LeftS = Left(InPos); }
1270 if (RightS) { *RightS = Mid(InPos + InS.Len()); }
1271
1272 return true;
1273 }
1274
1275 /** @return a new string with the characters of this converted to uppercase */
1276 FString ToUpper() const &;
1277
1278 /**
1279 * Converts all characters in this rvalue string to uppercase and moves it into the returned string.
1280 * @return a new string with the characters of this converted to uppercase
1281 */
1282 FString ToUpper() && ;
1283
1284 /** Converts all characters in this string to uppercase */
1285 void ToUpperInline();
1286
1287 /** @return a new string with the characters of this converted to lowercase */
1288 FString ToLower() const &;
1289
1290 /**
1291 * Converts all characters in this rvalue string to lowercase and moves it into the returned string.
1292 * @return a new string with the characters of this converted to lowercase
1293 */
1294 FString ToLower() && ;
1295
1296 /** Converts all characters in this string to lowercase */
1297 void ToLowerInline();
1298
1299 /** Pad the left of this string for ChCount characters */
1300 FString LeftPad(int32 ChCount) const;
1301
1302 /** Pad the right of this string for ChCount characters */
1303 FString RightPad(int32 ChCount) const;
1304
1305 /** @return true if the string only contains numeric characters */
1306 bool IsNumeric() const;
1307
1308 // @return string with Ch character
1309 static FString Chr(TCHAR Ch);
1310
1311 /**
1312 * Returns a string that is full of a variable number of characters
1313 *
1314 * @param NumCharacters Number of characters to put into the string
1315 * @param Char Character to put into the string
1316 *
1317 * @return The string of NumCharacters characters.
1318 */
1319 static FString ChrN(int32 NumCharacters, TCHAR Char);
1320
1321 /**
1322 * Test whether this string starts with given string.
1323 *
1324 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1325 * @return true if this string begins with specified text, false otherwise
1326 */
1327 bool StartsWith(const TCHAR* InSuffix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1328
1329 /**
1330 * Test whether this string starts with given string.
1331 *
1332 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1333 * @return true if this string begins with specified text, false otherwise
1334 */
1335 bool StartsWith(const FString& InPrefix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1336
1337 /**
1338 * Test whether this string ends with given string.
1339 *
1340 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1341 * @return true if this string ends with specified text, false otherwise
1342 */
1343 bool EndsWith(const TCHAR* InSuffix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1344
1345 /**
1346 * Test whether this string ends with given string.
1347 *
1348 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1349 * @return true if this string ends with specified text, false otherwise
1350 */
1351 bool EndsWith(const FString& InSuffix, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1352
1353 /**
1354 * Searches this string for a given wild card
1355 *
1356 * @param Wildcard *?-type wildcard
1357 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1358 * @return true if this string matches the *?-type wildcard given.
1359 * @warning This is a simple, SLOW routine. Use with caution
1360 */
1361 bool MatchesWildcard(const FString& Wildcard, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1362
1363 /**
1364 * Removes whitespace characters from the start and end of this string. Modifies the string in-place.
1365 */
1366 void TrimStartAndEndInline();
1367
1368 /**
1369 * Removes whitespace characters from the start and end of this string.
1370 * @note Unlike Trim() this function returns a copy, and does not mutate the string.
1371 */
1372 FString TrimStartAndEnd() const &;
1373
1374 /**
1375 * Removes whitespace characters from the start and end of this string.
1376 * @note Unlike Trim() this function returns a copy, and does not mutate the string.
1377 */
1379
1380 /**
1381 * Removes whitespace characters from the start of this string. Modifies the string in-place.
1382 */
1383 void TrimStartInline();
1384
1385 /**
1386 * Removes whitespace characters from the start of this string.
1387 * @note Unlike Trim() this function returns a copy, and does not mutate the string.
1388 */
1389 FString TrimStart() const &;
1390
1391 /**
1392 * Removes whitespace characters from the start of this string.
1393 * @note Unlike Trim() this function returns a copy, and does not mutate the string.
1394 */
1395 FString TrimStart() && ;
1396
1397 /**
1398 * Removes whitespace characters from the end of this string. Modifies the string in-place.
1399 */
1400 void TrimEndInline();
1401
1402 /**
1403 * Removes whitespace characters from the end of this string.
1404 * @note Unlike TrimTrailing() this function returns a copy, and does not mutate the string.
1405 */
1406 FString TrimEnd() const &;
1407
1408 /**
1409 * Removes whitespace characters from the end of this string.
1410 * @note Unlike TrimTrailing() this function returns a copy, and does not mutate the string.
1411 */
1412 FString TrimEnd() && ;
1413
1414 /**
1415 * Trims the inner array after the null terminator.
1416 */
1417 void TrimToNullTerminator();
1418
1419 /**
1420 * Returns a copy of this string with wrapping quotation marks removed.
1421 */
1422 FString TrimQuotes(bool* bQuotesRemoved = nullptr) const;
1423
1424 /**
1425 * Breaks up a delimited string into elements of a string array.
1426 *
1427 * @param InArray The array to fill with the string pieces
1428 * @param pchDelim The string to delimit on
1429 * @param InCullEmpty If 1, empty strings are not added to the array
1430 *
1431 * @return The number of elements in InArray
1432 */
1433 int32 ParseIntoArray(TArray<FString>& OutArray, const TCHAR* pchDelim, bool InCullEmpty = true) const;
1434
1435 /**
1436 * Breaks up a delimited string into elements of a string array, using any whitespace and an
1437 * optional extra delimter, like a ","
1438 * @warning Caution!! this routine is O(N^2) allocations...use it for parsing very short text or not at all!
1439 *
1440 * @param InArray The array to fill with the string pieces
1441 * @param pchExtraDelim The string to delimit on
1442 *
1443 * @return The number of elements in InArray
1444 */
1445 int32 ParseIntoArrayWS(TArray<FString>& OutArray, const TCHAR* pchExtraDelim = nullptr, bool InCullEmpty = true) const;
1446
1447 /**
1448 * Breaks up a delimited string into elements of a string array, using line ending characters
1449 * @warning Caution!! this routine is O(N^2) allocations...use it for parsing very short text or not at all!
1450 *
1451 * @param InArray The array to fill with the string pieces
1452 *
1453 * @return The number of elements in InArray
1454 */
1455 int32 ParseIntoArrayLines(TArray<FString>& OutArray, bool InCullEmpty = true) const;
1456
1457 /**
1458 * Breaks up a delimited string into elements of a string array, using the given delimiters
1459 * @warning Caution!! this routine is O(N^2) allocations...use it for parsing very short text or not at all!
1460 *
1461 * @param InArray The array to fill with the string pieces
1462 * @param DelimArray The strings to delimit on
1463 * @param NumDelims The number of delimiters.
1464 *
1465 * @return The number of elements in InArray
1466 */
1467 int32 ParseIntoArray(TArray<FString>& OutArray, const TCHAR** DelimArray, int32 NumDelims, bool InCullEmpty = true) const;
1468
1469 /**
1470 * Takes an array of strings and removes any zero length entries.
1471 *
1472 * @param InArray The array to cull
1473 *
1474 * @return The number of elements left in InArray
1475 */
1476 static int32 CullArray(TArray<FString>* InArray);
1477
1478 /**
1479 * Returns a copy of this string, with the characters in reverse order
1480 */
1481 FString Reverse() const;
1482
1483 /**
1484 * Reverses the order of characters in this string
1485 */
1486 void ReverseString();
1487
1488 /**
1489 * Replace all occurrences of a substring in this string
1490 *
1491 * @param From substring to replace
1492 * @param To substring to replace From with
1493 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1494 * @return a copy of this string with the replacement made
1495 */
1496 FString Replace(const TCHAR* From, const TCHAR* To, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase) const;
1497
1498 /**
1499 * Replace all occurrences of SearchText with ReplacementText in this string.
1500 *
1501 * @param SearchText the text that should be removed from this string
1502 * @param ReplacementText the text to insert in its place
1503 * @param SearchCase Indicates whether the search is case sensitive or not ( defaults to ESearchCase::IgnoreCase )
1504 *
1505 * @return the number of occurrences of SearchText that were replaced.
1506 */
1507 int32 ReplaceInline(const TCHAR* SearchText, const TCHAR* ReplacementText, ESearchCase::Type SearchCase = ESearchCase::IgnoreCase);
1508
1509 /**
1510 * Returns a copy of this string with all quote marks escaped (unless the quote is already escaped)
1511 */
1513
1514 /**
1515 * Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\\n").
1516 * The characters supported are: { \n, \r, \t, \', \", \\ }.
1517 *
1518 * @param Chars by default, replaces all supported characters; this parameter allows you to limit the replacement to a subset.
1519 *
1520 * @return a string with all control characters replaced by the escaped version.
1521 */
1522 FString ReplaceCharWithEscapedChar(const TArray<TCHAR>* Chars = nullptr) const;
1523
1524 /**
1525 * Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version. (i.e.
1526 * replaces "\\n" with "\n". Counterpart to ReplaceCharWithEscapedChar().
1527 * @return copy of this string with replacement made
1528 */
1529 FString ReplaceEscapedCharWithChar(const TArray<TCHAR>* Chars = nullptr) const;
1530
1531 /**
1532 * Replaces all instances of '\t' with TabWidth number of spaces
1533 * @param InSpacesPerTab - Number of spaces that a tab represents
1534 * @return copy of this string with replacement made
1535 */
1536 FString ConvertTabsToSpaces(const int32 InSpacesPerTab);
1537
1538 // Takes the number passed in and formats the string in comma format ( 12345 becomes "12,345")
1539 static FString FormatAsNumber(int32 InNumber);
1540
1541 // To allow more efficient memory handling, automatically adds one for the string termination.
1542 FORCEINLINE void Reserve(const uint32 CharacterCount)
1543 {
1544 Data.Reserve(CharacterCount + 1);
1545 }
1546
1547 /** Converts an integer to a string. */
1548 static FORCEINLINE FString FromInt(int32 Num)
1549 {
1550 FString Ret;
1551 Ret.AppendInt(Num);
1552 return Ret;
1553 }
1554
1555 /** appends the integer InNum to this string */
1556 void AppendInt(int32 InNum);
1557
1558 /**
1559 * Converts a string into a buffer
1560 *
1561 * @param DestBuffer the buffer to fill with the string data
1562 * @param DestSize the size of the buffer in bytes (must be at least string len / 3)
1563 *
1564 * @return true if the conversion happened, false otherwise
1565 */
1566 static bool ToBlob(const FString& Source, uint8* DestBuffer, const uint32 DestSize);
1567
1568 /**
1569 * Converts a string into a buffer
1570 *
1571 * @param DestBuffer the buffer to fill with the string data
1572 * @param DestSize the size of the buffer in bytes (must be at least string len / 2)
1573 *
1574 * @return true if the conversion happened, false otherwise
1575 */
1576 static bool ToHexBlob(const FString& Source, uint8* DestBuffer, const uint32 DestSize);
1577
1578 /**
1579 * Joins an array of 'something that can be concatentated to strings with +=' together into a single string with separators.
1580 *
1581 * @param Array The array of 'things' to concatenate.
1582 * @param Separator The string used to separate each element.
1583 *
1584 * @return The final, joined, separated string.
1585 */
1586 template <typename T, typename Allocator>
1587 static FString Join(const TArray<T, Allocator>& Array, const TCHAR* Separator)
1588 {
1590 bool First = true;
1591 for (const T& Element : Array)
1592 {
1593 if (First)
1594 {
1595 First = false;
1596 }
1597 else
1598 {
1599 Result += Separator;
1600 }
1601
1602 Result += Element;
1603 }
1604
1605 return Result;
1606 }
1607
1608 /**
1609 * \brief Convert FString to std::string
1610 */
1612 {
1613 TCHAR* data = Data.GetData();
1614
1615 if (!data)
1616 return "";
1617
1618 int size_needed = WideCharToMultiByte(CP_UTF8, 0, &data[0], (int)Len(), NULL, 0, NULL, NULL);
1619 std::string str(size_needed, 0);
1620 WideCharToMultiByte(CP_UTF8, 0, &data[0], (int)Len(), &str[0], size_needed, NULL, NULL);
1621 return str;
1622 }
1623
1624 /**
1625 * \brief Formats text using fmt::format
1626 * \tparam T Either a a char or wchar_t
1627 * \tparam Args Optional arguments types
1628 * \param format Message
1629 * \param args Optional arguments
1630 * \return Formatted text
1631 */
1632 template <typename T, typename... Args>
1633 static FString Format(const T* format, Args&&... args)
1634 {
1635 if constexpr (!TIsCharType<T>::Value)
1636 static_assert(TIsCharType<T>::Value, "format must be a char or wchar_t");
1637
1639
1640 return FString(formatted_msg.c_str());
1641 }
1642
1643
1644};
1645
1646FORCEINLINE uint32 GetTypeHash(const FString& Thing)
1647{
1648 uint32 Hash = FCrc::MemCrc32(&Thing, sizeof(FString));
1649 return Hash;
1650}
1651
1652template<>
1654{
1655 enum { MoveWillEmptyContainer = TContainerTraits<FString::DataType>::MoveWillEmptyContainer };
1656};
1657
1658template<> struct TIsZeroConstructType<FString> { enum { Value = true }; };
1660
1661template <>
1663{
1664 enum { Value = true };
1665};
1666
1667inline TCHAR* GetData(FString& String)
1668{
1669 return String.GetCharArray().GetData();
1670}
1671
1672inline const TCHAR* GetData(const FString& String)
1673{
1674 return String.GetCharArray().GetData();
1675}
1676
1677inline SIZE_T GetNum(const FString& String)
1678{
1679 return String.GetCharArray().Num();
1680}
1681
1682/**
1683* Convert an array of bytes to a TCHAR
1684* @param In byte array values to convert
1685* @param Count number of bytes to convert
1686* @return Valid string representing bytes.
1687*/
1688inline FString BytesToString(const uint8* In, int32 Count)
1689{
1690 FString Result;
1691 Result.Empty(Count);
1692
1693 while (Count)
1694 {
1695 // Put the byte into an int16 and add 1 to it, this keeps anything from being put into the string as a null terminator
1696 int16 Value = *In;
1697 Value += 1;
1698
1699 Result += TCHAR(Value);
1700
1701 ++In;
1702 Count--;
1703 }
1704 return Result;
1705}
1706
1707/**
1708* Convert FString of bytes into the byte array.
1709* @param String The FString of byte values
1710* @param OutBytes Ptr to memory must be preallocated large enough
1711* @param MaxBufferSize Max buffer size of the OutBytes array, to prevent overflow
1712* @return The number of bytes copied
1713*/
1714inline int32 StringToBytes(const FString& String, uint8* OutBytes, int32 MaxBufferSize)
1715{
1716 int32 NumBytes = 0;
1717 const TCHAR* CharPos = *String;
1718
1719 while (*CharPos && NumBytes < MaxBufferSize)
1720 {
1721 OutBytes[NumBytes] = (int8)(*CharPos - 1);
1722 CharPos++;
1723 ++NumBytes;
1724 }
1725 return NumBytes - 1;
1726}
1727
1728/** @return Char value of Nibble */
1729inline TCHAR NibbleToTChar(uint8 Num)
1730{
1731 if (Num > 9)
1732 {
1733 return TEXT('A') + TCHAR(Num - 10);
1734 }
1735 return TEXT('0') + TCHAR(Num);
1736}
1737
1738/**
1739* Convert a byte to hex
1740* @param In byte value to convert
1741* @param Result out hex value output
1742*/
1743inline void ByteToHex(uint8 In, FString& Result)
1744{
1745 Result += NibbleToTChar(In >> 4);
1746 Result += NibbleToTChar(In & 15);
1747}
1748
1749/**
1750* Convert an array of bytes to hex
1751* @param In byte array values to convert
1752* @param Count number of bytes to convert
1753* @return Hex value in string.
1754*/
1755inline FString BytesToHex(const uint8* In, int32 Count)
1756{
1757 FString Result;
1758 Result.Empty(Count * 2);
1759
1760 while (Count)
1761 {
1762 ByteToHex(*In++, Result);
1763 Count--;
1764 }
1765 return Result;
1766}
1767
1768/**
1769* Checks if the TChar is a valid hex character
1770* @param Char The character
1771* @return True if in 0-9 and A-F ranges
1772*/
1773inline const bool CheckTCharIsHex(const TCHAR Char)
1774{
1775 return (Char >= TEXT('0') && Char <= TEXT('9')) || (Char >= TEXT('A') && Char <= TEXT('F')) || (Char >= TEXT('a') && Char <= TEXT('f'));
1776}
1777
1778/**
1779* Convert a TChar to equivalent hex value as a uint8
1780* @param Char The character
1781* @return The uint8 value of a hex character
1782*/
1783inline const uint8 TCharToNibble(const TCHAR Char)
1784{
1785 check(CheckTCharIsHex(Char));
1786 if (Char >= TEXT('0') && Char <= TEXT('9'))
1787 {
1788 return Char - TEXT('0');
1789 }
1790 else if (Char >= TEXT('A') && Char <= TEXT('F'))
1791 {
1792 return (Char - TEXT('A')) + 10;
1793 }
1794 return (Char - TEXT('a')) + 10;
1795}
1796
1797/**
1798* Convert FString of Hex digits into the byte array.
1799* @param HexString The FString of Hex values
1800* @param OutBytes Ptr to memory must be preallocated large enough
1801* @return The number of bytes copied
1802*/
1803inline int32 HexToBytes(const FString& HexString, uint8* OutBytes)
1804{
1805 int32 NumBytes = 0;
1806 const bool bPadNibble = (HexString.Len() % 2) == 1;
1807 const TCHAR* CharPos = *HexString;
1808 if (bPadNibble)
1809 {
1810 OutBytes[NumBytes++] = TCharToNibble(*CharPos++);
1811 }
1812 while (*CharPos)
1813 {
1814 OutBytes[NumBytes] = TCharToNibble(*CharPos++) << 4;
1815 OutBytes[NumBytes] += TCharToNibble(*CharPos++);
1816 ++NumBytes;
1817 }
1818 return NumBytes;
1819}
1820
1821/** Namespace that houses lexical conversion for various types. User defined conversions can be implemented externally */
1822namespace Lex
1823{
1824 /**
1825 * Expected functions in this namespace are as follows:
1826 * bool TryParseString(T& OutValue, const TCHAR* Buffer);
1827 * void FromString(T& OutValue, const TCHAR* Buffer);
1828 * <implicitly convertible to string> ToString(T);
1829 * ^-- Generally this means it can return either FString or const TCHAR*
1830 * Generic code that uses ToString should assign to an FString or forward along to other functions
1831 * that accept types that are also implicitly convertible to FString
1832 *
1833 * Implement custom functionality externally.
1834 */
1835
1836 /** Covert a string buffer to intrinsic types */
1837 inline void FromString(int8& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi(Buffer); }
1838 inline void FromString(int16& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi(Buffer); }
1839 inline void FromString(int32& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi(Buffer); }
1840 inline void FromString(int64& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi64(Buffer); }
1841 inline void FromString(uint8& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi(Buffer); }
1842 inline void FromString(uint16& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi(Buffer); }
1843 inline void FromString(uint32& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atoi64(Buffer); } //64 because this unsigned and so Atoi might overflow
1844 inline void FromString(uint64& OutValue, const TCHAR* Buffer) { OutValue = FCString::Strtoui64(Buffer, nullptr, 0); }
1845 inline void FromString(float& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atof(Buffer); }
1846 inline void FromString(double& OutValue, const TCHAR* Buffer) { OutValue = FCString::Atod(Buffer); }
1847 inline void FromString(FString& OutValue, const TCHAR* Buffer) { OutValue = Buffer; }
1848
1849 template<typename CharType>
1850 typename TEnableIf<TIsCharType<CharType>::Value, FString>::Type
1851 ToString(const CharType* Ptr)
1852 {
1853 return FString(Ptr);
1854 }
1855
1856 inline FString ToString(bool Value)
1857 {
1858 return Value ? TEXT("true") : TEXT("false");
1859 }
1860
1861 FORCEINLINE FString ToString(FString&& Str)
1862 {
1863 return MoveTemp(Str);
1864 }
1865
1866 FORCEINLINE FString ToString(const FString& Str)
1867 {
1868 return Str;
1869 }
1870
1871 /** Helper template to convert to sanitized strings */
1872 template<typename T>
1874 {
1875 return ToString(Value);
1876 }
1877
1878 /** Parse a string into this type, returning whether it was successful */
1879 /** Specialization for arithmetic types */
1880 template<typename T>
1881 static typename TEnableIf<TIsArithmetic<T>::Value, bool>::Type
1882 TryParseString(T& OutValue, const TCHAR* Buffer)
1883 {
1885 {
1887 return true;
1888 }
1889 return false;
1890 }
1891}
1892
1893// Deprecated alias for old LexicalConversion namespace.
1894// Namespace alias deprecation doesn't work on our compilers, so we can't actually mark it with the DEPRECATED() macro.
1895namespace LexicalConversion = Lex;
1896
1897/** Shorthand legacy use for Lex functions */
1898template<typename T>
1900{
1901 static FString ToString(const T& Value) { return Lex::ToString(Value); }
1902 static FString ToSanitizedString(const T& Value) { return Lex::ToSanitizedString(Value); }
1903};
1904template<typename T>
1906{
1907 static void FromString(T& Value, const TCHAR* Buffer) { return Lex::FromString(Value, Buffer); }
1908};
1909
1910
1911/* FString implementation
1912*****************************************************************************/
1913
1915{
1917 {
1918 static FORCEINLINE bool Compare(TCHAR Lhs, TCHAR Rhs)
1919 {
1920 return Lhs == Rhs;
1921 }
1922 };
1923
1925 {
1926 static FORCEINLINE bool Compare(TCHAR Lhs, TCHAR Rhs)
1927 {
1928 return FChar::ToLower(Lhs) == FChar::ToLower(Rhs);
1929 }
1930 };
1931
1932 template <typename CompareType>
1933 bool MatchesWildcardRecursive(const TCHAR* Target, int32 TargetLength, const TCHAR* Wildcard, int32 WildcardLength)
1934 {
1935 // Skip over common initial non-wildcard-char sequence of Target and Wildcard
1936 for (;;)
1937 {
1938 TCHAR WCh = *Wildcard;
1939 if (WCh == TEXT('*') || WCh == TEXT('?'))
1940 {
1941 break;
1942 }
1943
1944 if (!CompareType::Compare(*Target, WCh))
1945 {
1946 return false;
1947 }
1948
1949 if (WCh == TEXT('\0'))
1950 {
1951 return true;
1952 }
1953
1954 ++Target;
1955 ++Wildcard;
1956 --TargetLength;
1958 }
1959
1960 // Test for common suffix
1961 const TCHAR* TPtr = Target + TargetLength;
1962 const TCHAR* WPtr = Wildcard + WildcardLength;
1963 for (;;)
1964 {
1965 --TPtr;
1966 --WPtr;
1967
1968 TCHAR WCh = *WPtr;
1969 if (WCh == TEXT('*') || WCh == TEXT('?'))
1970 {
1971 break;
1972 }
1973
1974 if (!CompareType::Compare(*TPtr, WCh))
1975 {
1976 return false;
1977 }
1978
1979 --TargetLength;
1980 if (TargetLength == 0)
1981 {
1982 return false;
1983 }
1984
1986 }
1987
1988 // Match * against anything and ? against single (and zero?) chars
1990 if (WildcardLength == 1 && (FirstWild == TEXT('*') || TargetLength < 2))
1991 {
1992 return true;
1993 }
1994 ++Wildcard;
1996
1997 // This routine is very slow, though it does ok with one wildcard
1999 if (FirstWild == TEXT('?') && MaxNum > 1)
2000 {
2001 MaxNum = 1;
2002 }
2003
2004 for (int32 Index = 0; Index <= MaxNum; ++Index)
2005 {
2007 {
2008 return true;
2009 }
2010 }
2011 return false;
2012 }
2013}
2014
2016{
2017 if (Data.Num())
2018 {
2019 int32 DataLen = FCString::Strlen(Data.GetData());
2020 int32 Len = DataLen > 0 ? DataLen + 1 : 0;
2021
2022 Data.RemoveAt(Len, Data.Num() - Len);
2023 }
2024}
2025
2026
2027inline int32 FString::Find(const TCHAR* SubStr, ESearchCase::Type SearchCase, ESearchDir::Type SearchDir, int32 StartPosition) const
2028{
2029 if (SubStr == nullptr)
2030 {
2031 return INDEX_NONE;
2032 }
2033 if (SearchDir == ESearchDir::FromStart)
2034 {
2035 const TCHAR* Start = **this;
2036 if (StartPosition != INDEX_NONE)
2037 {
2038 Start += FMath::Clamp(StartPosition, 0, Len() - 1);
2039 }
2040 const TCHAR* Tmp = SearchCase == ESearchCase::IgnoreCase
2041 ? FCString::Stristr(Start, SubStr)
2042 : FCString::Strstr(Start, SubStr);
2043
2044 return Tmp ? (Tmp - **this) : INDEX_NONE;
2045 }
2046 else
2047 {
2048 // if ignoring, do a onetime ToUpper on both strings, to avoid ToUppering multiple
2049 // times in the loop below
2050 if (SearchCase == ESearchCase::IgnoreCase)
2051 {
2052 return ToUpper().Find(FString(SubStr).ToUpper(), ESearchCase::CaseSensitive, SearchDir, StartPosition);
2053 }
2054 else
2055 {
2056 const int32 SearchStringLength = FMath::Max(1, FCString::Strlen(SubStr));
2057
2058 if (StartPosition == INDEX_NONE || StartPosition >= Len())
2059 {
2060 StartPosition = Len();
2061 }
2062
2063 for (int32 i = StartPosition - SearchStringLength; i >= 0; i--)
2064 {
2065 int32 j;
2066 for (j = 0; SubStr[j]; j++)
2067 {
2068 if ((*this)[i + j] != SubStr[j])
2069 {
2070 break;
2071 }
2072 }
2073
2074 if (!SubStr[j])
2075 {
2076 return i;
2077 }
2078 }
2079 return INDEX_NONE;
2080 }
2081 }
2082}
2083
2084inline FString FString::ToUpper() const &
2085{
2086 FString New = *this;
2088 return New;
2089}
2090
2092{
2094 return MoveTemp(*this);
2095}
2096
2098{
2099 const int32 StringLength = Len();
2100 TCHAR* RawData = Data.GetData();
2101 for (int32 i = 0; i < StringLength; ++i)
2102 {
2103 RawData[i] = FChar::ToUpper(RawData[i]);
2104 }
2105}
2106
2107
2108inline FString FString::ToLower() const &
2109{
2110 FString New = *this;
2112 return New;
2113}
2114
2116{
2118 return MoveTemp(*this);
2119}
2120
2122{
2123 const int32 StringLength = Len();
2124 TCHAR* RawData = Data.GetData();
2125 for (int32 i = 0; i < StringLength; ++i)
2126 {
2127 RawData[i] = FChar::ToLower(RawData[i]);
2128 }
2129}
2130
2131inline bool FString::StartsWith(const TCHAR* InPrefix, ESearchCase::Type SearchCase) const
2132{
2133 if (SearchCase == ESearchCase::IgnoreCase)
2134 {
2135 return InPrefix && *InPrefix && !FCString::Strnicmp(**this, InPrefix, FCString::Strlen(InPrefix));
2136 }
2137 else
2138 {
2139 return InPrefix && *InPrefix && !FCString::Strncmp(**this, InPrefix, FCString::Strlen(InPrefix));
2140 }
2141}
2142
2143inline bool FString::StartsWith(const FString& InPrefix, ESearchCase::Type SearchCase) const
2144{
2145 if (SearchCase == ESearchCase::IgnoreCase)
2146 {
2147 return InPrefix.Len() > 0 && !FCString::Strnicmp(**this, *InPrefix, InPrefix.Len());
2148 }
2149 else
2150 {
2151 return InPrefix.Len() > 0 && !FCString::Strncmp(**this, *InPrefix, InPrefix.Len());
2152 }
2153}
2154
2155inline bool FString::EndsWith(const TCHAR* InSuffix, ESearchCase::Type SearchCase) const
2156{
2157 if (!InSuffix || *InSuffix == TEXT('\0'))
2158 {
2159 return false;
2160 }
2161
2162 int32 ThisLen = this->Len();
2163 int32 SuffixLen = FCString::Strlen(InSuffix);
2164 if (SuffixLen > ThisLen)
2165 {
2166 return false;
2167 }
2168
2169 const TCHAR* StrPtr = Data.GetData() + ThisLen - SuffixLen;
2170 if (SearchCase == ESearchCase::IgnoreCase)
2171 {
2172 return !FCString::Stricmp(StrPtr, InSuffix);
2173 }
2174 else
2175 {
2176 return !FCString::Strcmp(StrPtr, InSuffix);
2177 }
2178}
2179
2180inline bool FString::EndsWith(const FString& InSuffix, ESearchCase::Type SearchCase) const
2181{
2182 if (SearchCase == ESearchCase::IgnoreCase)
2183 {
2184 return InSuffix.Len() > 0 &&
2185 Len() >= InSuffix.Len() &&
2186 !FCString::Stricmp(&(*this)[Len() - InSuffix.Len()], *InSuffix);
2187 }
2188 else
2189 {
2190 return InSuffix.Len() > 0 &&
2191 Len() >= InSuffix.Len() &&
2192 !FCString::Strcmp(&(*this)[Len() - InSuffix.Len()], *InSuffix);
2193 }
2194}
2195
2196inline bool FString::RemoveFromStart(const FString& InPrefix, ESearchCase::Type SearchCase)
2197{
2198 if (InPrefix.IsEmpty())
2199 {
2200 return false;
2201 }
2202
2203 if (StartsWith(InPrefix, SearchCase))
2204 {
2205 RemoveAt(0, InPrefix.Len());
2206 return true;
2207 }
2208
2209 return false;
2210}
2211
2212inline bool FString::RemoveFromEnd(const FString& InSuffix, ESearchCase::Type SearchCase)
2213{
2214 if (InSuffix.IsEmpty())
2215 {
2216 return false;
2217 }
2218
2219 if (EndsWith(InSuffix, SearchCase))
2220 {
2221 RemoveAt(Len() - InSuffix.Len(), InSuffix.Len());
2222 return true;
2223 }
2224
2225 return false;
2226}
2227
2228/**
2229* Concatenate this path with given path ensuring the / character is used between them
2230*
2231* @param Str Pointer to an array of TCHARs (not necessarily null-terminated) to be concatenated onto the end of this.
2232* @param StrLength Exact number of characters from Str to append.
2233*/
2234inline void FString::PathAppend(const TCHAR* Str, int32 StrLength)
2235{
2236 int32 DataNum = Data.Num();
2237 if (StrLength == 0)
2238 {
2239 if (DataNum > 1 && Data[DataNum - 2] != TEXT('/') && Data[DataNum - 2] != TEXT('\\'))
2240 {
2241 Data[DataNum - 1] = TEXT('/');
2242 Data.Add(TEXT('\0'));
2243 }
2244 }
2245 else
2246 {
2247 if (DataNum > 0)
2248 {
2249 if (DataNum > 1 && Data[DataNum - 2] != TEXT('/') && Data[DataNum - 2] != TEXT('\\') && *Str != TEXT('/'))
2250 {
2251 Data[DataNum - 1] = TEXT('/');
2252 }
2253 else
2254 {
2255 Data.Pop(false);
2256 --DataNum;
2257 }
2258 }
2259
2260 Data.Reserve(DataNum + StrLength + 1);
2261 Data.Append(Str, StrLength);
2262 Data.Add(TEXT('\0'));
2263 }
2264}
2265
2267{
2270}
2271
2273{
2274 FString Result(*this);
2276 return Result;
2277}
2278
2280{
2281 FString Result(MoveTemp(*this));
2283 return Result;
2284}
2285
2287{
2288 int32 Pos = 0;
2289 while (Pos < Len() && FChar::IsWhitespace((*this)[Pos]))
2290 {
2291 Pos++;
2292 }
2293 RemoveAt(0, Pos);
2294}
2295
2296inline FString FString::TrimStart() const &
2297{
2298 FString Result(*this);
2299 Result.TrimStartInline();
2300 return Result;
2301}
2302
2304{
2305 FString Result(MoveTemp(*this));
2306 Result.TrimStartInline();
2307 return Result;
2308}
2309
2311{
2312 int32 End = Len();
2313 while (End > 0 && FChar::IsWhitespace((*this)[End - 1]))
2314 {
2315 End--;
2316 }
2317 RemoveAt(End, Len() - End);
2318}
2319
2320inline FString FString::TrimEnd() const &
2321{
2322 FString Result(*this);
2323 Result.TrimEndInline();
2324 return Result;
2325}
2326
2328{
2329 FString Result(MoveTemp(*this));
2330 Result.TrimEndInline();
2331 return Result;
2332}
2333
2334inline FString FString::TrimQuotes(bool* bQuotesRemoved) const
2335{
2336 bool bQuotesWereRemoved = false;
2337 int32 Start = 0, Count = Len();
2338 if (Count > 0)
2339 {
2340 if ((*this)[0] == TCHAR('"'))
2341 {
2342 Start++;
2343 Count--;
2344 bQuotesWereRemoved = true;
2345 }
2346
2347 if (Len() > 1 && (*this)[Len() - 1] == TCHAR('"'))
2348 {
2349 Count--;
2350 bQuotesWereRemoved = true;
2351 }
2352 }
2353
2354 if (bQuotesRemoved != nullptr)
2355 {
2356 *bQuotesRemoved = bQuotesWereRemoved;
2357 }
2358 return Mid(Start, Count);
2359}
2360
2361inline int32 FString::CullArray(TArray<FString>* InArray)
2362{
2363 FString Empty;
2364 InArray->Remove(Empty);
2365 return InArray->Num();
2366}
2367
2368inline FString FString::Reverse() const
2369{
2370 FString New(*this);
2372 return New;
2373}
2374
2376{
2377 if (Len() > 0)
2378 {
2379 TCHAR* StartChar = &(*this)[0];
2380 TCHAR* EndChar = &(*this)[Len() - 1];
2381 TCHAR TempChar;
2382 do
2383 {
2384 TempChar = *StartChar; // store the current value of StartChar
2385 *StartChar = *EndChar; // change the value of StartChar to the value of EndChar
2386 *EndChar = TempChar; // change the value of EndChar to the character that was previously at StartChar
2387
2388 StartChar++;
2389 EndChar--;
2390
2391 } while (StartChar < EndChar); // repeat until we've reached the midpoint of the string
2392 }
2393}
2394
2395inline FString FString::FormatAsNumber(int32 InNumber)
2396{
2397 FString Number = FString::FromInt(InNumber), Result;
2398
2399 int32 dec = 0;
2400 for (int32 x = Number.Len() - 1; x > -1; --x)
2401 {
2402 Result += Number.Mid(x, 1);
2403
2404 dec++;
2405 if (dec == 3 && x > 0)
2406 {
2407 Result += TEXT(",");
2408 dec = 0;
2409 }
2410 }
2411
2412 return Result.Reverse();
2413}
2414
2415inline void FString::AppendInt(int32 InNum)
2416{
2417 int64 Num = InNum; // This avoids having to deal with negating -MAX_int32-1
2418 const TCHAR* NumberChar[11] = { TEXT("0"), TEXT("1"), TEXT("2"), TEXT("3"), TEXT("4"), TEXT("5"), TEXT("6"), TEXT("7"), TEXT("8"), TEXT("9"), TEXT("-") };
2419 bool bIsNumberNegative = false;
2420 TCHAR TempNum[16]; // 16 is big enough
2421 int32 TempAt = 16; // fill the temp string from the top down.
2422
2423 // Correctly handle negative numbers and convert to positive integer.
2424 if (Num < 0)
2425 {
2426 bIsNumberNegative = true;
2427 Num = -Num;
2428 }
2429
2430 TempNum[--TempAt] = 0; // NULL terminator
2431
2432 // Convert to string assuming base ten and a positive integer.
2433 do
2434 {
2435 TempNum[--TempAt] = *NumberChar[Num % 10];
2436 Num /= 10;
2437 } while (Num);
2438
2439 // Append sign as we're going to reverse string afterwards.
2440 if (bIsNumberNegative)
2441 {
2442 TempNum[--TempAt] = *NumberChar[10];
2443 }
2444
2445 *this += TempNum + TempAt;
2446}
2447
2448inline bool FString::ToBlob(const FString& Source, uint8* DestBuffer, const uint32 DestSize)
2449{
2450 // Make sure the buffer is at least half the size and that the string is an
2451 // even number of characters long
2452 if (DestSize >= (uint32)(Source.Len() / 3) &&
2453 (Source.Len() % 3) == 0)
2454 {
2455 TCHAR ConvBuffer[4];
2456 ConvBuffer[3] = TEXT('\0');
2457 int32 WriteIndex = 0;
2458 // Walk the string 3 chars at a time
2459 for (int32 Index = 0; Index < Source.Len(); Index += 3, WriteIndex++)
2460 {
2461 ConvBuffer[0] = Source[Index];
2462 ConvBuffer[1] = Source[Index + 1];
2463 ConvBuffer[2] = Source[Index + 2];
2464 DestBuffer[WriteIndex] = FCString::Atoi(ConvBuffer);
2465 }
2466 return true;
2467 }
2468 return false;
2469}
2470
2471inline bool FString::ToHexBlob(const FString& Source, uint8* DestBuffer, const uint32 DestSize)
2472{
2473 // Make sure the buffer is at least half the size and that the string is an
2474 // even number of characters long
2475 if (DestSize >= (uint32)(Source.Len() / 2) &&
2476 (Source.Len() % 2) == 0)
2477 {
2478 TCHAR ConvBuffer[3];
2479 ConvBuffer[2] = TEXT('\0');
2480 int32 WriteIndex = 0;
2481 // Walk the string 2 chars at a time
2482 TCHAR* End = nullptr;
2483 for (int32 Index = 0; Index < Source.Len(); Index += 2, WriteIndex++)
2484 {
2485 ConvBuffer[0] = Source[Index];
2486 ConvBuffer[1] = Source[Index + 1];
2487 DestBuffer[WriteIndex] = FCString::Strtoi(ConvBuffer, &End, 16);
2488 }
2489 return true;
2490 }
2491 return false;
2492}
2493
2494inline FString FString::Chr(TCHAR Ch)
2495{
2496 TCHAR Temp[2] = { Ch,0 };
2497 return FString(Temp);
2498}
2499
2500
2501inline FString FString::ChrN(int32 NumCharacters, TCHAR Char)
2502{
2503 FString Temp;
2504 Temp.Data.AddUninitialized(NumCharacters + 1);
2505 for (int32 Cx = 0; Cx < NumCharacters; ++Cx)
2506 {
2507 Temp[Cx] = Char;
2508 }
2509 Temp.Data[NumCharacters] = 0;
2510 return Temp;
2511}
2512
2513inline FString FString::LeftPad(int32 ChCount) const
2514{
2515 int32 Pad = ChCount - Len();
2516
2517 if (Pad > 0)
2518 {
2519 return ChrN(Pad, ' ') + *this;
2520 }
2521 else
2522 {
2523 return *this;
2524 }
2525}
2526
2527inline FString FString::RightPad(int32 ChCount) const
2528{
2529 int32 Pad = ChCount - Len();
2530
2531 if (Pad > 0)
2532 {
2533 return *this + ChrN(Pad, ' ');
2534 }
2535 else
2536 {
2537 return *this;
2538 }
2539}
2540
2541inline bool FString::IsNumeric() const
2542{
2543 if (IsEmpty())
2544 {
2545 return 0;
2546 }
2547
2548 return FCString::IsNumeric(Data.GetData());
2549}
2550
2551/**
2552* Breaks up a delimited string into elements of a string array.
2553*
2554* @param InArray The array to fill with the string pieces
2555* @param pchDelim The string to delimit on
2556* @param InCullEmpty If 1, empty strings are not added to the array
2557*
2558* @return The number of elements in InArray
2559*/
2560inline int32 FString::ParseIntoArray(TArray<FString>& OutArray, const TCHAR* pchDelim, const bool InCullEmpty) const
2561{
2562 // Make sure the delimit string is not null or empty
2563 OutArray.Reset();
2564 const TCHAR *Start = Data.GetData();
2565 const int32 DelimLength = FCString::Strlen(pchDelim);
2566 if (Start && *Start != TEXT('\0') && DelimLength)
2567 {
2568 while (const TCHAR *At = FCString::Strstr(Start, pchDelim))
2569 {
2570 if (!InCullEmpty || At - Start)
2571 {
2572 OutArray.Emplace(At - Start, Start);
2573 }
2574 Start = At + DelimLength;
2575 }
2576 if (!InCullEmpty || *Start)
2577 {
2578 OutArray.Emplace(Start);
2579 }
2580
2581 }
2582 return OutArray.Num();
2583}
2584
2585inline bool FString::MatchesWildcard(const FString& InWildcard, ESearchCase::Type SearchCase) const
2586{
2587 FString Wildcard(InWildcard);
2588 FString Target(*this);
2589 int32 IndexOfStar = Wildcard.Find(TEXT("*"), ESearchCase::CaseSensitive, ESearchDir::FromEnd); // last occurance
2590 int32 IndexOfQuestion = Wildcard.Find(TEXT("?"), ESearchCase::CaseSensitive, ESearchDir::FromEnd); // last occurance
2591 int32 Suffix = FMath::Max<int32>(IndexOfStar, IndexOfQuestion);
2592 if (Suffix == INDEX_NONE)
2593 {
2594 // no wildcards
2595 if (SearchCase == ESearchCase::IgnoreCase)
2596 {
2597 return FCString::Stricmp(*Target, *Wildcard) == 0;
2598 }
2599 else
2600 {
2601 return FCString::Strcmp(*Target, *Wildcard) == 0;
2602 }
2603 }
2604 else
2605 {
2606 if (Suffix + 1 < Wildcard.Len())
2607 {
2608 FString SuffixString = Wildcard.Mid(Suffix + 1);
2609 if (!Target.EndsWith(SuffixString, SearchCase))
2610 {
2611 return false;
2612 }
2613 Wildcard = Wildcard.Left(Suffix + 1);
2614 Target = Target.Left(Target.Len() - SuffixString.Len());
2615 }
2616 int32 PrefixIndexOfStar = Wildcard.Find(TEXT("*"), ESearchCase::CaseSensitive);
2617 int32 PrefixIndexOfQuestion = Wildcard.Find(TEXT("?"), ESearchCase::CaseSensitive);
2618 int32 Prefix = FMath::Min<int32>(PrefixIndexOfStar < 0 ? INT_MAX : PrefixIndexOfStar, PrefixIndexOfQuestion < 0 ? INT_MAX : PrefixIndexOfQuestion);
2619 if (Prefix > 0)
2620 {
2621 FString PrefixString = Wildcard.Left(Prefix);
2622 if (!Target.StartsWith(PrefixString, SearchCase))
2623 {
2624 return false;
2625 }
2626 Wildcard = Wildcard.Mid(Prefix);
2627 Target = Target.Mid(Prefix);
2628 }
2629 }
2630 // This routine is very slow, though it does ok with one wildcard
2631 TCHAR FirstWild = Wildcard[0];
2632 Wildcard = Wildcard.Right(Wildcard.Len() - 1);
2633 if (FirstWild == TEXT('*') || FirstWild == TEXT('?'))
2634 {
2635 if (!Wildcard.Len())
2636 {
2637 if (FirstWild == TEXT('*') || Target.Len() < 2)
2638 {
2639 return true;
2640 }
2641 }
2642 int32 MaxNum = FMath::Min<int32>(Target.Len(), FirstWild == TEXT('?') ? 1 : INT_MAX);
2643 for (int32 Index = 0; Index <= MaxNum; Index++)
2644 {
2645 if (Target.Right(Target.Len() - Index).MatchesWildcard(Wildcard, SearchCase))
2646 {
2647 return true;
2648 }
2649 }
2650 return false;
2651 }
2652 else
2653 {
2654 return false;
2655 }
2656}
2657
2658
2659/** Caution!! this routine is O(N^2) allocations...use it for parsing very short text or not at all */
2660inline int32 FString::ParseIntoArrayWS(TArray<FString>& OutArray, const TCHAR* pchExtraDelim, bool InCullEmpty) const
2661{
2662 // default array of White Spaces, the last entry can be replaced with the optional pchExtraDelim string
2663 // (if you want to split on white space and another character)
2664 static const TCHAR* WhiteSpace[] =
2665 {
2666 TEXT(" "),
2667 TEXT("\t"),
2668 TEXT("\r"),
2669 TEXT("\n"),
2670 TEXT(""),
2671 };
2672
2673 // start with just the standard whitespaces
2674 int32 NumWhiteSpaces = ARRAY_COUNT(WhiteSpace) - 1;
2675 // if we got one passed in, use that in addition
2676 if (pchExtraDelim && *pchExtraDelim)
2677 {
2678 WhiteSpace[NumWhiteSpaces++] = pchExtraDelim;
2679 }
2680
2681 return ParseIntoArray(OutArray, WhiteSpace, NumWhiteSpaces, InCullEmpty);
2682}
2683
2684inline int32 FString::ParseIntoArrayLines(TArray<FString>& OutArray, bool InCullEmpty) const
2685{
2686 // default array of LineEndings
2687 static const TCHAR* LineEndings[] =
2688 {
2689 TEXT("\r\n"),
2690 TEXT("\r"),
2691 TEXT("\n"),
2692 };
2693
2694 // start with just the standard line endings
2695 int32 NumLineEndings = ARRAY_COUNT(LineEndings);
2696 return ParseIntoArray(OutArray, LineEndings, NumLineEndings, InCullEmpty);
2697}
2698
2699#pragma warning(push)
2700#pragma warning(disable : 4291)
2701
2702inline int32 FString::ParseIntoArray(TArray<FString>& OutArray, const TCHAR** DelimArray, int32 NumDelims, bool InCullEmpty) const
2703{
2704 // Make sure the delimit string is not null or empty
2705 OutArray.Empty();
2706 const TCHAR *Start = Data.GetData();
2707 const int32 Length = Len();
2708 if (Start)
2709 {
2710 int32 SubstringBeginIndex = 0;
2711
2712 // Iterate through string.
2713 for (int32 i = 0; i < Len();)
2714 {
2715 int32 SubstringEndIndex = INDEX_NONE;
2716 int32 DelimiterLength = 0;
2717
2718 // Attempt each delimiter.
2719 for (int32 DelimIndex = 0; DelimIndex < NumDelims; ++DelimIndex)
2720 {
2721 DelimiterLength = FCString::Strlen(DelimArray[DelimIndex]);
2722
2723 // If we found a delimiter...
2724 if (FCString::Strncmp(Start + i, DelimArray[DelimIndex], DelimiterLength) == 0)
2725 {
2726 // Mark the end of the substring.
2727 SubstringEndIndex = i;
2728 break;
2729 }
2730 }
2731
2732 if (SubstringEndIndex != INDEX_NONE)
2733 {
2734 const int32 SubstringLength = SubstringEndIndex - SubstringBeginIndex;
2735 // If we're not culling empty strings or if we are but the string isn't empty anyways...
2736 if (!InCullEmpty || SubstringLength != 0)
2737 {
2738 // ... add new string from substring beginning up to the beginning of this delimiter.
2739 new (OutArray) FString(SubstringEndIndex - SubstringBeginIndex, Start + SubstringBeginIndex);
2740 }
2741 // Next substring begins at the end of the discovered delimiter.
2742 SubstringBeginIndex = SubstringEndIndex + DelimiterLength;
2743 i = SubstringBeginIndex;
2744 }
2745 else
2746 {
2747 ++i;
2748 }
2749 }
2750
2751 // Add any remaining characters after the last delimiter.
2752 const int32 SubstringLength = Length - SubstringBeginIndex;
2753 // If we're not culling empty strings or if we are but the string isn't empty anyways...
2754 if (!InCullEmpty || SubstringLength != 0)
2755 {
2756 // ... add new string from substring beginning up to the beginning of this delimiter.
2757 new (OutArray) FString(Start + SubstringBeginIndex);
2758 }
2759 }
2760
2761 return OutArray.Num();
2762}
2763
2764#pragma warning(pop)
2765
2766inline FString FString::Replace(const TCHAR* From, const TCHAR* To, ESearchCase::Type SearchCase) const
2767{
2768 // Previous code used to accidentally accept a nullptr replacement string - this is no longer accepted.
2769
2770 if (IsEmpty() || !From || !*From)
2771 {
2772 return *this;
2773 }
2774
2775 // get a pointer into the character data
2776 const TCHAR* Travel = Data.GetData();
2777
2778 // precalc the lengths of the replacement strings
2779 int32 FromLength = FCString::Strlen(From);
2780 int32 ToLength = FCString::Strlen(To);
2781
2782 FString Result;
2783 while (true)
2784 {
2785 // look for From in the remaining string
2786 const TCHAR* FromLocation = SearchCase == ESearchCase::IgnoreCase ? FCString::Stristr(Travel, From) : FCString::Strstr(Travel, From);
2787 if (!FromLocation)
2788 break;
2789
2790 // copy everything up to FromLocation
2791 Result.AppendChars(Travel, FromLocation - Travel);
2792
2793 // copy over the To
2794 Result.AppendChars(To, ToLength);
2795
2796 Travel = FromLocation + FromLength;
2797 }
2798
2799 // copy anything left over
2800 Result += Travel;
2801
2802 return Result;
2803}
2804
2805inline int32 FString::ReplaceInline(const TCHAR* SearchText, const TCHAR* ReplacementText, ESearchCase::Type SearchCase)
2806{
2807 int32 ReplacementCount = 0;
2808
2809 if (Len() > 0
2810 && SearchText != nullptr && *SearchText != 0
2811 && ReplacementText != nullptr && (SearchCase == ESearchCase::IgnoreCase || FCString::Strcmp(SearchText, ReplacementText) != 0))
2812 {
2813 const int32 NumCharsToReplace = FCString::Strlen(SearchText);
2814 const int32 NumCharsToInsert = FCString::Strlen(ReplacementText);
2815
2816 if (NumCharsToInsert == NumCharsToReplace)
2817 {
2818 TCHAR* Pos = SearchCase == ESearchCase::IgnoreCase ? FCString::Stristr(&(*this)[0], SearchText) : FCString::Strstr(&(*this)[0], SearchText);
2819 while (Pos != nullptr)
2820 {
2821 ReplacementCount++;
2822
2823 // FCString::Strcpy now inserts a terminating zero so can't use that
2824 for (int32 i = 0; i < NumCharsToInsert; i++)
2825 {
2826 Pos[i] = ReplacementText[i];
2827 }
2828
2829 if (Pos + NumCharsToReplace - **this < Len())
2830 {
2831 Pos = SearchCase == ESearchCase::IgnoreCase ? FCString::Stristr(Pos + NumCharsToReplace, SearchText) : FCString::Strstr(Pos + NumCharsToReplace, SearchText);
2832 }
2833 else
2834 {
2835 break;
2836 }
2837 }
2838 }
2839 else if (Contains(SearchText, SearchCase))
2840 {
2841 FString Copy(*this);
2843
2844 // get a pointer into the character data
2845 TCHAR* WritePosition = (TCHAR*)Copy.Data.GetData();
2846 // look for From in the remaining string
2847 TCHAR* SearchPosition = SearchCase == ESearchCase::IgnoreCase ? FCString::Stristr(WritePosition, SearchText) : FCString::Strstr(WritePosition, SearchText);
2848 while (SearchPosition != nullptr)
2849 {
2850 ReplacementCount++;
2851
2852 // replace the first letter of the From with 0 so we can do a strcpy (FString +=)
2853 *SearchPosition = 0;
2854
2855 // copy everything up to the SearchPosition
2856 (*this) += WritePosition;
2857
2858 // copy over the ReplacementText
2859 (*this) += ReplacementText;
2860
2861 // restore the letter, just so we don't have 0's in the string
2862 *SearchPosition = *SearchText;
2863
2864 WritePosition = SearchPosition + NumCharsToReplace;
2865 SearchPosition = SearchCase == ESearchCase::IgnoreCase ? FCString::Stristr(WritePosition, SearchText) : FCString::Strstr(WritePosition, SearchText);
2866 }
2867
2868 // copy anything left over
2869 (*this) += WritePosition;
2870 }
2871 }
2872
2873 return ReplacementCount;
2874}
2875
2876
2877/**
2878* Returns a copy of this string with all quote marks escaped (unless the quote is already escaped)
2879*/
2881{
2883 {
2884 FString Result;
2885
2886 const TCHAR* pChar = **this;
2887
2888 bool bEscaped = false;
2889 while (*pChar != 0)
2890 {
2891 if (bEscaped)
2892 {
2893 bEscaped = false;
2894 }
2895 else if (*pChar == TCHAR('\\'))
2896 {
2897 bEscaped = true;
2898 }
2899 else if (*pChar == TCHAR('"'))
2900 {
2901 Result += TCHAR('\\');
2902 }
2903
2904 Result += *pChar++;
2905 }
2906
2907 return Result;
2908 }
2909
2910 return *this;
2911}
2912
2913static const TCHAR* CharToEscapeSeqMap[][2] =
2914{
2915 // Always replace \\ first to avoid double-escaping characters
2916 { TEXT("\\"), TEXT("\\\\") },
2917{ TEXT("\n"), TEXT("\\n") },
2918{ TEXT("\r"), TEXT("\\r") },
2919{ TEXT("\t"), TEXT("\\t") },
2920{ TEXT("\'"), TEXT("\\'") },
2921{ TEXT("\""), TEXT("\\\"") }
2922};
2923
2925
2926/**
2927* Replaces certain characters with the "escaped" version of that character (i.e. replaces "\n" with "\\n").
2928* The characters supported are: { \n, \r, \t, \', \", \\ }.
2929*
2930* @param Chars by default, replaces all supported characters; this parameter allows you to limit the replacement to a subset.
2931*
2932* @return a string with all control characters replaced by the escaped version.
2933*/
2934inline FString FString::ReplaceCharWithEscapedChar(const TArray<TCHAR>* Chars/*=nullptr*/) const
2935{
2936 if (Len() > 0 && (Chars == nullptr || Chars->Num() > 0))
2937 {
2938 FString Result(*this);
2939 for (int32 ChIdx = 0; ChIdx < MaxSupportedEscapeChars; ChIdx++)
2940 {
2941 if (Chars == nullptr || Chars->Contains(*(CharToEscapeSeqMap[ChIdx][0])))
2942 {
2943 // use ReplaceInline as that won't create a copy of the string if the character isn't found
2945 }
2946 }
2947 return Result;
2948 }
2949
2950 return *this;
2951}
2952/**
2953* Removes the escape backslash for all supported characters, replacing the escape and character with the non-escaped version. (i.e.
2954* replaces "\\n" with "\n". Counterpart to ReplaceCharWithEscapedChar().
2955*/
2956inline FString FString::ReplaceEscapedCharWithChar(const TArray<TCHAR>* Chars/*=nullptr*/) const
2957{
2958 if (Len() > 0 && (Chars == nullptr || Chars->Num() > 0))
2959 {
2960 FString Result(*this);
2961 // Spin CharToEscapeSeqMap backwards to ensure we're doing the inverse of ReplaceCharWithEscapedChar
2962 for (int32 ChIdx = MaxSupportedEscapeChars - 1; ChIdx >= 0; ChIdx--)
2963 {
2964 if (Chars == nullptr || Chars->Contains(*(CharToEscapeSeqMap[ChIdx][0])))
2965 {
2966 // use ReplaceInline as that won't create a copy of the string if the character isn't found
2968 }
2969 }
2970 return Result;
2971 }
2972
2973 return *this;
2974}
2975
2976/**
2977* Replaces all instances of '\t' with TabWidth number of spaces
2978* @param InSpacesPerTab - Number of spaces that a tab represents
2979*/
2980inline FString FString::ConvertTabsToSpaces(const int32 InSpacesPerTab)
2981{
2982 //must call this with at least 1 space so the modulus operation works
2983
2984 FString FinalString = *this;
2985 int32 TabIndex;
2986 while ((TabIndex = FinalString.Find(TEXT("\t"))) != INDEX_NONE)
2987 {
2988 FString LeftSide = FinalString.Left(TabIndex);
2989 FString RightSide = FinalString.Mid(TabIndex + 1);
2990
2991 FinalString = LeftSide;
2992 //for a tab size of 4,
2993 int32 LineBegin = LeftSide.Find(TEXT("\n"), ESearchCase::IgnoreCase, ESearchDir::FromEnd, TabIndex);
2994 if (LineBegin == INDEX_NONE)
2995 {
2996 LineBegin = 0;
2997 }
2998 int32 CharactersOnLine = (LeftSide.Len() - LineBegin);
2999
3000 int32 NumSpacesForTab = InSpacesPerTab - (CharactersOnLine % InSpacesPerTab);
3001 for (int32 i = 0; i < NumSpacesForTab; ++i)
3002 {
3003 FinalString.AppendChar(' ');
3004 }
3005 FinalString += RightSide;
3006 }
3007
3008 return FinalString;
3009}
3010
3011inline int32 FindMatchingClosingParenthesis(const FString& TargetString, const int32 StartSearch)
3012{
3013 const TCHAR* const StartPosition = (*TargetString) + StartSearch;
3014 const TCHAR* CurrPosition = StartPosition;
3015 int32 ParenthesisCount = 0;
3016
3017 // Move to first open parenthesis
3018 while (*CurrPosition != 0 && *CurrPosition != TEXT('('))
3019 {
3020 ++CurrPosition;
3021 }
3022
3023 // Did we find the open parenthesis
3024 if (*CurrPosition == TEXT('('))
3025 {
3026 ++ParenthesisCount;
3027 ++CurrPosition;
3028
3029 while (*CurrPosition != 0 && ParenthesisCount > 0)
3030 {
3031 if (*CurrPosition == TEXT('('))
3032 {
3033 ++ParenthesisCount;
3034 }
3035 else if (*CurrPosition == TEXT(')'))
3036 {
3037 --ParenthesisCount;
3038 }
3039 ++CurrPosition;
3040 }
3041
3042 // Did we find the matching close parenthesis
3043 if (ParenthesisCount == 0 && *(CurrPosition - 1) == TEXT(')'))
3044 {
3045 return StartSearch + ((CurrPosition - 1) - StartPosition);
3046 }
3047 }
3048
3049 return INDEX_NONE;
3050}
3051
3052#pragma warning(pop)
static unsigned int GetBuildUniqueId()
Definition Atlas.h:30
ARK_API LPVOID GetDataAddress(const std::string &name)
Definition Base.cpp:15
ARK_API BitField GetBitField(LPVOID base, const std::string &name)
Definition Base.cpp:25
ARK_API BitField GetBitField(const void *base, const std::string &name)
Definition Base.cpp:20
#define ARK_API
Definition Base.h:9
ARK_API DWORD64 GetAddress(const void *base, const std::string &name)
Definition Base.cpp:5
ARK_API LPVOID GetAddress(const std::string &name)
Definition Base.cpp:10
FPlatformTypes::CHAR16 UCS2CHAR
A 16-bit character containing a UCS2 (Unicode, 16-bit, fixed-width) code unit, used for compatibility...
Definition BasicTypes.h:124
@ INDEX_NONE
Definition BasicTypes.h:144
FWindowsPlatformTypes FPlatformTypes
Definition BasicTypes.h:94
#define PLATFORM_LITTLE_ENDIAN
Definition BasicTypes.h:12
FPlatformTypes::CHAR8 UTF8CHAR
An 8-bit character containing a UTF8 (Unicode, 8-bit, variable-width) code unit.
Definition BasicTypes.h:122
ENoInit
Definition BasicTypes.h:151
@ NoInit
Definition BasicTypes.h:151
#define check(expr)
Definition BasicTypes.h:14
FPlatformTypes::CHAR16 UTF16CHAR
A 16-bit character containing a UTF16 (Unicode, 16-bit, variable-width) code unit.
Definition BasicTypes.h:126
#define CONSTEXPR
Definition BasicTypes.h:7
EForceInit
Definition BasicTypes.h:147
@ ForceInitToZero
Definition BasicTypes.h:149
@ ForceInit
Definition BasicTypes.h:148
FPlatformTypes::CHAR32 UTF32CHAR
A 32-bit character containing a UTF32 (Unicode, 32-bit, fixed-width) code unit.
Definition BasicTypes.h:128
TCString< TCHAR > FCString
Definition CString.h:335
TChar< TCHAR > FChar
Definition Char.h:142
int32 FindMatchingClosingParenthesis(const FString &TargetString, const int32 StartSearch)
Definition FString.h:3011
int32 HexToBytes(const FString &HexString, uint8 *OutBytes)
Definition FString.h:1803
const TCHAR * GetData(const FString &String)
Definition FString.h:1672
const uint8 TCharToNibble(const TCHAR Char)
Definition FString.h:1783
const bool CheckTCharIsHex(const TCHAR Char)
Definition FString.h:1773
FORCEINLINE uint32 GetTypeHash(const FString &Thing)
Definition FString.h:1646
TCHAR * GetData(FString &String)
Definition FString.h:1667
SIZE_T GetNum(const FString &String)
Definition FString.h:1677
void ByteToHex(uint8 In, FString &Result)
Definition FString.h:1743
static const uint32 MaxSupportedEscapeChars
Definition FString.h:2924
FString BytesToHex(const uint8 *In, int32 Count)
Definition FString.h:1755
int32 StringToBytes(const FString &String, uint8 *OutBytes, int32 MaxBufferSize)
Definition FString.h:1714
static const TCHAR * CharToEscapeSeqMap[][2]
Definition FString.h:2913
TCHAR NibbleToTChar(uint8 Num)
Definition FString.h:1729
FString BytesToString(const uint8 *In, int32 Count)
Definition FString.h:1688
FORCEINLINE TEnableIf< TIsTriviallyCopyAssignable< ElementType >::Value >::Type CopyAssignItems(ElementType *Dest, const ElementType *Source, int32 Count)
Definition MemoryOps.h:162
FMicrosoftPlatformString FPlatformString
#define THRESH_VECTOR_NORMALIZED
#define THRESH_NORMALS_ARE_PARALLEL
#define THRESH_POINTS_ARE_SAME
#define SMALL_NUMBER
#define THRESH_POINT_ON_PLANE
#define PI
#define THRESH_NORMALS_ARE_ORTHOGONAL
#define KINDA_SMALL_NUMBER
#define BIG_NUMBER
#define FASTASIN_HALF_PI
#define HALF_PI
#define INV_PI
#define ARRAY_COUNT(array)
FORCEINLINE TRemoveReference< T >::Type && MoveTemp(T &&Obj)
#define Expose_TNameOf(type)
FORCEINLINE float ComputeSquaredDistanceFromBoxToPoint(const FVector &Mins, const FVector &Maxs, const FVector &Point)
Definition Vector.h:893
FORCEINLINE FVector ClampVector(const FVector &V, const FVector &Min, const FVector &Max)
Definition Vector.h:1646
FORCEINLINE FVector operator*(float Scale, const FVector &V)
Definition Vector.h:870
ApiUtils & operator=(ApiUtils &&)=delete
ApiUtils()=default
void SetCheatManager(UShooterCheatManager *cheatmanager)
Definition ApiUtils.cpp:44
void SetWorld(UWorld *uworld)
Definition ApiUtils.cpp:9
ApiUtils & operator=(const ApiUtils &)=delete
void SetShooterGameMode(AShooterGameMode *shooter_game_mode)
Definition ApiUtils.cpp:21
std::unordered_map< uint64, AShooterPlayerController * > steam_id_map_
Definition ApiUtils.h:38
UShooterCheatManager * GetCheatManager() const override
Returns a point to URCON CheatManager.
Definition ApiUtils.cpp:93
UWorld * u_world_
Definition ApiUtils.h:34
ApiUtils(ApiUtils &&)=delete
AShooterGameMode * shooter_game_mode_
Definition ApiUtils.h:35
AShooterGameMode * GetShooterGameMode() const override
Returns a pointer to AShooterGameMode.
Definition ApiUtils.cpp:26
void RemovePlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:62
UShooterCheatManager * cheatmanager_
Definition ApiUtils.h:37
void SetPlayerController(AShooterPlayerController *player_controller)
Definition ApiUtils.cpp:49
ServerStatus GetStatus() const override
Returns the current server status.
Definition ApiUtils.cpp:38
ServerStatus status_
Definition ApiUtils.h:36
AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const override
Definition ApiUtils.cpp:75
~ApiUtils() override=default
void SetStatus(ServerStatus status)
Definition ApiUtils.cpp:33
UWorld * GetWorld() const override
Returns a pointer to UWorld.
Definition ApiUtils.cpp:14
ApiUtils(const ApiUtils &)=delete
static FString GetSteamName(AController *player_controller)
Returns the steam name of player.
static FORCEINLINE FString GetItemBlueprint(UPrimalItem *item)
Returns blueprint from UPrimalItem.
static FVector GetPosition(APlayerController *player_controller)
Returns the position of a player.
uint64 GetSteamIDForPlayerID(int player_id) const
static FORCEINLINE FString GetClassBlueprint(UClass *the_class)
Returns blueprint path from any UClass.
void SendServerMessageToAll(FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to all players. Using fmt::format.
virtual UShooterCheatManager * GetCheatManager() const =0
Returns a point to URCON CheatManager.
UPrimalGameData * GetGameData()
Returns pointer to Primal Game Data.
static bool IsRidingDino(AShooterPlayerController *player_controller)
Returns true if character is riding a dino, false otherwise.
AShooterGameState * GetGameState()
Get Shooter Game State.
virtual ~IApiUtils()=default
AShooterPlayerController * FindPlayerFromSteamName(const FString &steam_name) const
Finds player from the given steam name.
static UShooterCheatManager * GetCheatManagerByPC(AShooterPlayerController *SPC)
Get UShooterCheatManager* of player controller.
static uint64 GetPlayerID(AController *controller)
static bool IsPlayerDead(AShooterPlayerController *player)
Returns true if player is dead, false otherwise.
void SendNotificationToAll(FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to all players. Using fmt::format.
APrimalDinoCharacter * SpawnDino(AShooterPlayerController *player, FString blueprint, FVector *location, int lvl, bool force_tame, bool neutered) const
Spawns a dino near player or at specific coordinates.
TArray< AShooterPlayerController * > FindPlayerFromCharacterName(const FString &character_name, ESearchCase::Type search, bool full_match) const
Finds all matching players from the given character name.
static FORCEINLINE FString GetBlueprint(UObjectBase *object)
Returns blueprint path from any UObject.
static FString GetCharacterName(AShooterPlayerController *player_controller, bool include_first_name=true, bool include_last_name=true)
Returns the character name of player.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType)
Gets all actors in radius at location.
void SendChatMessageToAll(const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to all players. Using fmt::format.
TArray< AActor * > GetAllActorsInRange(FVector location, float radius, EServerOctreeGroup::Type ActorType, TArray< AActor * > ignores)
Gets all actors in radius at location, with ignore actors.
virtual AShooterGameMode * GetShooterGameMode() const =0
Returns a pointer to AShooterGameMode.
static uint64 GetSteamIdFromController(AController *controller)
Returns Steam ID from player controller.
virtual UWorld * GetWorld() const =0
Returns a pointer to UWorld.
static bool TeleportToPos(AShooterPlayerController *player_controller, const FVector &pos)
Teleports player to the given position.
void SendNotification(AShooterPlayerController *player_controller, FLinearColor color, float display_scale, float display_time, UTexture2D *icon, const T *msg, Args &&... args)
Sends notification (on-screen message) to the specific player. Using fmt::format.
static uint64 GetPlayerID(APrimalCharacter *character)
virtual AShooterPlayerController * FindPlayerFromSteamId_Internal(uint64 steam_id) const =0
AShooterPlayerController * FindControllerFromCharacter(AShooterCharacter *character) const
Finds player controller from the given player character.
static APrimalDinoCharacter * GetRidingDino(AShooterPlayerController *player_controller)
Returns the dino the character is riding.
static FString GetIPAddress(AShooterPlayerController *player_controller)
Returns IP address of player.
AShooterPlayerController * FindPlayerFromSteamId(uint64 steam_id) const
Finds player from the given steam id.
virtual ServerStatus GetStatus() const =0
Returns the current server status.
void SendServerMessage(AShooterPlayerController *player_controller, FLinearColor msg_color, const T *msg, Args &&... args)
Sends server message to the specific player. Using fmt::format.
static std::optional< FString > TeleportToPlayer(AShooterPlayerController *me, AShooterPlayerController *him, bool check_for_dino, float max_dist)
Teleport one player to another.
static int GetInventoryItemCount(AShooterPlayerController *player_controller, const FString &item_name)
Counts a specific items quantity.
void SendChatMessage(AShooterPlayerController *player_controller, const FString &sender_name, const T *msg, Args &&... args)
Sends chat message to the specific player. Using fmt::format.
FORCEINLINE const DataType & GetCharArray() const
Definition FString.h:299
FORCEINLINE friend bool operator<=(const FString &Lhs, const CharType *Rhs)
Definition FString.h:844
FORCEINLINE void RemoveAt(int32 Index, int32 Count=1, bool bAllowShrinking=true)
Definition FString.h:435
FORCEINLINE friend FString operator+(FString &&Lhs, FString &&Rhs)
Definition FString.h:661
FORCEINLINE FString & Append(const FString &Text)
Definition FString.h:396
FORCEINLINE uint32 GetAllocatedSize() const
Definition FString.h:214
void ToUpperInline()
Definition FString.h:2097
FString TrimStart() const &
Definition FString.h:2296
int32 Find(const TCHAR *SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart, int32 StartPosition=INDEX_NONE) const
Definition FString.h:2027
FORCEINLINE friend FString operator/(const FString &Lhs, const FString &Rhs)
Definition FString.h:781
FORCEINLINE FString(const std::string &str)
Definition FString.h:129
int32 ParseIntoArray(TArray< FString > &OutArray, const TCHAR **DelimArray, int32 NumDelims, bool InCullEmpty=true) const
Definition FString.h:2702
bool IsNumeric() const
Definition FString.h:2541
FORCEINLINE friend FString operator+(const FString &Lhs, const TCHAR *Rhs)
Definition FString.h:700
FORCEINLINE friend bool operator!=(const FString &Lhs, const CharType *Rhs)
Definition FString.h:1049
FORCEINLINE int32 Find(const FString &SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart, int32 StartPosition=INDEX_NONE) const
Definition FString.h:1128
FORCEINLINE friend DataType::RangedForIteratorType end(FString &Str)
Definition FString.h:210
FORCEINLINE friend FString operator+(FString &&Lhs, const FString &Rhs)
Definition FString.h:635
FString(FString &&)=default
FORCEINLINE FString & operator=(const TCHAR *Other)
Definition FString.h:147
FORCEINLINE friend bool operator<(const CharType *Lhs, const FString &Rhs)
Definition FString.h:899
FString TrimEnd() const &
Definition FString.h:2320
void TrimStartInline()
Definition FString.h:2286
FString Replace(const TCHAR *From, const TCHAR *To, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2766
FORCEINLINE FString LeftChop(int32 Count) const
Definition FString.h:1081
FORCEINLINE bool FindChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1169
FORCEINLINE friend bool operator!=(const FString &Lhs, const FString &Rhs)
Definition FString.h:1035
int32 ReplaceInline(const TCHAR *SearchText, const TCHAR *ReplacementText, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase)
Definition FString.h:2805
FORCEINLINE FString Mid(int32 Start, int32 Count=INT_MAX) const
Definition FString.h:1099
FORCEINLINE FString(FString &&Other, int32 ExtraSlack)
Definition FString.h:87
static FORCEINLINE FString ConcatFStrings(typename TIdentity< LhsType >::Type Lhs, typename TIdentity< RhsType >::Type Rhs)
Definition FString.h:550
static FString Chr(TCHAR Ch)
Definition FString.h:2494
FORCEINLINE friend DataType::RangedForIteratorType begin(FString &Str)
Definition FString.h:208
FORCEINLINE friend FString operator+(const FString &Lhs, FString &&Rhs)
Definition FString.h:648
FORCEINLINE DataType & GetCharArray()
Definition FString.h:293
FORCEINLINE friend bool operator==(const FString &Lhs, const CharType *Rhs)
Definition FString.h:1008
static FORCEINLINE FString FromInt(int32 Num)
Definition FString.h:1548
FORCEINLINE FString & operator+=(const FString &Str)
Definition FString.h:500
FString & Append(const TCHAR *Text, int32 Count)
Definition FString.h:402
FORCEINLINE FString & operator/=(const FString &Str)
Definition FString.h:736
FString TrimStart() &&
Definition FString.h:2303
FORCEINLINE friend FString operator+(const FString &Lhs, const FString &Rhs)
Definition FString.h:622
FORCEINLINE int32 Compare(const FString &Other, ESearchCase::Type SearchCase=ESearchCase::CaseSensitive) const
Definition FString.h:1240
FORCEINLINE friend bool operator<=(const CharType *Lhs, const FString &Rhs)
Definition FString.h:858
FORCEINLINE friend bool operator==(const FString &Lhs, const FString &Rhs)
Definition FString.h:994
FString TrimStartAndEnd() &&
Definition FString.h:2279
FORCEINLINE friend FString operator+(const TCHAR *Lhs, const FString &Rhs)
Definition FString.h:674
FORCEINLINE TIterator CreateIterator()
Definition FString.h:192
FORCEINLINE void Reserve(const uint32 CharacterCount)
Definition FString.h:1542
FString ReplaceQuotesWithEscapedQuotes() const
Definition FString.h:2880
FString & operator=(FString &&)=default
static int32 CullArray(TArray< FString > *InArray)
Definition FString.h:2361
bool MatchesWildcard(const FString &Wildcard, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2585
FString Reverse() const
Definition FString.h:2368
FString ConvertTabsToSpaces(const int32 InSpacesPerTab)
Definition FString.h:2980
bool StartsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2131
FORCEINLINE friend bool operator!=(const CharType *Lhs, const FString &Rhs)
Definition FString.h:1063
static FORCEINLINE FString ConcatTCHARsToFString(const TCHAR *Lhs, typename TIdentity< RhsType >::Type Rhs)
Definition FString.h:569
FORCEINLINE FString Left(int32 Count) const
Definition FString.h:1075
static bool ToHexBlob(const FString &Source, uint8 *DestBuffer, const uint32 DestSize)
Definition FString.h:2471
int32 ParseIntoArrayLines(TArray< FString > &OutArray, bool InCullEmpty=true) const
Definition FString.h:2684
FORCEINLINE bool FindLastChar(TCHAR InChar, int32 &Index) const
Definition FString.h:1181
std::string ToString() const
Convert FString to std::string.
Definition FString.h:1611
FString TrimQuotes(bool *bQuotesRemoved=nullptr) const
Definition FString.h:2334
FORCEINLINE FString & operator+=(const TCHAR *Str)
Definition FString.h:347
void AppendInt(int32 InNum)
Definition FString.h:2415
FORCEINLINE const TCHAR * operator*() const
Definition FString.h:282
FORCEINLINE friend FString operator/(FString &&Lhs, const TCHAR *Rhs)
Definition FString.h:765
FString()=default
FORCEINLINE friend FString operator/(FString &&Lhs, const FString &Rhs)
Definition FString.h:797
FString RightPad(int32 ChCount) const
Definition FString.h:2527
FORCEINLINE friend TEnableIf< TIsCharType< CharType >::Value, FString >::Type operator+(const FString &Lhs, CharType Rhs)
Definition FString.h:519
FORCEINLINE friend DataType::RangedForConstIteratorType end(const FString &Str)
Definition FString.h:211
void PathAppend(const TCHAR *Str, int32 StrLength)
Definition FString.h:2234
FORCEINLINE bool Contains(const FString &SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart) const
Definition FString.h:1156
FORCEINLINE FString(const CharType *Src, typename TEnableIf< TIsCharType< CharType >::Value >::Type *Dummy=nullptr)
Definition FString.h:98
void TrimEndInline()
Definition FString.h:2310
FORCEINLINE FString RightChop(int32 Count) const
Definition FString.h:1093
FString TrimEnd() &&
Definition FString.h:2327
bool EndsWith(const FString &InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2180
FString ToLower() &&
Definition FString.h:2115
static FString ChrN(int32 NumCharacters, TCHAR Char)
Definition FString.h:2501
static FORCEINLINE FString ConcatFStringToTCHARs(typename TIdentity< LhsType >::Type Lhs, const TCHAR *Rhs)
Definition FString.h:596
FORCEINLINE friend FString operator+(const TCHAR *Lhs, FString &&Rhs)
Definition FString.h:687
FORCEINLINE TConstIterator CreateConstIterator() const
Definition FString.h:198
bool StartsWith(const FString &InPrefix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2143
FString ToUpper() const &
Definition FString.h:2084
FString(const FString &)=default
static FString FormatAsNumber(int32 InNumber)
Definition FString.h:2395
FORCEINLINE bool Equals(const FString &Other, ESearchCase::Type SearchCase=ESearchCase::CaseSensitive) const
Definition FString.h:1221
FORCEINLINE bool IsValidIndex(int32 Index) const
Definition FString.h:272
FORCEINLINE friend FString operator/(const FString &Lhs, const TCHAR *Rhs)
Definition FString.h:749
void ToLowerInline()
Definition FString.h:2121
TArray< TCHAR > DataType
Definition FString.h:58
DataType Data
Definition FString.h:59
FString ToUpper() &&
Definition FString.h:2091
void TrimStartAndEndInline()
Definition FString.h:2266
int32 ParseIntoArray(TArray< FString > &OutArray, const TCHAR *pchDelim, bool InCullEmpty=true) const
Definition FString.h:2560
bool EndsWith(const TCHAR *InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase) const
Definition FString.h:2155
FORCEINLINE FString(int32 InCount, const TCHAR *InSrc)
Definition FString.h:116
FORCEINLINE friend DataType::RangedForConstIteratorType begin(const FString &Str)
Definition FString.h:209
FORCEINLINE friend bool operator>(const FString &Lhs, const CharType *Rhs)
Definition FString.h:967
FString ReplaceCharWithEscapedChar(const TArray< TCHAR > *Chars=nullptr) const
Definition FString.h:2934
static bool ToBlob(const FString &Source, uint8 *DestBuffer, const uint32 DestSize)
Definition FString.h:2448
FORCEINLINE TCHAR & operator[](int32 Index)
Definition FString.h:169
FORCEINLINE void InsertAt(int32 Index, TCHAR Character)
Definition FString.h:440
FORCEINLINE friend bool operator>=(const CharType *Lhs, const FString &Rhs)
Definition FString.h:940
FORCEINLINE friend FString operator/(const TCHAR *Lhs, const FString &Rhs)
Definition FString.h:813
FORCEINLINE void AppendChars(const TCHAR *Array, int32 Count)
Definition FString.h:322
FORCEINLINE friend TEnableIf< TIsCharType< CharType >::Value, FString >::Type operator+(FString &&Lhs, CharType Rhs)
Definition FString.h:538
FORCEINLINE void Shrink()
Definition FString.h:260
FORCEINLINE friend bool operator>(const CharType *Lhs, const FString &Rhs)
Definition FString.h:981
void ReverseString()
Definition FString.h:2375
FORCEINLINE bool IsEmpty() const
Definition FString.h:241
FORCEINLINE FString Right(int32 Count) const
Definition FString.h:1087
FORCEINLINE void InsertAt(int32 Index, const FString &Characters)
Definition FString.h:455
FORCEINLINE bool Contains(const TCHAR *SubStr, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart) const
Definition FString.h:1142
FORCEINLINE friend bool operator>(const FString &Lhs, const FString &Rhs)
Definition FString.h:953
FORCEINLINE friend bool operator==(const CharType *Lhs, const FString &Rhs)
Definition FString.h:1022
FORCEINLINE friend bool operator<(const FString &Lhs, const CharType *Rhs)
Definition FString.h:885
static FString Join(const TArray< T, Allocator > &Array, const TCHAR *Separator)
Definition FString.h:1587
bool RemoveFromEnd(const FString &InSuffix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase)
Definition FString.h:2212
FORCEINLINE TEnableIf< TIsCharType< CharType >::Value, FString & >::Type operator+=(CharType InChar)
Definition FString.h:363
FORCEINLINE const TCHAR & operator[](int32 Index) const
Definition FString.h:180
FORCEINLINE friend bool operator<(const FString &Lhs, const FString &Rhs)
Definition FString.h:871
FORCEINLINE friend bool operator>=(const FString &Lhs, const FString &Rhs)
Definition FString.h:912
FString ToLower() const &
Definition FString.h:2108
int32 ParseIntoArrayWS(TArray< FString > &OutArray, const TCHAR *pchExtraDelim=nullptr, bool InCullEmpty=true) const
Definition FString.h:2660
bool Split(const FString &InS, FString *LeftS, FString *RightS, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase, ESearchDir::Type SearchDir=ESearchDir::FromStart) const
Definition FString.h:1262
static FString Format(const T *format, Args &&... args)
Formats text using fmt::format.
Definition FString.h:1633
FString LeftPad(int32 ChCount) const
Definition FString.h:2513
FORCEINLINE int32 FindLastCharByPredicate(Predicate Pred) const
Definition FString.h:1209
FORCEINLINE void Reset(int32 NewReservedSize=0)
Definition FString.h:251
FORCEINLINE void Empty(int32 Slack=0)
Definition FString.h:231
FORCEINLINE int32 Len() const
Definition FString.h:1069
FORCEINLINE int32 FindLastCharByPredicate(Predicate Pred, int32 Count) const
Definition FString.h:1195
void TrimToNullTerminator()
Definition FString.h:2015
bool RemoveFromStart(const FString &InPrefix, ESearchCase::Type SearchCase=ESearchCase::IgnoreCase)
Definition FString.h:2196
FORCEINLINE FString & AppendChar(const TCHAR InChar)
Definition FString.h:390
FORCEINLINE friend bool operator>=(const FString &Lhs, const CharType *Rhs)
Definition FString.h:926
FORCEINLINE friend bool operator<=(const FString &Lhs, const FString &Rhs)
Definition FString.h:830
FORCEINLINE void CheckInvariants() const
Definition FString.h:222
FORCEINLINE friend FString operator+(FString &&Lhs, const TCHAR *Rhs)
Definition FString.h:713
FString ReplaceEscapedCharWithChar(const TArray< TCHAR > *Chars=nullptr) const
Definition FString.h:2956
FORCEINLINE FString(const FString &Other, int32 ExtraSlack)
Definition FString.h:76
FORCEINLINE FString & operator/=(const TCHAR *Str)
Definition FString.h:724
FString & operator=(const FString &)=default
FString TrimStartAndEnd() const &
Definition FString.h:2272
FORCEINLINE int32 Num() const
Definition TArray.h:611
FORCEINLINE int32 Add(const ElementType &Item)
Definition TArray.h:1564
void Reset(int32 NewSize=0)
Definition TArray.h:1302
int32 Remove(const ElementType &Item)
Definition TArray.h:1709
void Empty(int32 Slack=0)
Definition TArray.h:1321
FORCEINLINE ElementType * GetData() const
Definition TArray.h:533
FORCEINLINE ObjectType * Get() const
IApiUtils & GetApiUtils()
Definition ApiUtils.cpp:99
@ CaseSensitive
Definition FString.h:28
@ FromStart
Definition FString.h:41
void FromString(float &OutValue, const TCHAR *Buffer)
Definition FString.h:1845
void FromString(int8 &OutValue, const TCHAR *Buffer)
Definition FString.h:1837
void FromString(uint8 &OutValue, const TCHAR *Buffer)
Definition FString.h:1841
void FromString(uint32 &OutValue, const TCHAR *Buffer)
Definition FString.h:1843
TEnableIf< TIsCharType< CharType >::Value, FString >::Type ToString(const CharType *Ptr)
Definition FString.h:1851
void FromString(int32 &OutValue, const TCHAR *Buffer)
Definition FString.h:1839
void FromString(uint64 &OutValue, const TCHAR *Buffer)
Definition FString.h:1844
FString ToSanitizedString(const T &Value)
Definition FString.h:1873
void FromString(FString &OutValue, const TCHAR *Buffer)
Definition FString.h:1847
void FromString(double &OutValue, const TCHAR *Buffer)
Definition FString.h:1846
void FromString(uint16 &OutValue, const TCHAR *Buffer)
Definition FString.h:1842
static TEnableIf< TIsArithmetic< T >::Value, bool >::Type TryParseString(T &OutValue, const TCHAR *Buffer)
Definition FString.h:1882
void FromString(int16 &OutValue, const TCHAR *Buffer)
Definition FString.h:1838
FString ToString(bool Value)
Definition FString.h:1856
FORCEINLINE FString ToString(FString &&Str)
Definition FString.h:1861
FORCEINLINE FString ToString(const FString &Str)
Definition FString.h:1866
void FromString(int64 &OutValue, const TCHAR *Buffer)
Definition FString.h:1840
bool MatchesWildcardRecursive(const TCHAR *Target, int32 TargetLength, const TCHAR *Wildcard, int32 WildcardLength)
Definition FString.h:1933
Definition json.hpp:4518
FVector & DefaultActorLocationField()
Definition Actor.h:920
int & TargetingTeamField()
Definition Actor.h:902
USceneComponent * RootComponentField()
Definition Actor.h:911
APlayerState * PlayerStateField()
Definition Actor.h:2062
UCheatManager * CheatManagerField()
Definition Actor.h:2133
FString * GetPlayerNetworkAddress(FString *result)
Definition Actor.h:2292
FUniqueNetIdRepl & UniqueIdField()
Definition Actor.h:1782
FString & PlayerNameField()
Definition Actor.h:1776
bool TeleportTo(FVector *DestLocation, FRotator *DestRotation, bool bIsATest, bool bNoCheck)
Definition Actor.h:4554
UPrimalInventoryComponent * MyInventoryComponentField()
Definition Actor.h:3798
bool IsDead()
Definition Actor.h:4360
void DoNeuter_Implementation()
Definition Actor.h:7051
static UClass * GetPrivateStaticClass()
Definition Actor.h:6963
void TameDino(AShooterPlayerController *ForPC, bool bIgnoreMaxTameLimit, int OverrideTamingTeamID)
Definition Actor.h:7328
int & TamingTeamIDField()
Definition Actor.h:6194
FString & TamerStringField()
Definition Actor.h:6057
int & AbsoluteBaseLevelField()
Definition Actor.h:6324
UPrimalPlayerData * GetPlayerData()
Definition Actor.h:5166
APrimalDinoCharacter * GetRidingDino()
Definition Actor.h:5159
unsigned __int64 GetSteamIDForPlayerID(int playerDataID)
Definition GameMode.h:1620
void AddPlayerID(int playerDataID, unsigned __int64 netUniqueID)
Definition GameMode.h:1534
__int64 & LinkedPlayerIDField()
Definition Actor.h:2504
void SetPlayerPos(float X, float Y, float Z)
Definition Actor.h:3202
AActor * SpawnActor(FString *blueprintPath, float spawnDistance, float spawnYOffset, float ZOffset, bool bDoDeferBeginPlay)
Definition Actor.h:3222
AShooterCharacter * GetPlayerCharacter()
Definition Actor.h:2916
FString * GetPlayerName(FString *result)
Definition Actor.h:1902
void SetTribeTamingDinoSettings(APrimalDinoCharacter *aDinoChar)
Definition Actor.h:1986
DWORD64 offset
Definition Base.h:674
DWORD bit_position
Definition Base.h:675
ULONGLONG length
Definition Base.h:677
ULONGLONG num_bits
Definition Base.h:676
Definition Base.h:181
Definition Actor.h:10035
ECanvasAllowModes
Definition Base.h:316
@ Allow_DeleteOnRender
Definition Base.h:318
@ Allow_Flush
Definition Base.h:317
EElementType
Definition Base.h:309
@ ET_MAX
Definition Base.h:312
@ ET_Line
Definition Base.h:310
@ ET_Triangle
Definition Base.h:311
Definition Crc.h:11
static uint32 MemCrc32(const void *Data, int32 Lenght)
Definition Crc.h:12
Definition Other.h:244
Definition Actor.h:349
static FORCEINLINE double CeilToDouble(double F)
static FORCEINLINE float CeilToFloat(float F)
static FORCEINLINE float Fractional(float Value)
static FORCEINLINE float RoundToFloat(float F)
static CONSTEXPR FORCEINLINE double FloatSelect(double Comparand, double ValueGEZero, double ValueLTZero)
static FORCEINLINE float InvSqrtEst(float F)
static FORCEINLINE float Acos(float Value)
static FORCEINLINE uint32 ReverseMortonCode3(uint32 x)
static FORCEINLINE uint32 ReverseMortonCode2(uint32 x)
static FORCEINLINE int32 CeilToInt(float F)
static FORCEINLINE uint32 CountTrailingZeros(uint32 Value)
static FORCEINLINE T Max(const TArray< T > &Values, int32 *MaxIndex=NULL)
static FORCEINLINE T Min(const TArray< T > &Values, int32 *MinIndex=NULL)
static FORCEINLINE float InvSqrt(float F)
static FORCEINLINE float Modf(const float InValue, float *OutIntPart)
static CONSTEXPR FORCEINLINE T Min(const T A, const T B)
static FORCEINLINE float FRand()
static FORCEINLINE bool IsNaN(float A)
static FORCEINLINE double RoundToDouble(double F)
static FORCEINLINE float Sinh(float Value)
static CONSTEXPR FORCEINLINE float FloatSelect(float Comparand, float ValueGEZero, float ValueLTZero)
static FORCEINLINE uint32 CountLeadingZeros(uint32 Value)
static FORCEINLINE float Sqrt(float Value)
static FORCEINLINE float Exp(float Value)
static FORCEINLINE float FloorToFloat(float F)
static FORCEINLINE float LogX(float Base, float Value)
static FORCEINLINE double FloorToDouble(double F)
static FORCEINLINE float Atan(float Value)
static FORCEINLINE uint64 CeilLogTwo64(uint64 Arg)
static FORCEINLINE float Asin(float Value)
static FORCEINLINE int32 RoundToInt(float F)
static FORCEINLINE double Modf(const double InValue, double *OutIntPart)
static FORCEINLINE float Sin(float Value)
static FORCEINLINE float Frac(float Value)
static FORCEINLINE float Tan(float Value)
static FORCEINLINE uint32 RoundUpToPowerOfTwo(uint32 Arg)
static FORCEINLINE bool IsNegativeFloat(const float &A)
static CONSTEXPR FORCEINLINE T Max(const T A, const T B)
static FORCEINLINE bool IsFinite(float A)
static FORCEINLINE float Fmod(float X, float Y)
static FORCEINLINE uint32 MortonCode3(uint32 x)
static CONSTEXPR FORCEINLINE int32 TruncToInt(float F)
static FORCEINLINE float Cos(float Value)
static FORCEINLINE bool IsNegativeDouble(const double &A)
static CONSTEXPR FORCEINLINE float TruncToFloat(float F)
static FORCEINLINE uint64 CountLeadingZeros64(uint64 Value)
static FORCEINLINE int32 Rand()
static FORCEINLINE uint64 FloorLog2_64(uint64 Value)
static FORCEINLINE float Log2(float Value)
static FORCEINLINE uint32 CeilLogTwo(uint32 Arg)
static CONSTEXPR FORCEINLINE T Abs(const T A)
static CONSTEXPR FORCEINLINE T Sign(const T A)
static FORCEINLINE uint32 MortonCode2(uint32 x)
static FORCEINLINE float Pow(float A, float B)
static FORCEINLINE int32 CountBits(uint64 Bits)
static FORCEINLINE uint32 FloorLog2(uint32 Value)
static FORCEINLINE float Exp2(float Value)
static FORCEINLINE void RandInit(int32 Seed)
static FORCEINLINE int32 FloorToInt(float F)
static FORCEINLINE float Loge(float Value)
unsigned long long uint64
Definition BasicTypes.h:55
unsigned char uint8
Definition BasicTypes.h:52
decltype(nullptr) TYPE_OF_NULLPTR
Definition BasicTypes.h:77
signed short int int16
Definition BasicTypes.h:59
SelectIntPointerType< int32, int64, sizeof(void *)>::TIntPointe PTRINT)
Definition BasicTypes.h:72
unsigned short int uint16
Definition BasicTypes.h:53
unsigned int uint32
Definition BasicTypes.h:54
SelectIntPointerType< uint32, uint64, sizeof(void *)>::TIntPointe UPTRINT)
Definition BasicTypes.h:71
signed long long int64
Definition BasicTypes.h:61
Definition Actor.h:9443
int32 X
Definition IntPoint.h:17
int32 Y
Definition IntPoint.h:20
int32 Z
Definition IntVector.h:25
int32 Y
Definition IntVector.h:22
FIntVector(FVector InVector)
Definition Vector.h:936
int32 X
Definition IntVector.h:19
Definition Inventory.h:50
Definition Base.h:120
Definition Base.h:216
float G
Definition Color.h:36
float B
Definition Color.h:37
float R
Definition Color.h:35
static float UnwindRadians(float A)
static T InterpCircularOut(const T &A, const T &B, float Alpha)
static T InterpEaseInOut(const T &A, const T &B, float Alpha, float Exp)
static T InterpExpoInOut(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundToNegativeInfinity(double F)
static FORCEINLINE int32 RandRange(int32 Min, int32 Max)
static T BiLerp(const T &P00, const T &P10, const T &P01, const T &P11, const U &FracX, const U &FracY)
static T LerpStable(const T &A, const T &B, double Alpha)
static FORCEINLINE float RandRange(float InMin, float InMax)
static float UnwindDegrees(float A)
static FORCEINLINE float FastAsin(float Value)
static FORCEINLINE float RoundToNegativeInfinity(float F)
static float FindDeltaAngleRadians(float A1, float A2)
static U CubicCRSplineInterp(const U &P0, const U &P1, const U &P2, const U &P3, const float T0, const float T1, const float T2, const float T3, const float T)
static T InterpCircularInOut(const T &A, const T &B, float Alpha)
static float SmoothStep(float A, float B, float X)
static FORCEINLINE T Clamp(const T X, const T Min, const T Max)
static FORCEINLINE float RoundFromZero(float F)
static T CubicInterpSecondDerivative(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static int32 LeastCommonMultiplier(int32 a, int32 b)
static FORCEINLINE T Square(const T A)
static T Lerp(const T &A, const T &B, const U &Alpha)
static FORCEINLINE T Max3(const T A, const T B, const T C)
static T InterpEaseOut(const T &A, const T &B, float Alpha, float Exp)
static FORCEINLINE T DivideAndRoundDown(T Dividend, T Divisor)
static FORCEINLINE float RoundToZero(float F)
static FORCEINLINE int32 RandHelper(int32 A)
static int32 GreatestCommonDivisor(int32 a, int32 b)
static T InterpSinOut(const T &A, const T &B, float Alpha)
static T InterpEaseIn(const T &A, const T &B, float Alpha, float Exp)
static FORCEINLINE float RoundToPositiveInfinity(float F)
static FORCEINLINE void PolarToCartesian(const float Rad, const float Ang, float &OutX, float &OutY)
static FORCEINLINE float FRandRange(float InMin, float InMax)
static float FindDeltaAngleDegrees(float A1, float A2)
static FORCEINLINE bool IsPowerOfTwo(T Value)
static FORCEINLINE auto RadiansToDegrees(T const &RadVal) -> decltype(RadVal *(180.f/PI))
static T InterpCircularIn(const T &A, const T &B, float Alpha)
static T InterpStep(const T &A, const T &B, float Alpha, int32 Steps)
static FORCEINLINE T DivideAndRoundUp(T Dividend, T Divisor)
static T InterpExpoOut(const T &A, const T &B, float Alpha)
static T CubicInterpDerivative(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static T CubicInterp(const T &P0, const T &T0, const T &P1, const T &T1, const U &A)
static FORCEINLINE double RoundToPositiveInfinity(double F)
static FORCEINLINE void SinCos(float *ScalarSin, float *ScalarCos, float Value)
static FORCEINLINE T Min3(const T A, const T B, const T C)
static FORCEINLINE auto DegreesToRadians(T const &DegVal) -> decltype(DegVal *(PI/180.f))
static T LerpStable(const T &A, const T &B, float Alpha)
static T InterpExpoIn(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundToZero(double F)
static T InterpSinIn(const T &A, const T &B, float Alpha)
static FORCEINLINE double RoundFromZero(double F)
static T InterpSinInOut(const T &A, const T &B, float Alpha)
static FORCEINLINE bool RandBool()
static FORCEINLINE int32 Stricmp(const ANSICHAR *String1, const ANSICHAR *String2)
Definition Other.h:87
Definition Actor.h:9709
Definition Actor.h:9701
Definition Base.h:191
unsigned __int64 & PlayerDataIDField()
Definition Actor.h:5466
Definition Base.h:360
FORCEINLINE FRotator(float InPitch, float InYaw, float InRoll)
Definition Rotator.h:375
TSharedPtr< FUniqueNetId > UniqueNetId
Definition Actor.h:190
float Y
Definition Vector2D.h:22
float X
Definition Vector2D.h:19
FORCEINLINE FVector operator+(float Bias) const
Definition Vector.h:1145
FORCEINLINE FVector operator*=(float Scale)
Definition Vector.h:1210
bool operator!=(const FVector &V) const
Definition Vector.h:1176
FORCEINLINE FVector()
Definition Vector.h:41
static float Triple(const FVector &X, const FVector &Y, const FVector &Z)
Definition Vector.h:1044
static bool Orthogonal(const FVector &Normal1, const FVector &Normal2, float OrthogonalCosineThreshold=THRESH_NORMALS_ARE_ORTHOGONAL)
Definition Vector.h:1031
static bool Parallel(const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1019
FORCEINLINE FVector operator-(const FVector &V) const
Definition Vector.h:1135
FORCEINLINE FVector operator-=(const FVector &V)
Definition Vector.h:1204
FVector GetSafeNormal(float Tolerance=SMALL_NUMBER) const
Definition Vector.h:1520
static FVector VectorPlaneProject(const FVector &V, const FVector &PlaneNormal)
Definition Vector.h:1014
FVector operator/=(const FVector &V)
Definition Vector.h:1229
static bool PointsAreSame(const FVector &P, const FVector &Q)
Definition Vector.h:968
FORCEINLINE FVector(float InF)
Definition Vector.h:1062
FORCEINLINE FVector operator+=(const FVector &V)
Definition Vector.h:1198
FORCEINLINE FVector operator-() const
Definition Vector.h:1192
FORCEINLINE FVector operator^(const FVector &V) const
Definition Vector.h:1105
bool IsUniform(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1510
FORCEINLINE FVector operator-(float Bias) const
Definition Vector.h:1140
FRotator ToOrientationRotator() const
FVector(const FLinearColor &InColor)
Definition Vector.h:1072
FVector MirrorByVector(const FVector &MirrorNormal) const
Definition Vector.h:1515
FVector Reciprocal() const
Definition Vector.h:1476
static FORCEINLINE float DistSquaredXY(const FVector &V1, const FVector &V2)
Definition Vector.h:1627
float X
Definition Vector.h:27
static bool PointsAreNear(const FVector &Point1, const FVector &Point2, float Dist)
Definition Vector.h:987
bool InitFromString(const FString &InSourceString)
static FORCEINLINE float DotProduct(const FVector &A, const FVector &B)
Definition Vector.h:1125
float Y
Definition Vector.h:30
FVector ComponentMax(const FVector &Other) const
Definition Vector.h:1301
void ToDirectionAndLength(FVector &OutDir, float &OutLength) const
Definition Vector.h:1361
FORCEINLINE float operator|(const FVector &V) const
Definition Vector.h:1120
FRotator Rotation() const
FORCEINLINE FVector GetUnsafeNormal() const
Definition Vector.h:1392
FVector GetClampedToMaxSize(float MaxSize) const
Definition Vector.h:1428
FORCEINLINE FVector operator*(const FVector &V) const
Definition Vector.h:1161
void FindBestAxisVectors(FVector &Axis1, FVector &Axis2) const
float Size2D() const
Definition Vector.h:1321
FVector(FIntVector InVector)
Definition Vector.h:1077
static const FVector ZeroVector
Definition Vector.h:38
float SizeSquared2D() const
Definition Vector.h:1326
FVector GetSafeNormal2D(float Tolerance=SMALL_NUMBER) const
Definition Vector.h:1537
float & Component(int32 Index)
Definition Vector.h:1466
static FORCEINLINE float BoxPushOut(const FVector &Normal, const FVector &Size)
Definition Vector.h:1632
FVector operator/(float Scale) const
Definition Vector.h:1155
static FVector RadiansToDegrees(const FVector &RadVector)
Definition Vector.h:1052
float GetAbsMin() const
Definition Vector.h:1291
FVector2D UnitCartesianToSpherical() const
bool IsZero() const
Definition Vector.h:1339
FVector GetAbs() const
Definition Vector.h:1306
static float PointPlaneDist(const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
Definition Vector.h:997
FVector BoundToCube(float Radius) const
Definition Vector.h:1398
static FORCEINLINE float DistSquared(const FVector &V1, const FVector &V2)
Definition Vector.h:1622
FORCEINLINE FVector GetSignVector() const
Definition Vector.h:1376
FORCEINLINE FVector operator/(const FVector &V) const
Definition Vector.h:1166
static FORCEINLINE float Dist2D(const FVector &V1, const FVector &V2)
Definition Vector.h:751
FVector ComponentMin(const FVector &Other) const
Definition Vector.h:1296
float Size() const
Definition Vector.h:1311
float GetMin() const
Definition Vector.h:1286
float Z
Definition Vector.h:33
FString ToString() const
Definition Vector.h:1637
float & operator[](int32 Index)
Definition Vector.h:1235
static FORCEINLINE float Dist(const FVector &V1, const FVector &V2)
Definition Vector.h:1612
FVector GridSnap(const float &GridSz) const
static bool Coincident(const FVector &Normal1, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1025
FVector Projection() const
Definition Vector.h:1386
static bool Coplanar(const FVector &Base1, const FVector &Normal1, const FVector &Base2, const FVector &Normal2, float ParallelCosineThreshold=THRESH_NORMALS_ARE_PARALLEL)
Definition Vector.h:1037
FORCEINLINE FVector ProjectOnTo(const FVector &A) const
Definition Vector.h:1572
static FVector PointPlaneProject(const FVector &Point, const FVector &PlaneBase, const FVector &PlaneNormal)
Definition Vector.h:1007
bool IsNormalized() const
Definition Vector.h:1356
FORCEINLINE FVector ProjectOnToNormal(const FVector &Normal) const
Definition Vector.h:1577
static FVector PointPlaneProject(const FVector &Point, const FVector &A, const FVector &B, const FVector &C)
void UnwindEuler()
bool Equals(const FVector &V, float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1181
FQuat ToOrientationQuat() const
bool operator==(const FVector &V) const
Definition Vector.h:1171
FVector GetClampedToSize2D(float Min, float Max) const
Definition Vector.h:1418
float SizeSquared() const
Definition Vector.h:1316
float operator[](int32 Index) const
Definition Vector.h:1252
FVector GetClampedToSize(float Min, float Max) const
Definition Vector.h:1408
float GetAbsMax() const
Definition Vector.h:1281
static FORCEINLINE float DistSquared2D(const FVector &V1, const FVector &V2)
Definition Vector.h:770
FVector operator/=(float V)
Definition Vector.h:1216
float GetMax() const
Definition Vector.h:1276
FVector(FIntPoint A)
Definition Vector.h:1082
static FORCEINLINE FVector CrossProduct(const FVector &A, const FVector &B)
Definition Vector.h:1115
FVector operator*=(const FVector &V)
Definition Vector.h:1223
void Set(float InX, float InY, float InZ)
Definition Vector.h:1269
FORCEINLINE FVector operator+(const FVector &V) const
Definition Vector.h:1130
FORCEINLINE FVector operator*(float Scale) const
Definition Vector.h:1150
static FVector DegreesToRadians(const FVector &DegVector)
Definition Vector.h:1057
FORCEINLINE CONSTEXPR FVector(float InX, float InY, float InZ)
Definition Vector.h:1067
FORCEINLINE float CosineAngle2D(FVector B) const
Definition Vector.h:1562
bool AllComponentsEqual(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1186
FVector GetClampedToMaxSize2D(float MaxSize) const
Definition Vector.h:1447
static FORCEINLINE float DistXY(const FVector &V1, const FVector &V2)
Definition Vector.h:1617
static void CreateOrthonormalBasis(FVector &XAxis, FVector &YAxis, FVector &ZAxis)
FORCEINLINE bool IsUnit(float LengthSquaredTolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1590
FVector RotateAngleAxis(const float AngleDeg, const FVector &Axis) const
Definition Vector.h:942
bool ContainsNaN() const
Definition Vector.h:1583
float HeadingAngle() const
Definition Vector.h:1595
static float EvaluateBezier(const FVector *ControlPoints, int32 NumPoints, TArray< FVector > &OutPoints)
float Component(int32 Index) const
Definition Vector.h:1471
FORCEINLINE FVector(const FVector2D V, float InZ)
Definition Vector.h:931
bool IsNearlyZero(float Tolerance=KINDA_SMALL_NUMBER) const
Definition Vector.h:1331
FORCEINLINE FVector(EForceInit)
Definition Vector.h:1087
static FORCEINLINE float Distance(const FVector &V1, const FVector &V2)
Definition Vector.h:741
bool Normalize(float Tolerance=SMALL_NUMBER)
Definition Vector.h:1344
Definition UE.h:623
static FORCEINLINE uint64 Strtoui64(const CharType *Start, CharType **End, int32 Base)
Definition CString.h:743
static CharType * Stristr(CharType *Str, const CharType *Find)
Definition CString.h:228
static FORCEINLINE CharType * Strstr(CharType *String, const CharType *Find)
Definition CString.h:591
static FORCEINLINE const CharType * Strstr(const CharType *String, const CharType *Find)
Definition CString.h:584
static FORCEINLINE double Atod(const CharType *String)
Definition CString.h:722
static FORCEINLINE int32 Stricmp(const CharType *String1, const CharType *String2)
Definition CString.h:563
static FORCEINLINE int32 Strnicmp(const CharType *String1, const CharType *String2, SIZE_T Count)
Definition CString.h:570
static FORCEINLINE float Atof(const CharType *String)
Definition CString.h:715
static FORCEINLINE int32 Strlen(const CharType *String)
Definition CString.h:577
static FORCEINLINE int32 Atoi(const CharType *String)
Definition CString.h:701
static FORCEINLINE int32 Strncmp(const CharType *String1, const CharType *String2, SIZE_T Count)
Definition CString.h:556
static FORCEINLINE int32 Strtoi(const CharType *Start, CharType **End, int32 Base)
Definition CString.h:729
static const CharType * Stristr(const CharType *Str, const CharType *Find)
Definition CString.h:485
static FORCEINLINE int64 Atoi64(const CharType *String)
Definition CString.h:708
static FORCEINLINE int32 Strcmp(const CharType *String1, const CharType *String2)
Definition CString.h:549
static CharType ToLower(CharType Char)
static bool IsWhitespace(CharType Char)
static CharType ToUpper(CharType Char)
static void FromString(T &Value, const TCHAR *Buffer)
Definition FString.h:1907
static FString ToSanitizedString(const T &Value)
Definition FString.h:1902
static FString ToString(const T &Value)
Definition FString.h:1901
T * Get(bool bEvenIfPendingKill=false)
Definition UE.h:172
FORCEINLINE T * operator->()
Definition UE.h:167
Definition UE.h:399
UObject * GetDefaultObject(bool bCreateIfNeeded)
Definition UE.h:415
static FORCEINLINE bool Compare(TCHAR Lhs, TCHAR Rhs)
Definition FString.h:1926
static FORCEINLINE bool Compare(TCHAR Lhs, TCHAR Rhs)
Definition FString.h:1918
Definition UE.h:343
Definition Base.h:215
UClass * ClassField()
Definition UE.h:277
FString * GetFullName(FString *result, UObject *StopOuter)
Definition UE.h:296
bool IsA(UClass *SomeBase)
Definition UE.h:299
Definition UE.h:306
Definition Other.h:211
UPrimalGameData * PrimalGameDataOverrideField()
Definition GameMode.h:878
UPrimalGameData * PrimalGameDataField()
Definition GameMode.h:877
FPrimalPlayerDataStruct * MyDataField()
Definition Actor.h:5507
FVector * GetWorldLocation(FVector *result)
Definition Actor.h:523
Definition UE.h:355
Definition UE.h:817
static TArray< AActor * > * ServerOctreeOverlapActors(TArray< AActor * > *result, UWorld *theWorld, FVector AtLoc, float Radius, EServerOctreeGroup::Type OctreeType, bool bForceActorLocationDistanceCheck)
Definition Other.h:410
TArray< TAutoWeakObjectPtr< APlayerController > > & PlayerControllerListField()
Definition GameMode.h:425
APlayerController * GetFirstPlayerController()
Definition GameMode.h:538
AGameState * GameStateField()
Definition GameMode.h:409