# Conflicts: # include/Event.h # main.cpp
Event
A C++20 Event system inspired by C# syntax.
Features
- Fast
- (TODO: Profile!)
- Flexible
- Easy To Use
- Written in portable and standard C++, no hacks or quirks.
- Utilizes Modern C++ features for elegant design.
- Zero dependencies. Fully self-contained.
- Unrestricted
- No GNU Copyleft communism. Totally Free & Public Domain.
Coming Soon
- Event Filters / Policy
- Asynchronous
- Thread-Safe Version
- Priority Queue
- Auto disconnecting
Supported Compilers
- GCC 14.2.1 (RedHat)
- MSVC 19.40
Usage
This project is designed to be integrated via CMake Package Manager.
CPMAddPackage(
NAME Event
URL https://git.redacted.cc/josh/Event/archive/Release-7.zip
)
This snippet will automatically download a stable release of Event into your project's build directory, so it won't clutter your sources.
Take note of the release version and make sure it's the latest available in the Releases tab above.
target_include_directories(${PROJECT_NAME} PUBLIC ${Event_SOURCE_DIR}/include)
target_link_libraries(${PROJECT_NAME} PUBLIC Event)
This snippet will import the headers, and then link the library to your library/executable. You should now be able to use Event.
The C++ snippet below reads input from the terminal and fires an event that received the input message.
#include <Event.h>
#include <EventConnection.h>
void ReadMessage(const std::string& message) {
std::cout << "Received: " << message << std::endl;
}
int main()
{
Event<std::string> OnInput; // This and the declaration below are equivalent.
BasicEvent<std::function<void(std::string)>, std::string> OnInput2;
bool running = true;
while (running) {
std::string input;
std::cin >> input;
OnInput.Invoke(input);
OnInput(input); // Call operator is defined as well.
}
return 0;
}
More advanced examples can be found in the main.cpp file.
Documentation
Documentation is automatically generated from latest commit and is hosted at https://doc.redacted.cc/event .
Contributing
Contributions to this project are welcome! If you find a bug, have a feature request, or would like to contribute code, please submit an issue or pull request to the GitHub repository.
License
Event is expressly licensed to the Public Domain under the Unlicense. See the LICENSE file for details.
Acknowledgements
Event is developed and maintained by Joshua O'Leary @ Redacted Software, and contributors. Special thanks to Maxine Hayes.