diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-12-28 21:46:57 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-12-29 18:07:21 +0100 |
commit | 7eda212753057c07f429dfdfb0cf3a18312de054 (patch) | |
tree | 330c21546abfff0643862e2b4e2cd35a9d3078b7 /lib/csapi/definitions/wellknown/full.h | |
parent | 952f8aa8ad19348b50a3b3545d98f7889bfdae76 (diff) | |
download | libquotient-7eda212753057c07f429dfdfb0cf3a18312de054.tar.gz libquotient-7eda212753057c07f429dfdfb0cf3a18312de054.zip |
Refactor EventFactory and move it out of _impl::
Strictly speaking, EventFactory can be further instantiated if any
client application figures they need a whole new base class for events
and respectively a separate EventFactory specialisation for it.
Where this whole commit started though was a linkage error because I
did not plan to expose Quotient-specific logging categories for linkage
(effectively, usage) from the client code - meanwhile the inline code
of EventFactory uses qDebug(EVENTS), meaning I had to either add
QUOTIENT_API to EVENTS or hide those invocations. This in turn led
to trimming the EventFactory constructor back to trivial implementation
and dropping the guard variable that was supposed to trace duplicate
EventFactory<BaseEventT> objects for the same BaseEventT - with the
reasoning that such situation is not really dangerous (unlike
EventTypeRegistry double-initialisation fiasco, see #413), and at the
same time it can be easily detected in the logs by duplicated factory
method registration messages. And while I was at it, I replaced the
meaningless bool in the return type of EventFactory<>::addMethod with
the slightly more (but still barely) useful reference to the inserted
factory method. One can (in theory) use it now if they need to turn
some event JSON into an object of some specific event type or nullptr
if the event type in the JSON payload doesn't match - but at the same
rate (for now at least) one can call makeIfMatches<EventT>() directly.
With this commit, both Quotest and Quaternion build and link using
either Clang or GCC even under -fvisibility=hidden. However, running
quotest now reproduces #413, which is a matter of event typeId
infrastructure refactoring, coming in further commits.
Diffstat (limited to 'lib/csapi/definitions/wellknown/full.h')
0 files changed, 0 insertions, 0 deletions