|
Event-Driven Programming in C++ 1.0
A case study on event-driven programming in C++
|
Disclaimer: This project was built collaboratively with AI, step by step. Its primary purpose is to serve as an educational tool for studying and understanding event-driven programming in C++.
This repository is a case study demonstrating various approaches to event-driven programming in C++. It includes examples implemented in C++ using different design patterns and libraries such as:
std::function to handle asynchronous events.select()) on POSIX systems and platform-specific alternatives on Windows.Before building and running the project, ensure you have the following installed:
C:/Qt/6.8.2/msvc2022_64/lib/cmake/Qt6 on Windows); you may need to modify the Qt6_DIR variable in CMakePresets.json to match your installation.The project uses CMake with presets defined in CMakePresets.json to streamline configuration and building across multiple platforms and build types.
For example, to configure the project:
After configuration, build the project using:
Replace <preset> with your chosen configuration (e.g., windows-msvc-debug or linux-gcc-debug).
On Windows, post-build steps (such as running windeployqt for Qt-based examples) are executed automatically.
Each example is built as a separate executable:
Unit tests are located in the tests directory and are registered via CTest. To run all tests:
For automated testing, the I/O and Sockets demonstration supports a TEST_MODE macro. When defined, the Windows-specific code bypasses the _kbhit() polling and reads console input using std::getline(). This allows tests to simulate input automatically (for example, by redirecting std::cin) so that manual intervention isn’t required.
Testing/Temporary directory as part of CTest’s internal workflow. This is normal and can be ignored.windeployqt as a post-build step on Windows to deploy the required Qt DLLs.Contributions, improvements, and bug fixes are welcome! Please submit pull requests or open issues to help enhance the project.
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.