https://github.com/codeplea/pluscallback
easy to use callback library for C++
https://github.com/codeplea/pluscallback
Last synced: 4 days ago
JSON representation
easy to use callback library for C++
- Host: GitHub
- URL: https://github.com/codeplea/pluscallback
- Owner: codeplea
- License: other
- Created: 2015-11-05T20:34:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T18:18:08.000Z (about 8 years ago)
- Last Synced: 2025-04-22T11:18:02.345Z (12 days ago)
- Language: C++
- Homepage: http://codeplea.com/pluscallback
- Size: 13.7 KB
- Stars: 42
- Watchers: 4
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: history.txt
- License: LICENSE.md
Awesome Lists containing this project
- AwesomeCppGameDev - pluscallback
README
# C++ Callback Library: PlusCallback
*Additional documentation at:*
http://codeplea.com/pluscallback## Intro
PlusCallback is a C++ library, contained in a single header file, that
implements easy to use function and method callbacks. It is completely
contained in one header file, so it's trivial to add to your projects. It also
uses the simplest syntax of any callback method I've ever seen (for C++), and
it's quite flexible.## Code Sample
//Setup callback for TestObject.Foo().
cb::Callback1 callback(&TestObject, &TestClass::Foo);//Call TestObject.Foo(5).
callback(5);//Change callback to a free function.
callback = SomeRandomFunction;//Call SomeRandomFunction(8).
callback(8);## Features
- Contained in one header file, trivial to install
- Portable ANSI C++ code
- Completely free for any use (zlib license)
- Very simple API
- Type-safe, no macros or casts
- Container storage safe (e.g. std::map, list, vector, etc)## Installation Instructions
This entire library is contained in one header file.
Simply include *callback.hpp* in your project.## Examples
Some examples are included in the examples directory:
- example.cpp - PlusCallback example walking through most features.
- compare.cpp - Example comparing different callback methods.
- smoke.cpp - Several random tests for PlusCallback.## Building Instructions
This library comes pre-built. If you would like to rebuild this
library, you need to run build.tcl with the TCL interpreter. You
can obtain TCL from http://www.tcl.tk/
When rebuilding, you can change the maximum number of parameters
supported by callbacks.