feat(hos_client_create, hos_client_destory): 多次调用destory不会导致重复释放

This commit is contained in:
彭宣正
2020-12-14 17:24:58 +08:00
parent 505d529c32
commit 10b370e486
55976 changed files with 8544395 additions and 2 deletions

View File

@@ -0,0 +1,113 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/alexaforbusiness/model/Content.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace AlexaForBusiness
{
namespace Model
{
Content::Content() :
m_textListHasBeenSet(false),
m_ssmlListHasBeenSet(false),
m_audioListHasBeenSet(false)
{
}
Content::Content(JsonView jsonValue) :
m_textListHasBeenSet(false),
m_ssmlListHasBeenSet(false),
m_audioListHasBeenSet(false)
{
*this = jsonValue;
}
Content& Content::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("TextList"))
{
Array<JsonView> textListJsonList = jsonValue.GetArray("TextList");
for(unsigned textListIndex = 0; textListIndex < textListJsonList.GetLength(); ++textListIndex)
{
m_textList.push_back(textListJsonList[textListIndex].AsObject());
}
m_textListHasBeenSet = true;
}
if(jsonValue.ValueExists("SsmlList"))
{
Array<JsonView> ssmlListJsonList = jsonValue.GetArray("SsmlList");
for(unsigned ssmlListIndex = 0; ssmlListIndex < ssmlListJsonList.GetLength(); ++ssmlListIndex)
{
m_ssmlList.push_back(ssmlListJsonList[ssmlListIndex].AsObject());
}
m_ssmlListHasBeenSet = true;
}
if(jsonValue.ValueExists("AudioList"))
{
Array<JsonView> audioListJsonList = jsonValue.GetArray("AudioList");
for(unsigned audioListIndex = 0; audioListIndex < audioListJsonList.GetLength(); ++audioListIndex)
{
m_audioList.push_back(audioListJsonList[audioListIndex].AsObject());
}
m_audioListHasBeenSet = true;
}
return *this;
}
JsonValue Content::Jsonize() const
{
JsonValue payload;
if(m_textListHasBeenSet)
{
Array<JsonValue> textListJsonList(m_textList.size());
for(unsigned textListIndex = 0; textListIndex < textListJsonList.GetLength(); ++textListIndex)
{
textListJsonList[textListIndex].AsObject(m_textList[textListIndex].Jsonize());
}
payload.WithArray("TextList", std::move(textListJsonList));
}
if(m_ssmlListHasBeenSet)
{
Array<JsonValue> ssmlListJsonList(m_ssmlList.size());
for(unsigned ssmlListIndex = 0; ssmlListIndex < ssmlListJsonList.GetLength(); ++ssmlListIndex)
{
ssmlListJsonList[ssmlListIndex].AsObject(m_ssmlList[ssmlListIndex].Jsonize());
}
payload.WithArray("SsmlList", std::move(ssmlListJsonList));
}
if(m_audioListHasBeenSet)
{
Array<JsonValue> audioListJsonList(m_audioList.size());
for(unsigned audioListIndex = 0; audioListIndex < audioListJsonList.GetLength(); ++audioListIndex)
{
audioListJsonList[audioListIndex].AsObject(m_audioList[audioListIndex].Jsonize());
}
payload.WithArray("AudioList", std::move(audioListJsonList));
}
return payload;
}
} // namespace Model
} // namespace AlexaForBusiness
} // namespace Aws