MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
managerbase.cpp
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _managerbase_cpp
41 #define _managerbase_cpp
42 
43 #include "entresol.h"
44 #include "managerbase.h"
45 #include "stringtool.h"
46 
47 namespace Mezzanine
48 {
50  TheEntresol(NULL),
51  Initialized(false)
52  {
54  }
55 
57  {}
58 
59  ///////////////////////////////////////////////////////////////////////////////
60  // Utility
61 
62  ///////////////////////////////////////////////////////////////////////////////
63  // Initialization Methods
64 
66  { return Initialized; }
67 
68  ///////////////////////////////////////////////////////////////////////////////
69  // Type Identifier Methods
70 
72  {
74  }
75 
77  {
78  switch( ManagerType )
79  {
80  case ManagerBase::MT_ActorManager:
81  return "ActorManager";
82  break;
83  case ManagerBase::MT_AnimationManager:
84  return "AnimationManager";
85  break;
86  case ManagerBase::MT_AreaEffectManager:
87  return "AreaEffectManager";
88  break;
89  case ManagerBase::MT_AudioManager:
90  return "AudioManager";
91  break;
92  case ManagerBase::MT_CameraManager:
93  return "CameraManager";
94  break;
95  case ManagerBase::MT_CollisionShapeManager:
96  return "CollisionShapeManager";
97  break;
98  case ManagerBase::MT_CompositorManager:
99  return "CompositorManager";
100  break;
101  case ManagerBase::MT_DebrisManager:
102  return "DebrisManager";
103  break;
104  case ManagerBase::MT_EventManager:
105  return "EventManager";
106  break;
107  case ManagerBase::MT_GraphicsManager:
108  return "GraphicsManager";
109  break;
110  case ManagerBase::MT_InputManager:
111  return "InputManager";
112  break;
113  case ManagerBase::MT_LogManager:
114  return "LogManager";
115  break;
116  case ManagerBase::MT_MeshManager:
117  return "MeshManager";
118  break;
119  case ManagerBase::MT_NetworkManager:
120  return "NetworkManager";
121  break;
122  case ManagerBase::MT_PagingManager:
123  return "PagingManager";
124  break;
125  case ManagerBase::MT_PhysicsManager:
126  return "PhysicsManager";
127  break;
128  case ManagerBase::MT_ResourceManager:
129  return "ResourceManager";
130  break;
131  case ManagerBase::MT_SceneManager:
132  return "SceneManager";
133  break;
134  case ManagerBase::MT_ScriptingManager:
135  return "ScriptingManager";
136  break;
137  case ManagerBase::MT_SoundScapeManager:
138  return "SoundScapeManager";
139  break;
140  case ManagerBase::MT_TerrainManager:
141  return "TerrainManager";
142  break;
143  case ManagerBase::MT_UIManager:
144  return "UIManager";
145  break;
146  case ManagerBase::MT_VehicleManager:
147  return "VehicleManager";
148  break;
150  return "UserCreated";
151  break;
152  default:
153  return "Unknown";
154  break;
155  }
156  }
157 
159  {
160  String Lower = ManagerName;
162  switch ( Lower.at(0) )
163  {
164  case 'a':
165  {
166  if( 'c' == Lower.at(1) ) return ManagerBase::MT_ActorManager;
167  else if( 'n' == Lower.at(1) ) return ManagerBase::MT_AnimationManager;
168  else if( 'r' == Lower.at(1) ) return ManagerBase::MT_AreaEffectManager;
169  else if( 'u' == Lower.at(1) ) return ManagerBase::MT_AudioManager;
170  break;
171  }
172  case 'c':
173  {
174  if( 'a' == Lower.at(1) ) {
175  return ManagerBase::MT_CameraManager;
176  }else if( 'o' == Lower.at(1) ) {
177  if( 'l' == Lower.at(2) ) return ManagerBase::MT_CollisionShapeManager;
178  else if( 'm' == Lower.at(2) ) return ManagerBase::MT_CompositorManager;
179  }
180  break;
181  }
182  case 'd':
183  {
184  return ManagerBase::MT_DebrisManager;
185  break;
186  }
187  case 'e':
188  {
189  return ManagerBase::MT_EventManager;
190  break;
191  }
192  case 'g':
193  {
194  return ManagerBase::MT_GraphicsManager;
195  break;
196  }
197  case 'i':
198  {
199  return ManagerBase::MT_InputManager;
200  break;
201  }
202  case 'l':
203  {
204  return ManagerBase::MT_LogManager;
205  break;
206  }
207  case 'm':
208  {
209  return ManagerBase::MT_MeshManager;
210  break;
211  }
212  case 'n':
213  {
214  return ManagerBase::MT_NetworkManager;
215  break;
216  }
217  case 'p':
218  {
219  if( 'a' == Lower.at(1) ) return ManagerBase::MT_PagingManager;
220  else if( 'h' == Lower.at(1) ) return ManagerBase::MT_PhysicsManager;
221  break;
222  }
223  case 'r':
224  {
225  return ManagerBase::MT_ResourceManager;
226  break;
227  }
228  case 's':
229  {
230  if( 'o' == Lower.at(1) ) {
231  return ManagerBase::MT_SoundScapeManager;
232  }else{
233  // Both of these start with the same two letters, so skip to the third.
234  if( 'e' == Lower.at(2) ) return ManagerBase::MT_SceneManager;
235  else if( 'r' == Lower.at(2) ) return ManagerBase::MT_ScriptingManager;
236  }
237  break;
238  }
239  case 't':
240  {
241  return ManagerBase::MT_TerrainManager;
242  break;
243  }
244  case 'u':
245  {
246  if( 'i' == Lower.at(1) ) return ManagerBase::MT_UIManager;
247  else if( 's' == Lower.at(1) ) return ManagerBase::MT_UserCreated;
248  break;
249  }
250  case 'v':
251  {
252  return ManagerBase::MT_VehicleManager;
253  break;
254  }
255  }
256 
257  //If we got this far, there was a problem with the string provided.
258  MEZZ_EXCEPTION(Exception::PARAMETERS_EXCEPTION,"Attempting to get ManagerType from string, but no match was found. Is the string valid?");
259  }
260 }//Mezzanine
261 
262 #endif