YAPOG  0.0.1
Yet Another Pokemon Online Game
WorldObjectStateFactory.cpp
Go to the documentation of this file.
2 
3 namespace yap
4 {
6  : states_ ()
7  {
8  }
9 
11  {
12  for (const auto& it : states_)
13  delete it.second;
14  }
15 
17  {
18  static WorldObjectStateFactory instance;
19 
20  return instance;
21  }
22 
24  const String& state,
25  const String& logicalState)
26  {
27  states_.Add (state, new WorldObjectStateInfo (state, logicalState));
28  }
29 
31  const String& state,
32  const String& join)
33  {
34  states_[state]->AddJoin (join);
35  }
36 
39  {
40  return *states_[state];
41  }
42 
44  const String& name,
45  const String& logicalName)
46  : name_ (name)
47  , logicalName_ (logicalName)
48  , joins_ ()
49  {
50  }
51 
53  {
54  return name_;
55  }
56 
57  const String&
59  {
60  return logicalName_;
61  }
62 
64  const String& state) const
65  {
66  return joins_.Contains (state);
67  }
68 
70  const String& join)
71  {
72  joins_.Add (join);
73  }
74 } // namespace yap