From 10fe93d8c1d6a06b38cad2b491e99833ffe867f1 Mon Sep 17 00:00:00 2001 From: ancarola Date: Wed, 23 Jan 2019 21:03:02 +0100 Subject: Signal finalized? --- engine/flatland.cpp | 4 ++-- engine/flatserial.cpp | 2 +- engine/focusable.cpp | 2 +- engine/include/core/labelled.hpp | 2 +- engine/include/core/signal.hpp | 10 +++++----- engine/include/flatcollector.h | 2 +- engine/include/flatcomponent.h | 5 +++-- engine/include/flatland.h | 6 +++--- engine/include/flatsurface.h | 2 +- engine/include/flatwindow.h | 2 +- engine/labelled.cpp | 5 +++-- engine/signal.cpp | 5 ++--- 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 #include "object.hpp" #include "task.hpp" -#include "types.h" +#include "types.hpp" #include #include #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 - static ptr make( const (T::*method(const object*, void*))& fct, - T* obj, - const std::initializer_list& filters = {}) + static ptr create( const (T::*method(const object*, void*))& fct, + T* obj, + const std::initializer_list& 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 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 -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 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 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) -- cgit v1.2.1