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,136 @@
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/mediastore-data/model/Item.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace MediaStoreData
{
namespace Model
{
Item::Item() :
m_nameHasBeenSet(false),
m_type(ItemType::NOT_SET),
m_typeHasBeenSet(false),
m_eTagHasBeenSet(false),
m_lastModifiedHasBeenSet(false),
m_contentTypeHasBeenSet(false),
m_contentLength(0),
m_contentLengthHasBeenSet(false)
{
}
Item::Item(JsonView jsonValue) :
m_nameHasBeenSet(false),
m_type(ItemType::NOT_SET),
m_typeHasBeenSet(false),
m_eTagHasBeenSet(false),
m_lastModifiedHasBeenSet(false),
m_contentTypeHasBeenSet(false),
m_contentLength(0),
m_contentLengthHasBeenSet(false)
{
*this = jsonValue;
}
Item& Item::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Name"))
{
m_name = jsonValue.GetString("Name");
m_nameHasBeenSet = true;
}
if(jsonValue.ValueExists("Type"))
{
m_type = ItemTypeMapper::GetItemTypeForName(jsonValue.GetString("Type"));
m_typeHasBeenSet = true;
}
if(jsonValue.ValueExists("ETag"))
{
m_eTag = jsonValue.GetString("ETag");
m_eTagHasBeenSet = true;
}
if(jsonValue.ValueExists("LastModified"))
{
m_lastModified = jsonValue.GetDouble("LastModified");
m_lastModifiedHasBeenSet = true;
}
if(jsonValue.ValueExists("ContentType"))
{
m_contentType = jsonValue.GetString("ContentType");
m_contentTypeHasBeenSet = true;
}
if(jsonValue.ValueExists("ContentLength"))
{
m_contentLength = jsonValue.GetInt64("ContentLength");
m_contentLengthHasBeenSet = true;
}
return *this;
}
JsonValue Item::Jsonize() const
{
JsonValue payload;
if(m_nameHasBeenSet)
{
payload.WithString("Name", m_name);
}
if(m_typeHasBeenSet)
{
payload.WithString("Type", ItemTypeMapper::GetNameForItemType(m_type));
}
if(m_eTagHasBeenSet)
{
payload.WithString("ETag", m_eTag);
}
if(m_lastModifiedHasBeenSet)
{
payload.WithDouble("LastModified", m_lastModified.SecondsWithMSPrecision());
}
if(m_contentTypeHasBeenSet)
{
payload.WithString("ContentType", m_contentType);
}
if(m_contentLengthHasBeenSet)
{
payload.WithInt64("ContentLength", m_contentLength);
}
return payload;
}
} // namespace Model
} // namespace MediaStoreData
} // namespace Aws