/** * * @file * @author An Tao * @section LICENSE * * Copyright 2018, An Tao. All rights reserved. * Use of this source code is governed by a MIT license * that can be found in the License file. * * @section DESCRIPTION * */ #include "create_view.h" #include "cmd.h" #include #include #include #include static const std::string cxx_include="<%inc"; static const std::string cxx_end="%>"; static const std::string cxx_lang="<%c++"; static const std::string cxx_view_data="@@"; static const std::string cxx_output="$$"; using namespace drogon_ctl; static std::string& replace_all(std::string& str,const std::string& old_value,const std::string& new_value) { std::string::size_type pos(0); while(true) { //std::cout<0) oSrcFile<<"\t"< ¶meters) { for(auto iter=parameters.begin();iter!=parameters.end();iter++) { auto file=*iter; if(file=="-o"||file=="--output") { iter=parameters.erase(iter); if(iter!=parameters.end()) { _outputPath=*iter; iter=parameters.erase(iter); } break; } else if(file[0]=='-') { std::cout< &cspFileNames) { for(auto file:cspFileNames) { std::cout<<"create view:"<\n"; file<<"using namespace drogon;\n"; file<<"class "<\n"; file<<"{\npublic:\n\t"<\n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"#include \n"; file <<"using namespace std;\n"; // file <<"void __attribute__((constructor)) startup()\n"; // file <<"{std::cout<<\"dynamic lib start to load!\"<setStatusCode(HttpResponse::k200OK);\n"; file<<"#ifdef CONTENT_TYPE\n"; file<<"\tres->setContentTypeCode(CONTENT_TYPE);\n"; file<<"#else\n"; file<<"\tres->setContentTypeCode(CT_TEXT_HTML);\n"; file<<"#endif\n"; file<<"\tres->setBody("<