1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/clouddirectory/model/FacetAttributeType.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 CloudDirectory 17 { 18 namespace Model 19 { 20 namespace FacetAttributeTypeMapper 21 { 22 23 static const int STRING_HASH = HashingUtils::HashString("STRING"); 24 static const int BINARY_HASH = HashingUtils::HashString("BINARY"); 25 static const int BOOLEAN_HASH = HashingUtils::HashString("BOOLEAN"); 26 static const int NUMBER_HASH = HashingUtils::HashString("NUMBER"); 27 static const int DATETIME_HASH = HashingUtils::HashString("DATETIME"); 28 static const int VARIANT_HASH = HashingUtils::HashString("VARIANT"); 29 30 GetFacetAttributeTypeForName(const Aws::String & name)31 FacetAttributeType GetFacetAttributeTypeForName(const Aws::String& name) 32 { 33 int hashCode = HashingUtils::HashString(name.c_str()); 34 if (hashCode == STRING_HASH) 35 { 36 return FacetAttributeType::STRING; 37 } 38 else if (hashCode == BINARY_HASH) 39 { 40 return FacetAttributeType::BINARY; 41 } 42 else if (hashCode == BOOLEAN_HASH) 43 { 44 return FacetAttributeType::BOOLEAN; 45 } 46 else if (hashCode == NUMBER_HASH) 47 { 48 return FacetAttributeType::NUMBER; 49 } 50 else if (hashCode == DATETIME_HASH) 51 { 52 return FacetAttributeType::DATETIME; 53 } 54 else if (hashCode == VARIANT_HASH) 55 { 56 return FacetAttributeType::VARIANT; 57 } 58 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 59 if(overflowContainer) 60 { 61 overflowContainer->StoreOverflow(hashCode, name); 62 return static_cast<FacetAttributeType>(hashCode); 63 } 64 65 return FacetAttributeType::NOT_SET; 66 } 67 GetNameForFacetAttributeType(FacetAttributeType enumValue)68 Aws::String GetNameForFacetAttributeType(FacetAttributeType enumValue) 69 { 70 switch(enumValue) 71 { 72 case FacetAttributeType::STRING: 73 return "STRING"; 74 case FacetAttributeType::BINARY: 75 return "BINARY"; 76 case FacetAttributeType::BOOLEAN: 77 return "BOOLEAN"; 78 case FacetAttributeType::NUMBER: 79 return "NUMBER"; 80 case FacetAttributeType::DATETIME: 81 return "DATETIME"; 82 case FacetAttributeType::VARIANT: 83 return "VARIANT"; 84 default: 85 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 86 if(overflowContainer) 87 { 88 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 89 } 90 91 return {}; 92 } 93 } 94 95 } // namespace FacetAttributeTypeMapper 96 } // namespace Model 97 } // namespace CloudDirectory 98 } // namespace Aws 99