audio_trans/cmake-build-debug/drogon_ctl/plugin_cc.cc

93 lines
3.2 KiB
C++

//this file is generated by program(drogon_ctl) automatically,don't modify it!
#include "plugin_cc.h"
#include <drogon/utils/OStringStream.h>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <list>
#include <deque>
#include <queue>
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<const char *>(&val);
}else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
plugin_cc_tmp_stream<<*any_cast<const std::string>(&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<const char *>(&val);
}else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
plugin_cc_tmp_stream<<*any_cast<const std::string>(&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<std::string>("namespaceString");
if(!namespaceStr.empty())
plugin_cc_tmp_stream<<"using namespace "<<namespaceStr<<";\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<const char *>(&val);
}else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
plugin_cc_tmp_stream<<*any_cast<const std::string>(&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<const char *>(&val);
}else if(val.type()==typeid(std::string)||val.type()==typeid(const std::string)){
plugin_cc_tmp_stream<<*any_cast<const std::string>(&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);
}
}