UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
JsonReader.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
10#include "Misc/StringBuilder.h"
11
12class Error;
13
14#define JSON_NOTATIONMAP_DEF \
15static EJsonNotation TokenToNotationTable[] = \
16{ \
17 EJsonNotation::Error, /*EJsonToken::None*/ \
18 EJsonNotation::Error, /*EJsonToken::Comma*/ \
19 EJsonNotation::ObjectStart, /*EJsonToken::CurlyOpen*/ \
20 EJsonNotation::ObjectEnd, /*EJsonToken::CurlyClose*/ \
21 EJsonNotation::ArrayStart, /*EJsonToken::SquareOpen*/ \
22 EJsonNotation::ArrayEnd, /*EJsonToken::SquareClose*/ \
23 EJsonNotation::Error, /*EJsonToken::Colon*/ \
24 EJsonNotation::String, /*EJsonToken::String*/ \
25 EJsonNotation::Number, /*EJsonToken::Number*/ \
26 EJsonNotation::Boolean, /*EJsonToken::True*/ \
27 EJsonNotation::Boolean, /*EJsonToken::False*/ \
28 EJsonNotation::Null, /*EJsonToken::Null*/ \
29};
30
31#ifndef WITH_JSON_INLINED_NOTATIONMAP
32#define WITH_JSON_INLINED_NOTATIONMAP 0
33#endif // WITH_JSON_INLINED_NOTATIONMAP
34
35#if !WITH_JSON_INLINED_NOTATIONMAP
37#endif // WITH_JSON_INLINED_NOTATIONMAP
38
39template <class CharType = TCHAR>
41{
42public:
43 // Store ANSICHAR in FUtf8String because JSON may contain scaped unicode characters that would not be recoverable otherwise. Use default string type for the char type otherwise
44 using StoredStringType = std::conditional_t<std::is_same_v<CharType, ANSICHAR>, FUtf8String, TString<CharType>>;
46 using ValueAsStringReturnType = std::conditional_t<std::is_same_v<StoredStringType, FString>, const FString&, FString>;
47
52
53public:
54
55 virtual ~TJsonReader() {}
56
58 {
59 if (!ErrorMessage.IsEmpty())
60 {
62 return false;
63 }
64
65 if (Stream == nullptr)
66 {
68 SetErrorMessage(TEXT("Null Stream"));
69 return true;
70 }
71
72 const bool AtEndOfStream = Stream->AtEnd();
73
75 {
77 SetErrorMessage(TEXT("Improperly formatted."));
78 return true;
79 }
80
82 {
84 SetErrorMessage(TEXT("Unexpected additional input found."));
85 return true;
86 }
87
88 if (AtEndOfStream)
89 {
90 return false;
91 }
92
93 bool ReadWasSuccess = false;
94 Identifier.Empty();
95
96 do
97 {
98 EJson CurrentState = EJson::None;
99
100 if (ParseState.Num() > 0)
101 {
102 CurrentState = ParseState.Top();
103 }
104
105 switch (CurrentState)
106 {
107 case EJson::Array:
108 ReadWasSuccess = ReadNextArrayValue( /*OUT*/ CurrentToken );
109 break;
110
111 case EJson::Object:
112 ReadWasSuccess = ReadNextObjectValue( /*OUT*/ CurrentToken );
113 break;
114
115 case EJson::None:
116 case EJson::Null:
117 case EJson::String:
118 case EJson::Number:
119 case EJson::Boolean:
120 default:
121 ReadWasSuccess = ReadStart( /*OUT*/ CurrentToken );
122 break;
123 }
124 }
126
127#if WITH_JSON_INLINED_NOTATIONMAP
129#endif // WITH_JSON_INLINED_NOTATIONMAP
130
133
135 {
137
138 if (ErrorMessage.IsEmpty())
139 {
140 SetErrorMessage(TEXT("Unknown Error Occurred"));
141 }
142
143 return true;
144 }
145
147 {
148 ReadWasSuccess = ParseWhiteSpace();
149 }
150
151 return ReadWasSuccess;
152 }
153
155 {
156 return ReadUntilMatching(EJsonNotation::ObjectEnd);
157 }
158
160 {
161 return ReadUntilMatching(EJsonNotation::ArrayEnd);
162 }
163
164 inline virtual const FString& GetIdentifier() const { return Identifier; }
165
167 {
169 if constexpr (std::is_same_v<StoredStringType, FString>)
170 {
171 return StringValue;
172 }
173 else
174 {
175 // Construct FString from a different string type
176 return FString(StringValue);
177 }
178 }
179
180 inline virtual const StoredStringType& GetInternalValueAsString() const
181 {
183 return StringValue;
184 }
185
191
192 inline double GetValueAsNumber() const
193 {
195 return NumberValue;
196 }
197
199 {
201 return StringValue;
202 }
203
204 inline bool GetValueAsBoolean() const
205 {
207 return BoolValue;
208 }
209
210 inline const FString& GetErrorMessage() const
211 {
212 return ErrorMessage;
213 }
214
215 inline const uint32 GetLineNumber() const
216 {
217 return LineNumber;
218 }
219
220 inline const uint32 GetCharacterNumber() const
221 {
222 return CharacterNumber;
223 }
224
225protected:
226
229 : ParseState()
231 , Stream( nullptr )
232 , Identifier()
233 , ErrorMessage()
234 , StringValue()
235 , NumberValue( 0.0f )
236 , LineNumber( 1 )
237 , CharacterNumber( 0 )
238 , BoolValue( false )
240 { }
241
248 : ParseState()
251 , Identifier()
252 , ErrorMessage()
253 , StringValue()
254 , NumberValue(0.0f)
255 , LineNumber(1)
256 , CharacterNumber(0)
259 { }
260
261private:
262
263 void SetErrorMessage( const FString& Message )
264 {
265 ErrorMessage = Message + FString::Printf(TEXT(" Line: %u Ch: %u"), LineNumber, CharacterNumber);
266 }
267
268 bool ReadUntilMatching( const EJsonNotation ExpectedNotation )
269 {
270 uint32 ScopeCount = 0;
272
273 while (ReadNext(Notation))
274 {
275 if ((ScopeCount == 0) && (Notation == ExpectedNotation))
276 {
277 return true;
278 }
279
280 switch (Notation)
281 {
284 ++ScopeCount;
285 break;
286
289 --ScopeCount;
290 break;
291
296 break;
297
299 return false;
300 break;
301 }
302 }
303
304 return !Stream->IsError();
305 }
306
307 bool ReadStart( EJsonToken& Token )
308 {
309 if (!ParseWhiteSpace())
310 {
311 return false;
312 }
313
314 Token = EJsonToken::None;
315
316 if (NextToken(Token) == false)
317 {
318 return false;
319 }
320
321 if ((Token != EJsonToken::CurlyOpen) && (Token != EJsonToken::SquareOpen))
322 {
323 SetErrorMessage(TEXT("Open Curly or Square Brace token expected, but not found."));
324 return false;
325 }
326
327 return true;
328 }
329
330 bool ReadNextObjectValue( EJsonToken& Token )
331 {
332 const bool bCommaPrepend = Token != EJsonToken::CurlyOpen;
333 Token = EJsonToken::None;
334
335 if (NextToken(Token) == false)
336 {
337 return false;
338 }
339
340 if (Token == EJsonToken::CurlyClose)
341 {
342 return true;
343 }
344 else
345 {
346 if (bCommaPrepend)
347 {
348 if (Token != EJsonToken::Comma)
349 {
350 SetErrorMessage( TEXT("Comma token expected, but not found.") );
351 return false;
352 }
353
354 Token = EJsonToken::None;
355
356 if (!NextToken(Token))
357 {
358 return false;
359 }
360 }
361
362 if (Token != EJsonToken::String)
363 {
364 SetErrorMessage( TEXT("String token expected, but not found.") );
365 return false;
366 }
367
368 // Move value if possible. A conversion will happen if StringValue is not an FString
369 Identifier = FString(MoveTemp(StringValue));
370 Token = EJsonToken::None;
371
372 if (!NextToken(Token))
373 {
374 return false;
375 }
376
377 if (Token != EJsonToken::Colon)
378 {
379 SetErrorMessage( TEXT("Colon token expected, but not found.") );
380 return false;
381 }
382
383 Token = EJsonToken::None;
384
385 if (!NextToken(Token))
386 {
387 return false;
388 }
389 }
390
391 return true;
392 }
393
394 bool ReadNextArrayValue( EJsonToken& Token )
395 {
396 const bool bCommaPrepend = Token != EJsonToken::SquareOpen;
397
398 Token = EJsonToken::None;
399
400 if (!NextToken(Token))
401 {
402 return false;
403 }
404
405 if (Token == EJsonToken::SquareClose)
406 {
407 return true;
408 }
409 else
410 {
411 if (bCommaPrepend)
412 {
413 if (Token != EJsonToken::Comma)
414 {
415 SetErrorMessage( TEXT("Comma token expected, but not found.") );
416 return false;
417 }
418
419 Token = EJsonToken::None;
420
421 if (!NextToken(Token))
422 {
423 return false;
424 }
425 }
426 }
427
428 return true;
429 }
430
431 bool NextToken( EJsonToken& OutToken )
432 {
433 while (!Stream->AtEnd())
434 {
435 CharType Char;
436 if (!Serialize(&Char, sizeof(CharType)))
437 {
438 return false;
439 }
441
442 if (Char == CharType('\0'))
443 {
444 break;
445 }
446
447 if (IsLineBreak(Char))
448 {
449 ++LineNumber;
450 CharacterNumber = 0;
451 }
452
453 if (!IsWhitespace(Char))
454 {
455 if (IsJsonNumber(Char))
456 {
457 bool bParseNumberSucceed = ParseNumberToken(Char);
458 if (!bParseNumberSucceed && Char != '-') // Could be -NaN, will return false when fail to parse it as -NaN later on
459 {
460 return false;
461 }
462
464 {
466 return true;
467 }
468 }
469
470 switch (Char)
471 {
472 case CharType('{'):
474 return true;
475
476 case CharType('}'):
477 {
479 if (ParseState.Num())
480 {
481 ParseState.Pop();
482 return true;
483 }
484 else
485 {
486 SetErrorMessage(TEXT("Unknown state reached while parsing Json token."));
487 return false;
488 }
489 }
490
491 case CharType('['):
493 return true;
494
495 case CharType(']'):
496 {
498 if (ParseState.Num())
499 {
500 ParseState.Pop();
501 return true;
502 }
503 else
504 {
505 SetErrorMessage(TEXT("Unknown state reached while parsing Json token."));
506 return false;
507 }
508 }
509
510 case CharType(':'):
512 return true;
513
514 case CharType(','):
516 return true;
517
518 case CharType('\"'):
519 {
520 if (!ParseStringToken())
521 {
522 return false;
523 }
524
526 }
527 return true;
528
529 case CharType('t'): case CharType('T'):
530 case CharType('f'): case CharType('F'):
531 case CharType('n'): case CharType('N'):
532 case CharType('-'):
533 {
535 Test += Char;
536
537 while (!Stream->AtEnd())
538 {
539 if (!Serialize(&Char, sizeof(CharType)))
540 {
541 return false;
542 }
543
544 if (IsAlphaNumber(Char)
545 || Char == '(' || Char == ')') // Could be "-nan(ind)" depending on the platform and impl of standard library when write
546 {
548 Test += Char;
549 }
550 else
551 {
552 // backtrack and break
553 Stream->Seek(Stream->Tell() - sizeof(CharType));
554 break;
555 }
556 }
557
558 if (Test == CHARTEXT(CharType, "False"))
559 {
560 BoolValue = false;
562 return true;
563 }
564
565 if (Test == CHARTEXT(CharType, "True"))
566 {
567 BoolValue = true;
569 return true;
570 }
571
572 if (Test == CHARTEXT(CharType, "Null"))
573 {
575 return true;
576 }
577
578 if (Test.Compare(CHARTEXT(CharType, "NaN"), ESearchCase::IgnoreCase) == 0)
579 {
580 NumberValue = std::numeric_limits<double>::quiet_NaN();
582 return true;
583 }
584
585 if (Test.Compare(TEXT("-NaN"), ESearchCase::IgnoreCase) == 0 ||
586 Test.Compare(TEXT("-NaN(ind)"), ESearchCase::IgnoreCase) == 0)
587 {
588 NumberValue = -std::numeric_limits<double>::quiet_NaN();
590 return true;
591 }
592
593 SetErrorMessage( TEXT("Invalid Json Token. Check that your member names have quotes around them!") );
594 return false;
595 }
596
597 default:
598 SetErrorMessage( TEXT("Invalid Json Token.") );
599 return false;
600 }
601 }
602 }
603
604 SetErrorMessage( TEXT("Invalid Json Token.") );
605 return false;
606 }
607
608 bool ParseStringToken()
609 {
612
613 // Add escaped surrogate pairs
614 auto ConditionallyAddCodePoints = [&StringBuffer, &UTF16CodePoints]() -> void
615 {
616 if (UTF16CodePoints.Len() > 0)
617 {
618 // Will convert to StoredCharType encoding if needed
619 StringBuffer.Append(UTF16CodePoints);
621 }
622 };
623
624 while (true)
625 {
626 if (Stream->AtEnd())
627 {
628 SetErrorMessage( TEXT("String Token Abruptly Ended.") );
629 return false;
630 }
631
632 CharType Char;
633 if (!Serialize(&Char, sizeof(CharType)))
634 {
635 return false;
636 }
638
639 if (Char == CharType('\"'))
640 {
642 break;
643 }
644
645 if (Char == CharType('\\'))
646 {
647 if (!Serialize(&Char, sizeof(CharType)))
648 {
649 return false;
650 }
652
653 if (Char != CharType('u'))
654 {
656 }
657
658 switch (Char)
659 {
660 case CharType('\"'): case CharType('\\'): case CharType('/'): StringBuffer.AppendChar(Char); break;
661 case CharType('f'): StringBuffer.AppendChar(CharType('\f')); break;
662 case CharType('r'): StringBuffer.AppendChar(CharType('\r')); break;
663 case CharType('n'): StringBuffer.AppendChar(CharType('\n')); break;
664 case CharType('b'): StringBuffer.AppendChar(CharType('\b')); break;
665 case CharType('t'): StringBuffer.AppendChar(CharType('\t')); break;
666 case CharType('u'):
667 // 4 hex digits, like \uAB23, which is a 16 bit number that we would usually see as 0xAB23
668 {
669 int32 HexNum = 0;
670
671 for (int32 Radix = 3; Radix >= 0; --Radix)
672 {
673 if (Stream->AtEnd())
674 {
675 SetErrorMessage( TEXT("String Token Abruptly Ended.") );
676 return false;
677 }
678
679 if (!Serialize(&Char, sizeof(CharType)))
680 {
681 return false;
682 }
684
685 int32 HexDigit = FParse::HexDigit(Char);
686
687 if ((HexDigit == 0) && (Char != CharType('0')))
688 {
689 SetErrorMessage( TEXT("Invalid Hexadecimal digit parsed.") );
690 return false;
691 }
692
693 //@TODO: FLOATPRECISION: this is gross
694 HexNum += HexDigit * (int32)FMath::Pow(16.f, (float)Radix);
695 }
696
697 UTF16CodePoints.AppendChar((UTF16CHAR)HexNum);
698 }
699 break;
700
701 default:
702 SetErrorMessage( TEXT("Bad Json escaped char.") );
703 return false;
704 }
705 }
706 else
707 {
709 StringBuffer.AppendChar(Char);
710 }
711 }
712
713 StringValue = StoredStringType(StringBuffer);
714
715 // Inline combine any surrogate pairs in the data when loading into a UTF-32 string
717
718 return true;
719 }
720
721 bool ParseNumberToken( CharType FirstChar )
722 {
724 int32 State = 0;
725 bool UseFirstChar = true;
726 bool StateError = false;
727
728 while (true)
729 {
730 if (Stream->AtEnd())
731 {
732 SetErrorMessage( TEXT("Number Token Abruptly Ended.") );
733 return false;
734 }
735
736 CharType Char;
737 if (UseFirstChar)
738 {
739 Char = FirstChar;
740 UseFirstChar = false;
741 }
742 else
743 {
744 if (!Serialize(&Char, sizeof(CharType)))
745 {
746 return false;
747 }
749 }
750
751 // The following code doesn't actually derive the Json Number: that is handled
752 // by the function FPlatformString::Atod below. This code only ensures the Json Number is
753 // EXACTLY to specification
754 if (IsJsonNumber(Char))
755 {
756 // ensure number follows Json format before converting
757 // This switch statement is derived from a finite state automata
758 // derived from the Json spec. A table was not used for simplicity.
759 switch (State)
760 {
761 case 0:
762 if (Char == CharType('-')) { State = 1; }
763 else if (Char == CharType('0')) { State = 2; }
764 else if (IsNonZeroDigit(Char)) { State = 3; }
765 else { StateError = true; }
766 break;
767
768 case 1:
769 if (Char == CharType('0')) { State = 2; }
770 else if (IsNonZeroDigit(Char)) { State = 3; }
771 else { StateError = true; }
772 break;
773
774 case 2:
775 if (Char == CharType('.')) { State = 4; }
776 else if (Char == CharType('e') || Char == CharType('E')) { State = 5; }
777 else { StateError = true; }
778 break;
779
780 case 3:
781 if (IsDigit(Char)) { State = 3; }
782 else if (Char == CharType('.')) { State = 4; }
783 else if (Char == CharType('e') || Char == CharType('E')) { State = 5; }
784 else { StateError = true; }
785 break;
786
787 case 4:
788 if (IsDigit(Char)) { State = 6; }
789 else { StateError = true; }
790 break;
791
792 case 5:
793 if (Char == CharType('-') ||Char == CharType('+')) { State = 7; }
794 else if (IsDigit(Char)) { State = 8; }
795 else { StateError = true; }
796 break;
797
798 case 6:
799 if (IsDigit(Char)) { State = 6; }
800 else if (Char == CharType('e') || Char == CharType('E')) { State = 5; }
801 else { StateError = true; }
802 break;
803
804 case 7:
805 if (IsDigit(Char)) { State = 8; }
806 else { StateError = true; }
807 break;
808
809 case 8:
810 if (IsDigit(Char)) { State = 8; }
811 else { StateError = true; }
812 break;
813
814 default:
815 SetErrorMessage( TEXT("Unknown state reached in Json Number Token.") );
816 return false;
817 }
818
819 if (StateError)
820 {
821 break;
822 }
823
824 String += Char;
825 }
826 else
827 {
828 // backtrack once because we read a non-number character
829 Stream->Seek(Stream->Tell() - sizeof(CharType));
831 // and now the number is fully tokenized
832 break;
833 }
834 }
835
836 // ensure the number has followed valid Json format
837 if (!StateError && ((State == 2) || (State == 3) || (State == 6) || (State == 8)))
838 {
840 NumberValue = FPlatformString::Atod(*String);
841 return true;
842 }
843
844 if (FirstChar != '-') // Could be -NaN, will set the error message when fail to parse it as -NaN later on
845 {
846 SetErrorMessage( TEXT("Poorly formed Json Number Token.") );
847 }
848
849 return false;
850 }
851
852 bool ParseWhiteSpace()
853 {
854 while (!Stream->AtEnd())
855 {
856 CharType Char;
857 if (!Serialize(&Char, sizeof(CharType)))
858 {
859 return false;
860 }
862
863 if (IsLineBreak(Char))
864 {
865 ++LineNumber;
866 CharacterNumber = 0;
867 }
868
869 if (!IsWhitespace(Char))
870 {
871 // backtrack and break
872 Stream->Seek(Stream->Tell() - sizeof(CharType));
874 break;
875 }
876 }
877 return true;
878 }
879
880 bool IsLineBreak( const CharType& Char )
881 {
882 return Char == CharType('\n');
883 }
884
886 bool IsWhitespace( const CharType& Char )
887 {
888 return Char == CharType(' ') || Char == CharType('\t') || Char == CharType('\n') || Char == CharType('\r');
889 }
890
892 bool IsJsonNumber( const CharType& Char )
893 {
894 return ((Char >= CharType('0') && Char <= CharType('9')) ||
895 Char == CharType('-') || Char == CharType('.') || Char == CharType('+') || Char == CharType('e') || Char == CharType('E'));
896 }
897
899 bool IsDigit( const CharType& Char )
900 {
901 return (Char >= CharType('0') && Char <= CharType('9'));
902 }
903
904 bool IsNonZeroDigit( const CharType& Char )
905 {
906 return (Char >= CharType('1') && Char <= CharType('9'));
907 }
908
910 bool IsAlphaNumber( const CharType& Char )
911 {
912 return (Char >= CharType('a') && Char <= CharType('z')) || (Char >= CharType('A') && Char <= CharType('Z'));
913 }
914
915protected:
916 bool Serialize(void* V, int64 Length)
917 {
919 if (Stream->IsError())
920 {
921 SetErrorMessage(TEXT("Stream I/O Error"));
922 return false;
923 }
924 return true;
925 }
926
927 template <typename Type>
929 {
930 if constexpr (std::is_same_v<Type, FString>)
931 {
933 }
934 }
935protected:
936
939
941 FString Identifier;
949};
950
951
952template <typename CharType>
954 : public TJsonReader<CharType>
955{
956public:
958 {
959 return MakeShareable(new TJsonStringReader(JsonString));
960 }
961
963 {
964 return MakeShareable(new TJsonStringReader(MoveTemp(JsonString)));
965 }
966
968 {
969 return Content;
970 }
971public:
972
973 virtual ~TJsonStringReader() = default;
974
975protected:
976
982 explicit TJsonStringReader(const TString<CharType>& JsonString)
983 : Content(JsonString)
984 , Reader(nullptr)
985 {
986 InitReader();
987 }
988
995 : Content(MoveTemp(JsonString))
996 , Reader(nullptr)
997 {
998 InitReader();
999 }
1000
1001 inline void InitReader()
1002 {
1003 if (Content.IsEmpty())
1004 {
1005 return;
1006 }
1007
1008 Reader = MakeUnique<FBufferReader>((void*)*Content, Content.Len() * sizeof(CharType), false);
1009 this->Stream = Reader.Get();
1010 }
1011
1012protected:
1013 const TString<CharType> Content;
1015};
1016
1018
1019template <class CharType>
1021 : public TJsonReader<CharType>
1022{
1023public:
1024
1026 {
1027 return MakeShareable(new TJsonStringViewReader(JsonString));
1028 }
1029
1030public:
1031
1032 virtual ~TJsonStringViewReader() = default;
1033
1034protected:
1035
1042 : Content(JsonString)
1043 , Reader(nullptr)
1044 {
1045 InitReader();
1046 }
1047
1049 {
1050 if (Content.IsEmpty())
1051 {
1052 return;
1053 }
1054
1055 Reader = MakeUnique<FBufferReader>((void*)Content.GetData(), Content.Len() * sizeof(CharType), false);
1057 }
1058
1059protected:
1062};
1063
1064template <class CharType = TCHAR>
#define check(expr)
Definition AssertionMacros.h:314
#define TEXT(x)
Definition Platform.h:1272
#define CHARTEXT(CharType, x)
Definition Platform.h:1291
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::CHAR16 UTF16CHAR
A 16-bit character containing a UTF16 (Unicode, 16-bit, variable-width) code unit.
Definition Platform.h:1141
SharedPointerInternals::TRawPtrProxy< ObjectType > MakeShareable(ObjectType *InObject)
Definition SharedPointer.h:1947
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
typename TElementType< T >::Type TElementType_T
Definition ElementType.h:57
#define JSON_NOTATIONMAP_DEF
Definition JsonReader.h:14
EJsonNotation
Definition JsonTypes.h:60
EJsonToken
Definition JsonTypes.h:35
EJson
Definition JsonTypes.h:23
@ Char
Character type.
UE_INTRINSIC_CAST UE_REWRITE constexpr std::remove_reference_t< T > && MoveTemp(T &&Obj) noexcept
Definition UnrealTemplate.h:520
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
virtual void Serialize(void *V, int64 Length)
Definition Archive.h:1689
virtual int64 Tell()
Definition Archive.h:149
virtual bool AtEnd()
Definition Archive.h:161
virtual void Seek(int64 InPos)
Definition Archive.h:1753
UE_FORCEINLINE_HINT bool IsError() const
Definition Archive.h:362
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT void Push(ElementType &&Item)
Definition Array.h:1224
ElementType Pop(EAllowShrinking AllowShrinking=UE::Core::Private::AllowShrinkingByDefault< AllocatorType >())
Definition Array.h:1196
UE_NODEBUG UE_FORCEINLINE_HINT ElementType & Top() UE_LIFETIMEBOUND
Definition Array.h:1248
Definition JsonReader.h:1066
static TSharedRef< TJsonReader< TElementType_T< StringType > > > Create(StringType &&JsonString)
Definition JsonReader.h:1070
static TSharedRef< TJsonReader< CharType > > CreateFromView(TStringView< CharType > JsonString)
Definition JsonReader.h:1085
static TSharedRef< TJsonReader< CharType > > Create(FArchive *const Stream)
Definition JsonReader.h:1080
TString< CharType > StringType
Definition JsonReader.h:1068
static TSharedRef< TJsonReader< TElementType_T< StringType > > > Create(const StringType &JsonString)
Definition JsonReader.h:1075
Definition JsonReader.h:41
bool BoolValue
Definition JsonReader.h:947
virtual ValueAsStringReturnType GetValueAsString() const
Definition JsonReader.h:166
uint32 LineNumber
Definition JsonReader.h:945
virtual const StoredStringType & GetInternalValueAsString() const
Definition JsonReader.h:180
double GetValueAsNumber() const
Definition JsonReader.h:192
bool SkipArray()
Definition JsonReader.h:159
bool Serialize(void *V, int64 Length)
Definition JsonReader.h:916
TJsonReader(FArchive *InStream)
Definition JsonReader.h:247
std::conditional_t< std::is_same_v< CharType, ANSICHAR >, FUtf8String, TString< CharType > > StoredStringType
Definition JsonReader.h:44
FString ErrorMessage
Definition JsonReader.h:942
virtual StoredStringType StealInternalValueAsString()
Definition JsonReader.h:186
TElementType_T< StoredStringType > StoredCharType
Definition JsonReader.h:45
const uint32 GetCharacterNumber() const
Definition JsonReader.h:220
EJsonToken CurrentToken
Definition JsonReader.h:938
void InlineCombineSurrogates(Type &String)
Definition JsonReader.h:928
uint32 CharacterNumber
Definition JsonReader.h:946
bool ReadNext(EJsonNotation &Notation)
Definition JsonReader.h:57
const FString & GetErrorMessage() const
Definition JsonReader.h:210
bool GetValueAsBoolean() const
Definition JsonReader.h:204
FString Identifier
Definition JsonReader.h:941
FArchive * Stream
Definition JsonReader.h:940
bool SkipObject()
Definition JsonReader.h:154
TArray< EJson > ParseState
Definition JsonReader.h:937
StoredStringType StringValue
Definition JsonReader.h:943
const StoredStringType & GetValueAsNumberString() const
Definition JsonReader.h:198
double NumberValue
Definition JsonReader.h:944
virtual const FString & GetIdentifier() const
Definition JsonReader.h:164
bool FinishedReadingRootObject
Definition JsonReader.h:948
virtual ~TJsonReader()
Definition JsonReader.h:55
TJsonReader()
Definition JsonReader.h:228
static TSharedRef< TJsonReader< CharType > > Create(FArchive *const Stream)
Definition JsonReader.h:48
std::conditional_t< std::is_same_v< StoredStringType, FString >, const FString &, FString > ValueAsStringReturnType
Definition JsonReader.h:46
const uint32 GetLineNumber() const
Definition JsonReader.h:215
Definition JsonReader.h:955
static TSharedRef< TJsonStringReader > Create(TString< CharType > &&JsonString)
Definition JsonReader.h:962
TJsonStringReader(const TString< CharType > &JsonString)
Definition JsonReader.h:982
TUniquePtr< FBufferReader > Reader
Definition JsonReader.h:1014
virtual ~TJsonStringReader()=default
TJsonStringReader(TString< CharType > &&JsonString)
Definition JsonReader.h:994
void InitReader()
Definition JsonReader.h:1001
static TSharedRef< TJsonStringReader > Create(const TString< CharType > &JsonString)
Definition JsonReader.h:957
const TString< CharType > Content
Definition JsonReader.h:1013
const TString< CharType > & GetSourceString() const
Definition JsonReader.h:967
Definition JsonReader.h:1022
TJsonStringViewReader(TStringView< CharType > JsonString)
Definition JsonReader.h:1041
virtual ~TJsonStringViewReader()=default
static TSharedRef< TJsonStringViewReader > Create(TStringView< CharType > JsonString)
Definition JsonReader.h:1025
TUniquePtr< FBufferReader > Reader
Definition JsonReader.h:1061
void InitReader()
Definition JsonReader.h:1048
TStringView< CharType > Content
Definition JsonReader.h:1060
Definition SharedPointer.h:153
BuilderType & AppendChar(AppendedCharType Char)
Definition StringBuilder.h:260
BuilderType & Append(const OtherCharType *const String, const int32 Length)
Definition StringBuilder.h:238
void Reset()
Definition StringBuilder.h:190
Definition StringBuilder.h:509
Definition StringView.h:107
Definition UniquePtr.h:107
UE_FORCEINLINE_HINT T * Get() const
Definition UniquePtr.h:324
@ IgnoreCase
Definition CString.h:26
CORE_API void InlineCombineSurrogates(FString &Str)
Definition String.cpp:49
Definition TestUtils.cpp:8
State
Definition PacketHandler.h:88
@ false
Definition radaudio_common.h:23
static int32 HexDigit(TCHAR c)
Definition Parse.h:152