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/TypeTestsStatus.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 TypeTestsStatusMapper 21 { 22 23 static const int PASSED_HASH = HashingUtils::HashString("PASSED"); 24 static const int FAILED_HASH = HashingUtils::HashString("FAILED"); 25 static const int IN_PROGRESS_HASH = HashingUtils::HashString("IN_PROGRESS"); 26 static const int NOT_TESTED_HASH = HashingUtils::HashString("NOT_TESTED"); 27 28 GetTypeTestsStatusForName(const Aws::String & name)29 TypeTestsStatus GetTypeTestsStatusForName(const Aws::String& name) 30 { 31 int hashCode = HashingUtils::HashString(name.c_str()); 32 if (hashCode == PASSED_HASH) 33 { 34 return TypeTestsStatus::PASSED; 35 } 36 else if (hashCode == FAILED_HASH) 37 { 38 return TypeTestsStatus::FAILED; 39 } 40 else if (hashCode == IN_PROGRESS_HASH) 41 { 42 return TypeTestsStatus::IN_PROGRESS; 43 } 44 else if (hashCode == NOT_TESTED_HASH) 45 { 46 return TypeTestsStatus::NOT_TESTED; 47 } 48 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 49 if(overflowContainer) 50 { 51 overflowContainer->StoreOverflow(hashCode, name); 52 return static_cast<TypeTestsStatus>(hashCode); 53 } 54 55 return TypeTestsStatus::NOT_SET; 56 } 57 GetNameForTypeTestsStatus(TypeTestsStatus enumValue)58 Aws::String GetNameForTypeTestsStatus(TypeTestsStatus enumValue) 59 { 60 switch(enumValue) 61 { 62 case TypeTestsStatus::PASSED: 63 return "PASSED"; 64 case TypeTestsStatus::FAILED: 65 return "FAILED"; 66 case TypeTestsStatus::IN_PROGRESS: 67 return "IN_PROGRESS"; 68 case TypeTestsStatus::NOT_TESTED: 69 return "NOT_TESTED"; 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 TypeTestsStatusMapper 82 } // namespace Model 83 } // namespace CloudFormation 84 } // namespace Aws 85