| 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/FileHeaderInfo.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 FileHeaderInfoMapper | 
| 31 | { | 
| 32 | |
| 33 | static const int USE_HASH = HashingUtils::HashString( "USE"); | 
| 34 | static const int IGNORE_HASH = HashingUtils::HashString( "IGNORE"); | 
| 35 | static const int NONE_HASH = HashingUtils::HashString( "NONE"); | 
| 36 | |
| 37 | |
| 38 | FileHeaderInfo GetFileHeaderInfoForName(const Aws::String& name) | 
| 39 | { | 
| 40 | int hashCode = HashingUtils::HashString(name.c_str()); | 
| 41 | if (hashCode == USE_HASH) | 
| 42 | { | 
| 43 | return FileHeaderInfo::USE; | 
| 44 | } | 
| 45 | else if (hashCode == IGNORE_HASH) | 
| 46 | { | 
| 47 | return FileHeaderInfo::IGNORE; | 
| 48 | } | 
| 49 | else if (hashCode == NONE_HASH) | 
| 50 | { | 
| 51 | return FileHeaderInfo::NONE; | 
| 52 | } | 
| 53 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); | 
| 54 | if(overflowContainer) | 
| 55 | { | 
| 56 | overflowContainer->StoreOverflow(hashCode, name); | 
| 57 | return static_cast<FileHeaderInfo>(hashCode); | 
| 58 | } | 
| 59 | |
| 60 | return FileHeaderInfo::NOT_SET; | 
| 61 | } | 
| 62 | |
| 63 | Aws::String GetNameForFileHeaderInfo(FileHeaderInfo enumValue) | 
| 64 | { | 
| 65 | switch(enumValue) | 
| 66 | { | 
| 67 | case FileHeaderInfo::USE: | 
| 68 | return "USE"; | 
| 69 | case FileHeaderInfo::IGNORE: | 
| 70 | return "IGNORE"; | 
| 71 | case FileHeaderInfo::NONE: | 
| 72 | return "NONE"; | 
| 73 | default: | 
| 74 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); | 
| 75 | if(overflowContainer) | 
| 76 | { | 
| 77 | return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); | 
| 78 | } | 
| 79 | |
| 80 | return {}; | 
| 81 | } | 
| 82 | } | 
| 83 | |
| 84 | } // namespace FileHeaderInfoMapper | 
| 85 | } // namespace Model | 
| 86 | } // namespace S3 | 
| 87 | } // namespace Aws | 
| 88 | 
