dodo  0.0.1
A C++ library to create containerized Linux services
dodo::network::protocol::http::HTTPVersion Class Reference

HHTP version comprising a major and minor number, convertable from and to string as in HTTP requests. More...

#include <httpversion.hpp>

Inheritance diagram for dodo::network::protocol::http::HTTPVersion:
Collaboration diagram for dodo::network::protocol::http::HTTPVersion:

Public Member Functions

 HTTPVersion ()
 Default constructor to HTTP/1.0. More...
 
 HTTPVersion (unsigned int major, unsigned int minor)
 Construct from major and minor. More...
 
virtual std::string asString () const
 Convert to string as 'HTTP/major_.minor_'. More...
 
unsigned int getMajor () const
 Return the major version. More...
 
unsigned int getMinor () const
 Return the minor version. More...
 
bool operator< (const HTTPVersion &version) const
 Less-than operator. More...
 
HTTPVersionoperator= (const HTTPVersion &version)
 Assignment operator. More...
 
bool operator== (const HTTPVersion &version) const
 Equality operator. More...
 
bool operator> (const HTTPVersion &version) const
 Greater than operator. More...
 
virtual ParseResult parse (VirtualReadBuffer &buffer)
 Construct from current position in the VirtualReadBuffer 'HTTP/major_.minor_'. More...
 

Private Attributes

unsigned int major_
 The major version. More...
 
unsigned int minor_
 The minor version. More...
 

Additional Inherited Members

- Public Types inherited from dodo::network::protocol::http::HTTPFragment
enum  ParseError : unsigned int {
  peOk = 0, peIncomplete, peSystemError, peExpectCRLF,
  peUnFinishedToken, peExpectingHeaderColon, peInvalidHeaderFieldValue, peInvalidHeaderListEnd,
  peInvalidMethod, peInvalidHTTPVersion, peInvalidRequestLine, peInvalidContentLength,
  peUnexpectedBody, peInvalidTransferEncoding, peInvalidChunkHex, peInvalidLastChunk,
  peExpectingUnsignedInt
}
 Parse results returned by the parse functions. More...
 
- Static Public Member Functions inherited from dodo::network::protocol::http::HTTPFragment
static std::string getParseResultAsString (ParseError error)
 Return the string description of a ParseError. More...
 

Detailed Description

HHTP version comprising a major and minor number, convertable from and to string as in HTTP requests.

Definition at line 38 of file httpversion.hpp.

Constructor & Destructor Documentation

◆ HTTPVersion() [1/2]

dodo::network::protocol::http::HTTPVersion::HTTPVersion ( )
inline

Default constructor to HTTP/1.0.

Definition at line 43 of file httpversion.hpp.

◆ HTTPVersion() [2/2]

dodo::network::protocol::http::HTTPVersion::HTTPVersion ( unsigned int  major,
unsigned int  minor 
)
inlineexplicit

Construct from major and minor.

Parameters
majorthe major to set.
minorthe minor to set.

Definition at line 50 of file httpversion.hpp.

Member Function Documentation

◆ asString()

virtual std::string dodo::network::protocol::http::HTTPVersion::asString ( ) const
inlinevirtual

Convert to string as 'HTTP/major_.minor_'.

Returns
the HTTP VERSION string.

Implements dodo::network::protocol::http::HTTPFragment.

Definition at line 56 of file httpversion.hpp.

References major_, and minor_.

Referenced by dodo::network::protocol::http::HTTPRequest::HTTPRequestLine::asString(), and dodo::network::protocol::http::HTTPResponse::HTTPResponseLine::asString().

Here is the caller graph for this function:

◆ getMajor()

unsigned int dodo::network::protocol::http::HTTPVersion::getMajor ( ) const
inline

Return the major version.

Returns
The major version.

Definition at line 73 of file httpversion.hpp.

References major_.

◆ getMinor()

unsigned int dodo::network::protocol::http::HTTPVersion::getMinor ( ) const
inline

Return the minor version.

Returns
The minor version.

Definition at line 79 of file httpversion.hpp.

References minor_.

◆ operator<()

bool dodo::network::protocol::http::HTTPVersion::operator< ( const HTTPVersion version) const
inline

Less-than operator.

Parameters
versionThe HTTPVersion to compare to.
Returns
True if this < version.

Definition at line 100 of file httpversion.hpp.

References major_, and minor_.

◆ operator=()

HTTPVersion& dodo::network::protocol::http::HTTPVersion::operator= ( const HTTPVersion version)
inline

Assignment operator.

Parameters
versionThe version to assigne.
Returns
This HTTPVersion.

Definition at line 86 of file httpversion.hpp.

References major_, and minor_.

◆ operator==()

bool dodo::network::protocol::http::HTTPVersion::operator== ( const HTTPVersion version) const
inline

Equality operator.

Parameters
versionThe HTTPVersion to compare to.
Returns
True when equal.

Definition at line 93 of file httpversion.hpp.

References major_, and minor_.

◆ operator>()

bool dodo::network::protocol::http::HTTPVersion::operator> ( const HTTPVersion version) const
inline

Greater than operator.

Parameters
versionThe HTTPVersion to compare to.
Returns
True if this > version.

Definition at line 108 of file httpversion.hpp.

References major_.

◆ parse()

Field Documentation

◆ major_

unsigned int dodo::network::protocol::http::HTTPVersion::major_
private

The major version.

Definition at line 109 of file httpversion.hpp.

Referenced by asString(), getMajor(), operator<(), operator=(), operator==(), operator>(), and parse().

◆ minor_

unsigned int dodo::network::protocol::http::HTTPVersion::minor_
private

The minor version.

Definition at line 115 of file httpversion.hpp.

Referenced by asString(), getMinor(), operator<(), operator=(), operator==(), and parse().


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