mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-03-10 08:31:23 +00:00
[cpp-ue4] Fix generated code not compiling when using unique array items (#17684)
* Add CollectionToUrlString for TSet Added a template for converting collection to url string parameters for associative container * Add generated samples * Add TSet template * Fix iterator
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user