CppHelperClasses » History » Revision 2
« Previous |
Revision 2/3
(diff)
| Next »
hazzadous, 2009-04-08 00:44
C++ Helper Classes¶
Below are some helper classes for writing modules in a C++ style. I do apologise, it is very C++. Unless you want to help with functionality, the important things are the mod_blank.hpp and mod_blank.cpp files, demonstrating the API I am using. Handlers relating to connections are much the same as the C API but srv is a data member of plugin_base. The server, and connection structures are the same as for C. You may remove anything from the handlers list to prevent the associated p->handler_* pointers from being set.
Writing config_options< OptionType > option( "somekey", &some_fn1, &some_fn2 ) will create an option corresponding to "somekey" in the config file. some_fn1 returns bool and specifies whether the config file value is valid. If not, some_fn2 is called to set the default value for "somekey". the defaults for these function pointers are null. Writing option[ con ] will return a reference to the associated value, according to whether it satisfies config_check_cond.
Updated by hazzadous over 15 years ago · 2 revisions