//this file is generated by program(drogon_ctl) automatically,don't modify it! #include "plugin_cc.h" #include #include #include #include #include #include #include #include #include #include #include #include using namespace drogon; std::string plugin_cc::genText(const DrTemplateData& plugin_cc_view_data) { drogon::OStringStream plugin_cc_tmp_stream; std::string layoutName{""}; plugin_cc_tmp_stream << "/**\n"; plugin_cc_tmp_stream << " *\n"; plugin_cc_tmp_stream << " * "; { auto & val=plugin_cc_view_data["filename"]; if(val.type()==typeid(const char *)){ plugin_cc_tmp_stream<<*any_cast(&val); }else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){ plugin_cc_tmp_stream<<*any_cast(&val); } } plugin_cc_tmp_stream << ".cc\n"; plugin_cc_tmp_stream << " *\n"; plugin_cc_tmp_stream << " */\n"; plugin_cc_tmp_stream<<"\n"; plugin_cc_tmp_stream << "#include \""; { auto & val=plugin_cc_view_data["filename"]; if(val.type()==typeid(const char *)){ plugin_cc_tmp_stream<<*any_cast(&val); }else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){ plugin_cc_tmp_stream<<*any_cast(&val); } } plugin_cc_tmp_stream << ".h\"\n"; plugin_cc_tmp_stream<<"\n"; plugin_cc_tmp_stream << "using namespace drogon;\n"; auto namespaceStr=plugin_cc_view_data.get("namespaceString"); if(!namespaceStr.empty()) plugin_cc_tmp_stream<<"using namespace "<(&val); }else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){ plugin_cc_tmp_stream<<*any_cast(&val); } } plugin_cc_tmp_stream << "::initAndStart(const Json::Value &config)\n"; plugin_cc_tmp_stream << "{\n"; plugin_cc_tmp_stream << " /// Initialize and start the plugin\n"; plugin_cc_tmp_stream << "}\n"; plugin_cc_tmp_stream<<"\n"; plugin_cc_tmp_stream << "void "; { auto & val=plugin_cc_view_data["className"]; if(val.type()==typeid(const char *)){ plugin_cc_tmp_stream<<*any_cast(&val); }else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){ plugin_cc_tmp_stream<<*any_cast(&val); } } plugin_cc_tmp_stream << "::shutdown() \n"; plugin_cc_tmp_stream << "{\n"; plugin_cc_tmp_stream << " /// Shutdown the plugin\n"; plugin_cc_tmp_stream << "}\n"; if(layoutName.empty()) { std::string ret{std::move(plugin_cc_tmp_stream.str())}; return ret; }else { auto templ = DrTemplateBase::newTemplate(layoutName); if(!templ) return ""; HttpViewData data = plugin_cc_view_data; auto str = std::move(plugin_cc_tmp_stream.str()); if(!str.empty() && str[str.length()-1] == '\n') str.resize(str.length()-1); data[""] = std::move(str); return templ->genText(data); } }