Add a PromotionManager.master/promotion
authorYann Dirson <ydirson@altern.org>
Sun, 20 Apr 2008 19:52:42 +0000 (20 21:52 +0200)
committerYann Dirson <ydirson@altern.org>
Sun, 20 Apr 2008 19:52:42 +0000 (20 21:52 +0200)
src/core/CMakeLists.txt
src/core/promotionmanager.cpp [new file with mode: 0644]
src/core/promotionmanager.h [new file with mode: 0644]

index e76e728..6b5bb20 100644 (file)
@@ -20,6 +20,7 @@ set(taguacore_SRCS
   policy.cpp
   pool.cpp
   poolcollection.cpp
+  promotionmanager.cpp
   repository.cpp
   state.cpp
   statefactory.cpp
diff --git a/src/core/promotionmanager.cpp b/src/core/promotionmanager.cpp
new file mode 100644 (file)
index 0000000..bc939a8
--- /dev/null
@@ -0,0 +1,17 @@
+#include "promotionmanager.h"
+
+void PromotionManager::setPromotion(IType* from, IType* to)
+{
+  m_promotions[from] = to;
+  m_depromotions[to] = from;
+}
+
+const IType * PromotionManager::getPromotion(const IType* p) const
+{
+  return m_promotions[p];
+}
+
+const IType * PromotionManager::getDepromotion(const IType* p) const
+{
+  return m_depromotions[p];
+}
diff --git a/src/core/promotionmanager.h b/src/core/promotionmanager.h
new file mode 100644 (file)
index 0000000..d06bc8a
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef CORE__PROMOTION_MANAGER_H
+#define CORE__PROMOTION_MANAGER_H
+
+#include <QtCore/QHash>
+
+#include "type.h"
+#include "component.h"
+
+class TAGUA_EXPORT PromotionManager: public Component {
+private:
+  QHash<const IType*,const IType*> m_promotions;
+  QHash<const IType*,const IType*> m_depromotions;
+
+public:
+  void setPromotion(IType* from, IType* to);
+  const IType * getPromotion(const IType*) const;
+  const IType * getDepromotion(const IType*) const;
+};
+
+#endif // CORE__PROMOTION_MANAGER_H