1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/mobile/model/ProjectState.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 Mobile
17   {
18     namespace Model
19     {
20       namespace ProjectStateMapper
21       {
22 
23         static const int NORMAL_HASH = HashingUtils::HashString("NORMAL");
24         static const int SYNCING_HASH = HashingUtils::HashString("SYNCING");
25         static const int IMPORTING_HASH = HashingUtils::HashString("IMPORTING");
26 
27 
GetProjectStateForName(const Aws::String & name)28         ProjectState GetProjectStateForName(const Aws::String& name)
29         {
30           int hashCode = HashingUtils::HashString(name.c_str());
31           if (hashCode == NORMAL_HASH)
32           {
33             return ProjectState::NORMAL;
34           }
35           else if (hashCode == SYNCING_HASH)
36           {
37             return ProjectState::SYNCING;
38           }
39           else if (hashCode == IMPORTING_HASH)
40           {
41             return ProjectState::IMPORTING;
42           }
43           EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
44           if(overflowContainer)
45           {
46             overflowContainer->StoreOverflow(hashCode, name);
47             return static_cast<ProjectState>(hashCode);
48           }
49 
50           return ProjectState::NOT_SET;
51         }
52 
GetNameForProjectState(ProjectState enumValue)53         Aws::String GetNameForProjectState(ProjectState enumValue)
54         {
55           switch(enumValue)
56           {
57           case ProjectState::NORMAL:
58             return "NORMAL";
59           case ProjectState::SYNCING:
60             return "SYNCING";
61           case ProjectState::IMPORTING:
62             return "IMPORTING";
63           default:
64             EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
65             if(overflowContainer)
66             {
67               return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
68             }
69 
70             return {};
71           }
72         }
73 
74       } // namespace ProjectStateMapper
75     } // namespace Model
76   } // namespace Mobile
77 } // namespace Aws
78