/
zOMGdev
/
cppcms
Обзор
Документация
Войти
/
zOMGdev
/
cppcms
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.1.0
tests/test_plugin_so.cpp
38 строк
700 B
Artyom Beilis
Improved plugin API
11 янв 2016, 15:29
11 янв 2016, 15:29
6f8478d
Код
Авторство
О чём код?
#include <cppcms/plugin.h> #include <ctype.h> #include "plugin_base.h" namespace foo { std::string lower(std::string f) { for(size_t i=0;i<f.size();i++) { f[i]=tolower(f[i]); } return f; } CPPCMS_PLUGIN_ENTRY(foo,lower,std::string(std::string const &)) class bar : public bar_base { public: bar(std::string const &m) : msg_(m) {} virtual char const *msg() { return msg_.c_str(); }; static bar *create(std::string const &m) { return new bar(m); } private: std::string msg_; }; CPPCMS_PLUGIN_ENTRY(foo,bar::create,bar_base *(std::string const &)) int my_counter() { static int value; return ++value; } CPPCMS_NAMED_PLUGIN_ENTRY(foo,counter,my_counter,int()); } // namespace foo