Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp-ue4] Fix generated code not compiling when using unique array items #17684

Merged
merged 4 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,30 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
return Output;
}


template <typename T>
inline FString CollectionToUrlString_multi(const TSet<T>& Collection, const TCHAR* BaseName)
{
FString Output;
if (Collection.Num() == 0)
{
return Output;
}

int32 Index = 0;
for (typename TSet<T>::TConstIterator Iter = Collection.CreateConstIterator(); Iter; ++Iter)
{
if (Index == 0)
{
Output += FString::Format(TEXT("{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
Index++;
continue;
}
Output += FString::Format(TEXT("&{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
}
return Output;
}

//////////////////////////////////////////////////////////////////////////

inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonValue>& Value)
Expand Down
24 changes: 24 additions & 0 deletions samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,30 @@ inline FString CollectionToUrlString_multi(const TArray<T>& Collection, const TC
return Output;
}


template <typename T>
inline FString CollectionToUrlString_multi(const TSet<T>& Collection, const TCHAR* BaseName)
{
FString Output;
if (Collection.Num() == 0)
{
return Output;
}

int32 Index = 0;
for (typename TSet<T>::TConstIterator Iter = Collection.CreateConstIterator(); Iter; ++Iter)
{
if (Index == 0)
{
Output += FString::Format(TEXT("{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
Index++;
continue;
}
Output += FString::Format(TEXT("&{0}={1}"), { FStringFormatArg(BaseName), ToUrlString(*Iter) });
}
return Output;
}

//////////////////////////////////////////////////////////////////////////

inline void WriteJsonValue(JsonWriter& Writer, const TSharedPtr<FJsonValue>& Value)
Expand Down
Loading