71 lines
1.9 KiB
C++
71 lines
1.9 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/discovery/model/OrderString.h>
|
|||
|
|
#include <aws/core/utils/HashingUtils.h>
|
|||
|
|
#include <aws/core/Globals.h>
|
|||
|
|
#include <aws/core/utils/EnumParseOverflowContainer.h>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace ApplicationDiscoveryService
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
namespace OrderStringMapper
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
static const int ASC_HASH = HashingUtils::HashString("ASC");
|
|||
|
|
static const int DESC_HASH = HashingUtils::HashString("DESC");
|
|||
|
|
|
|||
|
|
|
|||
|
|
OrderString GetOrderStringForName(const Aws::String& name)
|
|||
|
|
{
|
|||
|
|
int hashCode = HashingUtils::HashString(name.c_str());
|
|||
|
|
if (hashCode == ASC_HASH)
|
|||
|
|
{
|
|||
|
|
return OrderString::ASC;
|
|||
|
|
}
|
|||
|
|
else if (hashCode == DESC_HASH)
|
|||
|
|
{
|
|||
|
|
return OrderString::DESC;
|
|||
|
|
}
|
|||
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|||
|
|
if(overflowContainer)
|
|||
|
|
{
|
|||
|
|
overflowContainer->StoreOverflow(hashCode, name);
|
|||
|
|
return static_cast<OrderString>(hashCode);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return OrderString::NOT_SET;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Aws::String GetNameForOrderString(OrderString enumValue)
|
|||
|
|
{
|
|||
|
|
switch(enumValue)
|
|||
|
|
{
|
|||
|
|
case OrderString::ASC:
|
|||
|
|
return "ASC";
|
|||
|
|
case OrderString::DESC:
|
|||
|
|
return "DESC";
|
|||
|
|
default:
|
|||
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|||
|
|
if(overflowContainer)
|
|||
|
|
{
|
|||
|
|
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return {};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace OrderStringMapper
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace ApplicationDiscoveryService
|
|||
|
|
} // namespace Aws
|