LeftHookRoll
An HTTP/1.0 compliant web server, as specified by RFC1945
Loading...
Searching...
No Matches
AllowedMethods Class Reference

A lightweight wrapper for a short bitmap to handle HTTP method validations securely. More...

#include <AllowedMethods.hpp>

Collaboration diagram for AllowedMethods:

Public Member Functions

 AllowedMethods ()
 
 AllowedMethods (const AllowedMethods &other)
 
AllowedMethodsoperator= (const AllowedMethods &other)
 
 ~AllowedMethods ()
 
void addMethod (HTTPMethod method)
 Adds an HTTP method to the allowed bitmap using bitwise OR.
 
void removeMethod (HTTPMethod method)
 Removes an HTTP method from the allowed bitmap using bitwise AND NOT.
 
bool isAllowed (HTTPMethod method) const
 Checks if a specific HTTP method is permitted using bitwise AND.
 
void clear ()
 Clears all methods (resets to 0 / UNKNOWN_METHOD).
 
short getBitmap () const
 Returns the raw bitmap.
 

Static Public Member Functions

static HTTPMethod stringToMethod (const std::string &methodStr)
 Converts a string representation of an HTTP method to its enum value.
 
static std::string methodToString (HTTPMethod method)
 

Private Attributes

short _bitmap
 

Detailed Description

A lightweight wrapper for a short bitmap to handle HTTP method validations securely.

Definition at line 29 of file AllowedMethods.hpp.

Constructor & Destructor Documentation

◆ AllowedMethods() [1/2]

AllowedMethods::AllowedMethods ( )

Definition at line 3 of file AllowedMethods.cpp.

◆ AllowedMethods() [2/2]

AllowedMethods::AllowedMethods ( const AllowedMethods other)

Definition at line 5 of file AllowedMethods.cpp.

◆ ~AllowedMethods()

AllowedMethods::~AllowedMethods ( )

Definition at line 14 of file AllowedMethods.cpp.

Member Function Documentation

◆ operator=()

AllowedMethods & AllowedMethods::operator= ( const AllowedMethods other)

Definition at line 7 of file AllowedMethods.cpp.

◆ addMethod()

void AllowedMethods::addMethod ( HTTPMethod  method)

Adds an HTTP method to the allowed bitmap using bitwise OR.

Definition at line 18 of file AllowedMethods.cpp.

◆ removeMethod()

void AllowedMethods::removeMethod ( HTTPMethod  method)

Removes an HTTP method from the allowed bitmap using bitwise AND NOT.

Definition at line 23 of file AllowedMethods.cpp.

◆ isAllowed()

bool AllowedMethods::isAllowed ( HTTPMethod  method) const

Checks if a specific HTTP method is permitted using bitwise AND.

Definition at line 28 of file AllowedMethods.cpp.

◆ clear()

void AllowedMethods::clear ( )

Clears all methods (resets to 0 / UNKNOWN_METHOD).

Definition at line 33 of file AllowedMethods.cpp.

◆ getBitmap()

short AllowedMethods::getBitmap ( ) const

Returns the raw bitmap.

Definition at line 38 of file AllowedMethods.cpp.

◆ stringToMethod()

HTTPMethod AllowedMethods::stringToMethod ( const std::string &  methodStr)
static

Converts a string representation of an HTTP method to its enum value.

Definition at line 43 of file AllowedMethods.cpp.

◆ methodToString()

std::string AllowedMethods::methodToString ( HTTPMethod  method)
static

Definition at line 55 of file AllowedMethods.cpp.

Member Data Documentation

◆ _bitmap

short AllowedMethods::_bitmap
private

Definition at line 71 of file AllowedMethods.hpp.


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