1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/cloudformation/model/Replacement.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 CloudFormation 17 { 18 namespace Model 19 { 20 namespace ReplacementMapper 21 { 22 23 static const int True_HASH = HashingUtils::HashString("True"); 24 static const int False_HASH = HashingUtils::HashString("False"); 25 static const int Conditional_HASH = HashingUtils::HashString("Conditional"); 26 27 GetReplacementForName(const Aws::String & name)28 Replacement GetReplacementForName(const Aws::String& name) 29 { 30 int hashCode = HashingUtils::HashString(name.c_str()); 31 if (hashCode == True_HASH) 32 { 33 return Replacement::True; 34 } 35 else if (hashCode == False_HASH) 36 { 37 return Replacement::False; 38 } 39 else if (hashCode == Conditional_HASH) 40 { 41 return Replacement::Conditional; 42 } 43 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 44 if(overflowContainer) 45 { 46 overflowContainer->StoreOverflow(hashCode, name); 47 return static_cast<Replacement>(hashCode); 48 } 49 50 return Replacement::NOT_SET; 51 } 52 GetNameForReplacement(Replacement enumValue)53 Aws::String GetNameForReplacement(Replacement enumValue) 54 { 55 switch(enumValue) 56 { 57 case Replacement::True: 58 return "True"; 59 case Replacement::False: 60 return "False"; 61 case Replacement::Conditional: 62 return "Conditional"; 63 default: 64 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 65 if(overflowContainer) 66 { 67 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 68 } 69 70 return {}; 71 } 72 } 73 74 } // namespace ReplacementMapper 75 } // namespace Model 76 } // namespace CloudFormation 77 } // namespace Aws 78