This commit is contained in:
2022-03-17 18:13:02 +03:00
parent cc4e1f48aa
commit 7a26ae7292
11 changed files with 746 additions and 357 deletions

View File

@@ -25,37 +25,61 @@
# include "pifile.h"
#endif
/** \class PIObject
* \brief This is base class for any classes which use events -> handlers mechanism.
* \details
* \section PIObject_sec0 Events and Event handlers
* %PIObject provide notification mechanism similar Qt but implemented
* on language capabilities without any special preprocessors or compilers.
* Any class inherits PIObject should use macro \a PIOBJECT() immediate
* after declaration to proper compile.
*
* Event is a some abstract event that can be raised at any time.
* Event is a function but declared with special macro \a EVENT().
* To raise event simply execute event function.
*
* Event handler is a function but declared with special macro
* \a EVENT_HANDLER(). You can use event handlers as ordinary functions.
*
* Main goal of this mechanism is perform abstract connections between
* various objects. This functionality provide macro \a CONNECT() which
* connect some event of first object to some event handler or event of
* second object. Each event can be connected any times to any event handlers.
*
* \image html events_handlers.png
*
* Example: \snippet piobject.cpp main
* Result:
\code{.cpp}
handler B: 2 , 0.5
handler A: event to handler
handler A: event to event
\endcode
*/
//! \addtogroup Core
//! \{
//! \~\class PIObject piobject.h
//! \~\brief
//! \~english This is base class for any classes which use events -> handlers mechanism
//! \~russian Этот класс является базовым для использования механизма события -> обработчики
//!
//! \~\details
//! \~english \section PIObject_sec0 Events and Event handlers
//! \~russian \section PIObject_sec0 События и Обработчики событий
//!
//! \~english
//! %PIObject provide notification mechanism similar Qt but implemented
//! on language capabilities without any special preprocessors or compilers.
//! Any class inherits PIObject should use macro \a PIOBJECT() immediate
//! after declaration to proper compile.
//!
//! Event is a some abstract event that can be raised at any time.
//! Event is a function but declared with special macro \a EVENT().
//! To raise event simply execute event function.
//!
//! Event handler is a function but declared with special macro
//! \a EVENT_HANDLER(). You can use event handlers as ordinary functions.
//!
//! Main goal of this mechanism is perform abstract connections between
//! various objects. This functionality provide macro \a CONNECT() which
//! connect some event of first object to some event handler or event of
//! second object. Each event can be connected any times to any event handlers.
//!
//! \~russian
//!
//! \~\image html events_handlers.png
//!
//! \~english Example:
//! \~russian Пример:
//!
//! \~\snippet piobject.cpp main
//! \~english Result:
//! \~russian Результат:
//! \~\code{.cpp}
//! handler B: 2 , 0.5
//! handler A: event to handler
//! handler A: event to event
//! \~\endcode
//! \}
//! \addtogroup Core
//! \{
//! \~\class PIObject::Connection piobject.h
//! \~\brief
//! \~english Helper class for obtain info about if connection successful and disconnect single connection
//! \~russian Вспомогательный класс для получения информации об успешности соединения и возможности его разрыва
//! \}
PIString PIObject::__MetaFunc::arguments() const {
@@ -454,6 +478,14 @@ void PIObject::callQueuedEvents() {
}
//! \details
//! \~english
//! On first call background thread started to delete objects.
//! Each object deletes when it`s outside from any events and hadlers.
//! \~russian
//! При первом вызове стартует фоновый поток для удаления объектов.
//! Каждый объект из очереди удаляется только когда выйдет из всех
//! событий и обработок.
void PIObject::deleteLater() {
Deleter::instance()->post(this);
}