diff --git a/modules/openapi-generator/src/main/resources/cpp-ue4/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-ue4/helpers-header.mustache index d215ccea289f..c991f9269fd4 100644 --- a/modules/openapi-generator/src/main/resources/cpp-ue4/helpers-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-ue4/helpers-header.mustache @@ -197,6 +197,30 @@ inline FString CollectionToUrlString_multi(const TArray& Collection, const TC return Output; } + +template +inline FString CollectionToUrlString_multi(const TSet& Collection, const TCHAR* BaseName) +{ + FString Output; + if (Collection.Num() == 0) + { + return Output; + } + + int32 Index = 0; + for (typename TSet::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& Value) diff --git a/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h b/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h index bee0e29dcfd0..36da668b4313 100644 --- a/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h +++ b/samples/client/petstore/cpp-ue4/Public/OpenAPIHelpers.h @@ -206,6 +206,30 @@ inline FString CollectionToUrlString_multi(const TArray& Collection, const TC return Output; } + +template +inline FString CollectionToUrlString_multi(const TSet& Collection, const TCHAR* BaseName) +{ + FString Output; + if (Collection.Num() == 0) + { + return Output; + } + + int32 Index = 0; + for (typename TSet::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& Value)