/** * * @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_controller.h" #include "cmd.h" #include #include #include using namespace drogon_ctl; void create_controller::handleCommand(std::vector ¶meters) { //std::cout<<"create!"< &ctlNames,const std::string &namespaceName) { for(auto iter=ctlNames.begin();iter!=ctlNames.end();iter++) { if ((*iter)[0] == '-') { std::cout< &ctlNames,const std::string &namespaceName) { for(auto iter=ctlNames.begin();iter!=ctlNames.end();iter++) { if ((*iter)[0] == '-') { std::cout<\n"; file<<"using namespace drogon;\n"; std::string indent=""; auto namespace_name=namespaceName; if(namespace_name!="") { auto pos=namespace_name.find("::"); while(pos!=std::string::npos) { auto namespaceI=namespace_name.substr(0,pos); namespace_name=namespace_name.substr(pos+2); file<\n"; file< & callback)override;\n"; file< & callback)\n"; file<<"{\n"; file<<" //write your application logic here\n"; file<<"}"; } void create_controller::newWebsockControllerHeaderFile(std::ofstream &file,const std::string &ctlName,const std::string &namespaceName) { file<<"#pragma once\n"; file<<"#include \n"; file<<"using namespace drogon;\n"; std::string indent=""; auto namespace_name=namespaceName; if(namespace_name!="") { auto pos=namespace_name.find("::"); while(pos!=std::string::npos) { auto namespaceI=namespace_name.substr(0,pos); namespace_name=namespace_name.substr(pos+2); file<\n"; file< &apiClasses) { for(auto iter=apiClasses.begin();iter!=apiClasses.end();iter++) { if ((*iter)[0] == '-') { std::cout<\n"; file<<"using namespace drogon;\n"; std::string indent=""; std::string class_name=className; std::string namepace_path="/"; auto pos=class_name.find("::"); while(pos!=std::string::npos) { auto namespaceName=class_name.substr(0,pos); class_name=class_name.substr(pos+2); file<\n"; file<&callback,int p1,std::string p2);\n"; file<&callback,double p1,int p2) const;\n"; indent.resize(indent.length()-4); file<