This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-honeycode/source/model/ResultSet.cpp

91 lines
2.0 KiB
C++
Raw Normal View History

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/honeycode/model/ResultSet.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace Honeycode
{
namespace Model
{
ResultSet::ResultSet() :
m_headersHasBeenSet(false),
m_rowsHasBeenSet(false)
{
}
ResultSet::ResultSet(JsonView jsonValue) :
m_headersHasBeenSet(false),
m_rowsHasBeenSet(false)
{
*this = jsonValue;
}
ResultSet& ResultSet::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("headers"))
{
Array<JsonView> headersJsonList = jsonValue.GetArray("headers");
for(unsigned headersIndex = 0; headersIndex < headersJsonList.GetLength(); ++headersIndex)
{
m_headers.push_back(headersJsonList[headersIndex].AsObject());
}
m_headersHasBeenSet = true;
}
if(jsonValue.ValueExists("rows"))
{
Array<JsonView> rowsJsonList = jsonValue.GetArray("rows");
for(unsigned rowsIndex = 0; rowsIndex < rowsJsonList.GetLength(); ++rowsIndex)
{
m_rows.push_back(rowsJsonList[rowsIndex].AsObject());
}
m_rowsHasBeenSet = true;
}
return *this;
}
JsonValue ResultSet::Jsonize() const
{
JsonValue payload;
if(m_headersHasBeenSet)
{
Array<JsonValue> headersJsonList(m_headers.size());
for(unsigned headersIndex = 0; headersIndex < headersJsonList.GetLength(); ++headersIndex)
{
headersJsonList[headersIndex].AsObject(m_headers[headersIndex].Jsonize());
}
payload.WithArray("headers", std::move(headersJsonList));
}
if(m_rowsHasBeenSet)
{
Array<JsonValue> rowsJsonList(m_rows.size());
for(unsigned rowsIndex = 0; rowsIndex < rowsJsonList.GetLength(); ++rowsIndex)
{
rowsJsonList[rowsIndex].AsObject(m_rows[rowsIndex].Jsonize());
}
payload.WithArray("rows", std::move(rowsJsonList));
}
return payload;
}
} // namespace Model
} // namespace Honeycode
} // namespace Aws