📄 hellomodule.cpp
字号:
// -----------------------------------------------------------------// libpion: a C++ framework for building lightweight HTTP interfaces// -----------------------------------------------------------------// Copyright (C) 2007 Atomic Labs, Inc. (http://www.atomiclabs.com)//// Distributed under the Boost Software License, Version 1.0.// See accompanying file COPYING or copy at http://www.boost.org/LICENSE_1_0.txt//#include "HelloModule.hpp"#include <libpion/HTTPResponse.hpp>using namespace pion;// HelloModule member functions/// handles requests for HelloModulebool HelloModule::handleRequest(HTTPRequestPtr& request, TCPConnectionPtr& tcp_conn){ static const std::string HELLO_HTML = "<html><body>Hello World!</body></html>\r\n\r\n"; HTTPResponsePtr response(HTTPResponse::create()); response->writeNoCopy(HELLO_HTML); response->send(tcp_conn); return true;}/// creates new HelloModule objectsextern "C" HelloModule *pion_create_HelloModule(void){ return new HelloModule();}/// destroys HelloModule objectsextern "C" void pion_destroy_HelloModule(HelloModule *module_ptr){ delete module_ptr;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -