| 1 | /* |
|---|---|
| 2 | * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | * You may not use this file except in compliance with the License. |
| 6 | * A copy of the License is located at |
| 7 | * |
| 8 | * http://aws.amazon.com/apache2.0 |
| 9 | * |
| 10 | * or in the "license" file accompanying this file. This file is distributed |
| 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | * express or implied. See the License for the specific language governing |
| 13 | * permissions and limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include <aws/s3/model/OwnerOverride.h> |
| 17 | #include <aws/core/utils/HashingUtils.h> |
| 18 | #include <aws/core/Globals.h> |
| 19 | #include <aws/core/utils/EnumParseOverflowContainer.h> |
| 20 | |
| 21 | using namespace Aws::Utils; |
| 22 | |
| 23 | |
| 24 | namespace Aws |
| 25 | { |
| 26 | namespace S3 |
| 27 | { |
| 28 | namespace Model |
| 29 | { |
| 30 | namespace OwnerOverrideMapper |
| 31 | { |
| 32 | |
| 33 | static const int Destination_HASH = HashingUtils::HashString("Destination"); |
| 34 | |
| 35 | |
| 36 | OwnerOverride GetOwnerOverrideForName(const Aws::String& name) |
| 37 | { |
| 38 | int hashCode = HashingUtils::HashString(name.c_str()); |
| 39 | if (hashCode == Destination_HASH) |
| 40 | { |
| 41 | return OwnerOverride::Destination; |
| 42 | } |
| 43 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 44 | if(overflowContainer) |
| 45 | { |
| 46 | overflowContainer->StoreOverflow(hashCode, name); |
| 47 | return static_cast<OwnerOverride>(hashCode); |
| 48 | } |
| 49 | |
| 50 | return OwnerOverride::NOT_SET; |
| 51 | } |
| 52 | |
| 53 | Aws::String GetNameForOwnerOverride(OwnerOverride enumValue) |
| 54 | { |
| 55 | switch(enumValue) |
| 56 | { |
| 57 | case OwnerOverride::Destination: |
| 58 | return "Destination"; |
| 59 | default: |
| 60 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
| 61 | if(overflowContainer) |
| 62 | { |
| 63 | return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); |
| 64 | } |
| 65 | |
| 66 | return {}; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | } // namespace OwnerOverrideMapper |
| 71 | } // namespace Model |
| 72 | } // namespace S3 |
| 73 | } // namespace Aws |
| 74 |