1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/snowball/model/ShippingOption.h> 7 #include <aws/core/utils/HashingUtils.h> 8 #include <aws/core/Globals.h> 9 #include <aws/core/utils/EnumParseOverflowContainer.h> 10 11 using namespace Aws::Utils; 12 13 14 namespace Aws 15 { 16 namespace Snowball 17 { 18 namespace Model 19 { 20 namespace ShippingOptionMapper 21 { 22 23 static const int SECOND_DAY_HASH = HashingUtils::HashString("SECOND_DAY"); 24 static const int NEXT_DAY_HASH = HashingUtils::HashString("NEXT_DAY"); 25 static const int EXPRESS_HASH = HashingUtils::HashString("EXPRESS"); 26 static const int STANDARD_HASH = HashingUtils::HashString("STANDARD"); 27 28 GetShippingOptionForName(const Aws::String & name)29 ShippingOption GetShippingOptionForName(const Aws::String& name) 30 { 31 int hashCode = HashingUtils::HashString(name.c_str()); 32 if (hashCode == SECOND_DAY_HASH) 33 { 34 return ShippingOption::SECOND_DAY; 35 } 36 else if (hashCode == NEXT_DAY_HASH) 37 { 38 return ShippingOption::NEXT_DAY; 39 } 40 else if (hashCode == EXPRESS_HASH) 41 { 42 return ShippingOption::EXPRESS; 43 } 44 else if (hashCode == STANDARD_HASH) 45 { 46 return ShippingOption::STANDARD; 47 } 48 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 49 if(overflowContainer) 50 { 51 overflowContainer->StoreOverflow(hashCode, name); 52 return static_cast<ShippingOption>(hashCode); 53 } 54 55 return ShippingOption::NOT_SET; 56 } 57 GetNameForShippingOption(ShippingOption enumValue)58 Aws::String GetNameForShippingOption(ShippingOption enumValue) 59 { 60 switch(enumValue) 61 { 62 case ShippingOption::SECOND_DAY: 63 return "SECOND_DAY"; 64 case ShippingOption::NEXT_DAY: 65 return "NEXT_DAY"; 66 case ShippingOption::EXPRESS: 67 return "EXPRESS"; 68 case ShippingOption::STANDARD: 69 return "STANDARD"; 70 default: 71 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 72 if(overflowContainer) 73 { 74 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 75 } 76 77 return {}; 78 } 79 } 80 81 } // namespace ShippingOptionMapper 82 } // namespace Model 83 } // namespace Snowball 84 } // namespace Aws 85