SNode.C
Loading...
Searching...
No Matches
web::http::decoder::Identity Class Reference

#include <Identity.h>

Inheritance diagram for web::http::decoder::Identity:
Collaboration diagram for web::http::decoder::Identity:

Public Member Functions

 Identity (const core::socket::stream::SocketContext *socketContext, std::size_t contentLengthExpected)
 
 Identity (const Identity &)=delete
 
 Identity (Identity &&) noexcept=default
 
Identityoperator= (const Identity &)=delete
 
Identityoperator= (Identity &&) noexcept=default
 
 ~Identity () override
 
- Public Member Functions inherited from web::http::ContentDecoder
 ContentDecoder ()=default
 
 ContentDecoder (const ContentDecoder &)=delete
 
 ContentDecoder (ContentDecoder &&) noexcept=default
 
ContentDecoderoperator= (const ContentDecoder &)=delete
 
ContentDecoderoperator= (ContentDecoder &&) noexcept=default
 
virtual ~ContentDecoder ()
 
bool isComplete () const
 
bool isError () const
 
std::vector< char > && getContent ()
 

Private Member Functions

std::size_t read () override
 

Private Attributes

const core::socket::stream::SocketContextsocketContext
 
std::size_t contentLengthExpected = 0
 
std::size_t contentLengthRead = 0
 
int state = 0
 

Additional Inherited Members

- Protected Attributes inherited from web::http::ContentDecoder
std::vector< char > content
 
bool completed = false
 
bool error = false
 

Detailed Description

Definition at line 59 of file Identity.h.

Constructor & Destructor Documentation

◆ Identity() [1/3]

web::http::decoder::Identity::Identity ( const core::socket::stream::SocketContext socketContext,
std::size_t  contentLengthExpected 
)

Definition at line 54 of file Identity.cpp.

58 }
std::vector< char > content
const core::socket::stream::SocketContext * socketContext
Definition Identity.h:73
std::size_t contentLengthExpected
Definition Identity.h:74

References web::http::ContentDecoder::content, contentLengthExpected, and socketContext.

Referenced by web::http::Parser::analyzeHeader().

Here is the caller graph for this function:

◆ Identity() [2/3]

web::http::decoder::Identity::Identity ( const Identity )
delete

◆ Identity() [3/3]

web::http::decoder::Identity::Identity ( Identity &&  )
defaultnoexcept

◆ ~Identity()

web::http::decoder::Identity::~Identity ( )
override

Definition at line 60 of file Identity.cpp.

60 {
61 }

Member Function Documentation

◆ operator=() [1/2]

Identity & web::http::decoder::Identity::operator= ( const Identity )
delete

◆ operator=() [2/2]

Identity & web::http::decoder::Identity::operator= ( Identity &&  )
defaultnoexcept

◆ read()

std::size_t web::http::decoder::Identity::read ( )
overrideprivatevirtual

Implements web::http::ContentDecoder.

Definition at line 63 of file Identity.cpp.

63 {
64 std::size_t consumed = 0;
65
66 switch (state) {
67 case -1:
68 content.clear();
69 completed = false;
70 error = false;
71
72 state = 0;
73
74 [[fallthrough]];
75 case 0:
76 std::size_t ret = 0;
77 do {
79 contentLengthRead += ret;
80 consumed += ret;
82 } while (ret > 0 && !completed);
83
84 if (completed) {
85 state = -1;
86 }
87
88 break;
89 }
90 return consumed;
91 }
std::size_t readFromPeer(char *chunk, std::size_t chunklen) const final
std::size_t contentLengthRead
Definition Identity.h:75

References web::http::ContentDecoder::completed, web::http::ContentDecoder::content, contentLengthExpected, contentLengthRead, web::http::ContentDecoder::error, core::socket::stream::SocketContext::readFromPeer(), socketContext, and state.

Here is the call graph for this function:

Member Data Documentation

◆ contentLengthExpected

std::size_t web::http::decoder::Identity::contentLengthExpected = 0
private

Definition at line 74 of file Identity.h.

Referenced by Identity(), and read().

◆ contentLengthRead

std::size_t web::http::decoder::Identity::contentLengthRead = 0
private

Definition at line 75 of file Identity.h.

Referenced by read().

◆ socketContext

const core::socket::stream::SocketContext* web::http::decoder::Identity::socketContext
private

Definition at line 73 of file Identity.h.

Referenced by Identity(), and read().

◆ state

int web::http::decoder::Identity::state = 0
private

Definition at line 77 of file Identity.h.

Referenced by read().


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