Represent a HTTP method. More...
Classes | |
class | InvalidMethod |
Error that represents when a custom method does not conform to the HTTP standard. More... | |
Public Types | |
enum | Verb { Get , Head , Post , Put , Delete , Connect , Options , Trace } |
A list of standard HTTP methods. More... | |
Public Member Functions | |
BHttpMethod (BHttpMethod &&other) noexcept | |
Move constructor. | |
BHttpMethod (const BHttpMethod &other) | |
Copy constructor. | |
BHttpMethod (const std::string_view &method) | |
Construct a custom method. | |
BHttpMethod (Verb verb) noexcept | |
Construct a standard method. | |
~BHttpMethod () | |
Destructor. | |
const std::string_view | Method () const noexcept |
Get a string representation of the method. | |
bool | operator!= (const Verb &other) const noexcept |
Comparison operator. | |
BHttpMethod & | operator= (BHttpMethod &&other) noexcept |
Move assignment. Moves the data from the other to this object. The other object will be set to BHttpMethod::Get. | |
BHttpMethod & | operator= (const BHttpMethod &other) |
Copy assignment. | |
bool | operator== (const Verb &other) const noexcept |
Comparison operator. | |
Represent a HTTP method.
The HTTP standard specifies that HTTP requests have a method. Common methods are GET
and HEAD
methods. Standardized and common methods are in the form of verbs and are in capitalized letters from the ASCII token set, though any valid token can be used.
It is most likely that you will not use the methods of this class directly, instead you will use the implicit constructors while interacting with the BHttpRequest class.
|
noexcept |
Construct a standard method.
verb | The chosen method. |
BPrivate::Network::BHttpMethod::BHttpMethod | ( | const std::string_view & | method | ) |
Construct a custom method.
method | The verb for the method. |
std::bad_alloc | In case it is not possible to allocate memory for the custom string. |
BHttpMethod::InvalidMethod | In case the method is empty or contains invalid characters. |
BPrivate::Network::BHttpMethod::BHttpMethod | ( | const BHttpMethod & | other | ) |
Copy constructor.
Copy data from an other object.
std::bad_alloc | When the other object contains a custom verb, this exception will be raised if it is impossible to allocate memory. |
|
noexcept |
Move constructor.
Moves the data from the other to this object. The other object will be set to BHttpMethod::Get.
BPrivate::Network::BHttpMethod::~BHttpMethod | ( | ) |
Destructor.
|
noexcept |
Get a string representation of the method.
std::string_view
that is a string representation of the standard or custom method in this object. The lifetime of the string view is bound to the lifetime of this method.
|
noexcept |
Comparison operator.
other | The verb to compare to. |
true | This method is different from other. |
false | This method is equal to other. |
|
noexcept |
Move assignment. Moves the data from the other to this object. The other object will be set to BHttpMethod::Get.
BHttpMethod & BPrivate::Network::BHttpMethod::operator= | ( | const BHttpMethod & | other | ) |
Copy assignment.
Copy data from an other object.
std::bad_alloc | When the other object contains a custom verb, this exception will be raised if it is impossible to allocate memory. |
|
noexcept |
Comparison operator.
other | The verb to compare to. |
true | This method is equal to other. |
false | This method is different from other. |