fix indentation bug

This commit is contained in:
an-tao 2018-05-29 13:57:10 +08:00
parent 526485a139
commit ffd652c4e0
1 changed files with 14 additions and 11 deletions

View File

@ -113,19 +113,22 @@ void create_controller::newSimpleControllerHeaderFile(std::ofstream &file,const
file<<"#pragma once\n";
file<<"#include <drogon/HttpSimpleController.h>\n";
file<<"using namespace drogon;\n";
if(namespaceName!="")
std::string indent="";
if(namespaceName!="") {
file << "namespace " << namespaceName << "{\n";
file<<" class "<<ctlName<<":public drogon::HttpSimpleController<"<<ctlName<<">\n";
file<<" {\n";
file<<" public:\n";
indent=" ";
}
file<<indent<<"class "<<ctlName<<":public drogon::HttpSimpleController<"<<ctlName<<">\n";
file<<indent<<"{\n";
file<<indent<<"public:\n";
//TestController(){}
file<<" virtual void asyncHandleHttpRequest(const HttpRequest& req,std::function<void (HttpResponse &)>callback)override;\n";
file<<indent<<" virtual void asyncHandleHttpRequest(const HttpRequest& req,std::function<void (HttpResponse &)>callback)override;\n";
file<<" PATH_LIST_BEGIN\n";
file<<" //list path definations here;\n";
file<<" //PATH_ADD(\"/path\",\"filter1\",\"filter2\",...);\n";
file<<" PATH_LIST_END\n";
file<<" };\n";
file<<indent<<" PATH_LIST_BEGIN\n";
file<<indent<<" //list path definations here;\n";
file<<indent<<" //PATH_ADD(\"/path\",\"filter1\",\"filter2\",...);\n";
file<<indent<<" PATH_LIST_END\n";
file<<indent<<"};\n";
if(namespaceName!="")
file<<"}\n";
}