# BufferBody.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/protocol/http/outgoing/BufferBody.hpp"

# BufferBody

Implementation of oatpp::web::protocol::http::outgoing::Body class. Implements functionality to use :oatpp::String as data source for http body.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { 
  class BufferBody : public oatpp::base::Countable, public Body {}

# Methods

Return Type Name Summary
std::shared_ptr<BufferBody> createShared Create shared BufferBody.
v_io_size read Read operation callback.
void declareHeaders Declare Content-Length header.
p_char8 getKnownData Pointer to the body known data.
v_buff_size getKnownSize Return known size of the body.

# BufferBody::createShared

Create shared BufferBody.

  • @param buffer - oatpp::String.
  • @param contentType - type of the content.
  • @return - std::shared_ptr to BufferBody.

static std::shared_ptr<BufferBody> createShared(const oatpp::String& buffer,
                                                const data::share::StringKeyLabel& contentType = data::share::StringKeyLabel())

# BufferBody::read

Read operation callback.

  • @param buffer - pointer to buffer.
  • @param count - size of the buffer in bytes.
  • @param action - async specific action. If action is NOT oatpp::async::Action::TYPE_NONE, then caller MUST return this action on coroutine iteration.
  • @return - actual number of bytes written to buffer. 0 - to indicate end-of-file.

v_io_size read(void *buffer, v_buff_size count, async::Action& action) override

# BufferBody::declareHeaders

Declare Content-Length header.

void declareHeaders(Headers& headers) override

# BufferBody::getKnownData

Pointer to the body known data.

  • @return - p_char8.

p_char8 getKnownData() override

# BufferBody::getKnownSize

Return known size of the body.

  • @return - v_buff_size.

v_buff_size getKnownSize() override