summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorancarola <raffaele.ancarola@epfl.ch>2019-01-23 21:03:02 +0100
committerancarola <raffaele.ancarola@epfl.ch>2019-01-23 21:03:02 +0100
commit10fe93d8c1d6a06b38cad2b491e99833ffe867f1 (patch)
tree7c0139faf569f6d540c86fb8a2b1699b42d75b54
parentLabelled, signal (diff)
downloadflatland-10fe93d8c1d6a06b38cad2b491e99833ffe867f1.tar.gz
flatland-10fe93d8c1d6a06b38cad2b491e99833ffe867f1.zip
Signal finalized?
-rw-r--r--engine/flatland.cpp4
-rw-r--r--engine/flatserial.cpp2
-rw-r--r--engine/focusable.cpp2
-rw-r--r--engine/include/core/labelled.hpp2
-rw-r--r--engine/include/core/signal.hpp10
-rw-r--r--engine/include/flatcollector.h2
-rw-r--r--engine/include/flatcomponent.h5
-rw-r--r--engine/include/flatland.h6
-rw-r--r--engine/include/flatsurface.h2
-rw-r--r--engine/include/flatwindow.h2
-rw-r--r--engine/labelled.cpp5
-rw-r--r--engine/signal.cpp5
12 files changed, 24 insertions, 23 deletions
diff --git a/engine/flatland.cpp b/engine/flatland.cpp
index 97829a4..badc8a2 100644
--- a/engine/flatland.cpp
+++ b/engine/flatland.cpp
@@ -9,8 +9,8 @@
using namespace std;
-#include "task.hpp"
-#include "signal.h"
+#include "core/task.hpp"
+#include "core/signal.hpp"
#include "flatwindow.h"
#include "flatexception.h"
#include "exceptions/forcequit.h"
diff --git a/engine/flatserial.cpp b/engine/flatserial.cpp
index 826e001..2413bb5 100644
--- a/engine/flatserial.cpp
+++ b/engine/flatserial.cpp
@@ -1,5 +1,5 @@
#include "flatserial.h"
-#include "task.hpp"
+#include "core/task.hpp"
SDL_EventCollector::SDL_EventCollector()
{
diff --git a/engine/focusable.cpp b/engine/focusable.cpp
index d6fa84b..5638621 100644
--- a/engine/focusable.cpp
+++ b/engine/focusable.cpp
@@ -1,5 +1,5 @@
#include "serial/focusable.h"
-#include "task.hpp"
+#include "core/task.hpp"
#include "flatserial.h"
Focusable::Focusable(bool focused) : focused(focused)
diff --git a/engine/include/core/labelled.hpp b/engine/include/core/labelled.hpp
index 7363e8d..8b458b3 100644
--- a/engine/include/core/labelled.hpp
+++ b/engine/include/core/labelled.hpp
@@ -19,7 +19,7 @@ struct flat::core::labelled
{
const std::string label;
- labelled(const std::string& label = "");
+ labelled(const std::string& label = "", bool allow_null = false);
static std::string random_label(uint8_t length = 8);
};
diff --git a/engine/include/core/signal.hpp b/engine/include/core/signal.hpp
index 4270aa5..be1644a 100644
--- a/engine/include/core/signal.hpp
+++ b/engine/include/core/signal.hpp
@@ -6,7 +6,7 @@
#include <initializer_list>
#include "object.hpp"
#include "task.hpp"
-#include "types.h"
+#include "types.hpp"
#include <functional>
#include <memory>
#include "priority.hpp"
@@ -110,11 +110,11 @@ namespace flat
void invoke(const signal&);
- /* Allow to safely bind e functor */
+ /* Allow to safely bind a functor */
template<class T>
- static ptr make( const (T::*method(const object*, void*))& fct,
- T* obj,
- const std::initializer_list<std::string>& filters = {})
+ static ptr create( const (T::*method(const object*, void*))& fct,
+ T* obj,
+ const std::initializer_list<std::string>& filters = {})
{
return new listener(std::bind(fct, ptr), filters);
}
diff --git a/engine/include/flatcollector.h b/engine/include/flatcollector.h
index d7edf55..5b1e718 100644
--- a/engine/include/flatcollector.h
+++ b/engine/include/flatcollector.h
@@ -1,7 +1,7 @@
#ifndef __FLATCOLLECTOR_H__
#define __FLATCOLLECTOR_H__
-#include "object.hpp"
+#include "core/object.hpp"
#include <set>
class FlatCollector : virtual public flat::core::object
diff --git a/engine/include/flatcomponent.h b/engine/include/flatcomponent.h
index 807bcaa..881e34f 100644
--- a/engine/include/flatcomponent.h
+++ b/engine/include/flatcomponent.h
@@ -1,10 +1,11 @@
#ifndef __FLAT_COMPONENT_H__
#define __FLAT_COMPONENT_H__
-#include "object.hpp"
+#include "core/object.hpp"
+#include "core/labelled.hpp"
#include <string>
-class Component : virtual public flat::core::object
+class Component : virtual public flat::core::object, virtual public flat::core::labelled
{
Component * parent;
diff --git a/engine/include/flatland.h b/engine/include/flatland.h
index c5f3eb5..e01201f 100644
--- a/engine/include/flatland.h
+++ b/engine/include/flatland.h
@@ -49,12 +49,12 @@ namespace core {
/* Engine channels */
-channel& core_chan();
-channel& error_chan();
+core::channel& core_chan();
+core::channel& error_chan();
/* Main job access */
-job& game_job();
+core::job& game_job();
/* Window and status accessors */
diff --git a/engine/include/flatsurface.h b/engine/include/flatsurface.h
index 3b64734..fff07dd 100644
--- a/engine/include/flatsurface.h
+++ b/engine/include/flatsurface.h
@@ -1,7 +1,7 @@
#ifndef __FLATSURFACE_H__
#define __FLATSURFACE_H__
-#include "object.hpp"
+#include "core/object.hpp"
#include <SDL2/SDL.h>
class FlatSurface : public flat::core::object
diff --git a/engine/include/flatwindow.h b/engine/include/flatwindow.h
index c03a3a9..37e834d 100644
--- a/engine/include/flatwindow.h
+++ b/engine/include/flatwindow.h
@@ -26,7 +26,7 @@ struct window_status
unsigned char focus:1;
};
-#include "object.hpp"
+#include "core/object.hpp"
#include "serial/keyfocusable.h"
class SDL_Window;
diff --git a/engine/labelled.cpp b/engine/labelled.cpp
index ede43d6..023023e 100644
--- a/engine/labelled.cpp
+++ b/engine/labelled.cpp
@@ -5,9 +5,10 @@
using namespace std;
using namespace flat::core;
-labelled::labelled(const std::string& label) : label(label) {}
+labelled::labelled(const std::string& label, bool allow_null)
+ : label((!allow_null && label.empty()) ? object::random_label() : label) {}
-string labelled::random_id(uint8_t length) {
+string labelled::random_label(uint8_t length) {
string out;
diff --git a/engine/signal.cpp b/engine/signal.cpp
index 2af4a68..dc8dbf4 100644
--- a/engine/signal.cpp
+++ b/engine/signal.cpp
@@ -7,8 +7,7 @@ using namespace flat::core;
map<string, channel*> channel::channels;
-channel::channel(const string& id, priority_t prior)
- : labelled(id.empty() ? object::random_id(): id)
+channel::channel(const string& id, priority_t prior) : labelled(id)
{
}
@@ -114,7 +113,7 @@ signal::signal( object *sender,
void *data,
priority_t priority)
- : labelled(id),
+ : labelled(id, true),
sender(sender),
m_package(package(data)),
priority(priority)