All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cpp-restbed-server.api-header.mustache Maven / Gradle / Ivy

There is a newer version: 7.10.0
Show newest version
{{>licenseInfo}}
{{#operations}}/*
 * {{classname}}.h
 *
 * {{description}}
 */

#ifndef {{classname}}_H_
#define {{classname}}_H_

{{{defaultInclude}}}
#include 
#include 

#include 
#include 
#include 

{{#imports}}{{{import}}}
{{/imports}}

{{#apiNamespaceDeclarations}}
namespace {{this}} {
{{/apiNamespaceDeclarations}}

using namespace {{modelNamespace}};

{{#operation}}
/// 
/// {{summary}}
/// 
/// 
/// {{notes}}
/// 
class {{declspec}} {{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource: public restbed::Resource
{
public:
	{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource();
    virtual ~{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource();
    void {{httpMethod}}_method_handler(const std::shared_ptr session);
    {{#vendorExtensions.x-codegen-other-methods}}
    void {{httpMethod}}_method_handler(const std::shared_ptr session);
    {{/vendorExtensions.x-codegen-other-methods}}

	void set_handler_{{httpMethod}}(
		std::function(
			{{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}}
		)> handler
	);

	{{#vendorExtensions.x-codegen-other-methods}}
	void set_handler_{{httpMethod}}(
		std::function(
			{{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}}
		)> handler
	);
	{{/vendorExtensions.x-codegen-other-methods}}

private:
	std::function(
		{{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}}
	)> handler_{{httpMethod}}_;

	{{#vendorExtensions.x-codegen-other-methods}}
	std::function(
		{{#allParams}}{{{dataType}}} const &{{^-last}}, {{/-last}}{{/allParams}}
	)> handler_{{httpMethod}}_;
	{{/vendorExtensions.x-codegen-other-methods}}

	{{#allParams}}
	{{{dataType}}} {{paramName}}{};
	{{/allParams}}
};

{{/operation}}

//
// The restbed service to actually implement the REST server
//
class {{declspec}} {{classname}}: public restbed::Service
{
public:
	{{classname}}();
	~{{classname}}();
	void startService(int const& port);
	void stopService();
	
protected:
	{{#operation}}
	std::shared_ptr<{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource> m_sp{{classname}}{{vendorExtensions.x-codegen-resource-name}}Resource;
	{{/operation}}	
};


{{#apiNamespaceDeclarations}}
}
{{/apiNamespaceDeclarations}}

#endif /* {{classname}}_H_ */

{{/operations}}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy