Skip to content

Commit

Permalink
Support FGuid with helpers (#9291)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwittner authored Apr 20, 2021
1 parent 51028f0 commit 28e0d9b
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ inline FStringFormatArg ToStringFormatArg(const FDateTime& Value)
return FStringFormatArg(Value.ToIso8601());
}

inline FStringFormatArg ToStringFormatArg(const FGuid& Value)
{
return FStringFormatArg(Value.ToString(EGuidFormats::DigitsWithHyphens));
}

inline FStringFormatArg ToStringFormatArg(const TArray<uint8>& Value)
{
return FStringFormatArg(Base64UrlEncode(Value));
Expand Down Expand Up @@ -220,6 +225,11 @@ inline void WriteJsonValue(JsonWriter& Writer, const FDateTime& Value)
Writer->WriteValue(Value.ToIso8601());
}

inline void WriteJsonValue(JsonWriter& Writer, const FGuid& Value)
{
Writer->WriteValue(Value.ToString(EGuidFormats::DigitsWithHyphens));
}

inline void WriteJsonValue(JsonWriter& Writer, const Model& Value)
{
Value.WriteJson(Writer);
Expand Down Expand Up @@ -281,6 +291,17 @@ inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FDateTime&
return false;
}

inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, FGuid& Value)
{
FString TmpValue;
if (JsonValue->TryGetString(TmpValue))
{
return FGuid::Parse(TmpValue, Value);
}
else
return false;
}

inline bool TryGetJsonValue(const TSharedPtr<FJsonValue>& JsonValue, bool& Value)
{
bool TmpValue;
Expand Down

0 comments on commit 28e0d9b

Please sign in to comment.