SNode.C
Loading...
Searching...
No Matches
web::http::client::commands::SendFileCommand Class Reference

#include <SendFileCommand.h>

Inheritance diagram for web::http::client::commands::SendFileCommand:
Collaboration diagram for web::http::client::commands::SendFileCommand:

Public Member Functions

 SendFileCommand (const std::string &file, const std::function< void(int)> &onStatus, const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &onResponseReceived, const std::function< void(const std::shared_ptr< Request > &, const std::string &)> &onResponseParseError)
 ~SendFileCommand () override=default
bool execute (const std::shared_ptr< MasterRequest > &request) override
Public Member Functions inherited from web::http::client::RequestCommand
 RequestCommand (const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> &onResponseReceived, const std::function< void(const std::shared_ptr< Request > &, const std::string &)> &onResponseParseError)
 RequestCommand (const RequestCommand &)=delete
 RequestCommand (RequestCommand &&) noexcept=delete
RequestCommandoperator= (const RequestCommand &)=delete
RequestCommandoperator= (RequestCommand &&) noexcept=delete
virtual ~RequestCommand ()
bool getError () const

Private Attributes

std::string file
std::function< void(int errnum)> onStatus

Additional Inherited Members

Public Attributes inherited from web::http::client::RequestCommand
const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> onResponseReceived
const std::function< void(const std::shared_ptr< Request > &, const std::string &)> onResponseParseError
Protected Attributes inherited from web::http::client::RequestCommand
bool error = false

Detailed Description

Definition at line 60 of file SendFileCommand.h.

Constructor & Destructor Documentation

◆ SendFileCommand()

web::http::client::commands::SendFileCommand::SendFileCommand ( const std::string & file,
const std::function< void(int)> & onStatus,
const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> & onResponseReceived,
const std::function< void(const std::shared_ptr< Request > &, const std::string &)> & onResponseParseError )

Definition at line 52 of file SendFileCommand.cpp.

57 : web::http::client::RequestCommand(onResponseReceived, onResponseParseError)
58 , file(file)
60 }
const std::function< void(const std::shared_ptr< Request > &, const std::shared_ptr< Response > &)> onResponseReceived
const std::function< void(const std::shared_ptr< Request > &, const std::string &)> onResponseParseError
std::function< void(int errnum)> onStatus

References file, onStatus, and web::http::client::RequestCommand::RequestCommand().

Referenced by web::http::client::MasterRequest::sendFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~SendFileCommand()

web::http::client::commands::SendFileCommand::~SendFileCommand ( )
overridedefault

Member Function Documentation

◆ execute()

bool web::http::client::commands::SendFileCommand::execute ( const std::shared_ptr< MasterRequest > & request)
overridevirtual

Implements web::http::client::RequestCommand.

Definition at line 62 of file SendFileCommand.cpp.

62 {
63 return request->executeSendFile(file, [this](int errnum) {
64 this->error = errnum;
65 onStatus(errnum);
66 });
67 }

References web::http::client::RequestCommand::error, web::http::client::MasterRequest::executeSendFile(), file, and onStatus.

Here is the call graph for this function:

Member Data Documentation

◆ file

std::string web::http::client::commands::SendFileCommand::file
private

Definition at line 71 of file SendFileCommand.h.

Referenced by execute(), and SendFileCommand().

◆ onStatus

std::function<void(int errnum)> web::http::client::commands::SendFileCommand::onStatus
private

Definition at line 72 of file SendFileCommand.h.

Referenced by execute(), and SendFileCommand().


The documentation for this class was generated from the following files: