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/InventoryFormat.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 InventoryFormatMapper |
31 | { |
32 | |
33 | static const int CSV_HASH = HashingUtils::HashString("CSV"); |
34 | static const int ORC_HASH = HashingUtils::HashString("ORC"); |
35 | static const int Parquet_HASH = HashingUtils::HashString("Parquet"); |
36 | |
37 | |
38 | InventoryFormat GetInventoryFormatForName(const Aws::String& name) |
39 | { |
40 | int hashCode = HashingUtils::HashString(name.c_str()); |
41 | if (hashCode == CSV_HASH) |
42 | { |
43 | return InventoryFormat::CSV; |
44 | } |
45 | else if (hashCode == ORC_HASH) |
46 | { |
47 | return InventoryFormat::ORC; |
48 | } |
49 | else if (hashCode == Parquet_HASH) |
50 | { |
51 | return InventoryFormat::Parquet; |
52 | } |
53 | EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); |
54 | if(overflowContainer) |
55 | { |
56 | overflowContainer->StoreOverflow(hashCode, name); |
57 | return static_cast<InventoryFormat>(hashCode); |
58 | } |
59 | |
60 | return InventoryFormat::NOT_SET; |
61 | } |
62 | |
63 | Aws::String GetNameForInventoryFormat(InventoryFormat enumValue) |
64 | { |
65 | switch(enumValue) |
66 | { |
67 | case InventoryFormat::CSV: |
68 | return "CSV"; |
69 | case InventoryFormat::ORC: |
70 | return "ORC"; |
71 | case InventoryFormat::Parquet: |
72 | return "Parquet"; |
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 InventoryFormatMapper |
85 | } // namespace Model |
86 | } // namespace S3 |
87 | } // namespace Aws |
88 |