Encapsulates a network port number.
More...
#include <Port.h>
|
|
using | Number = std::uint16_t |
| | Type used to store the port number.
|
| |
|
| | Port () noexcept |
| | Constructor.
|
| |
| | Port (Number number) noexcept |
| | Constructor.
|
| |
| | Port (const std::string &port) |
| | Sets the port number from the given string.
|
| |
|
void | reset () noexcept |
| | Resets the port number to 0.
|
| |
| void | setNumber (Number number) noexcept |
| | Sets the port number to the given value.
|
| |
| Number | getNumber () const noexcept |
| | Returns the port number.
|
| |
| OTC_SDK_API void | setFromString (const std::string &port) noexcept(false) |
| | Sets the port number from the given string.
|
| |
| OTC_SDK_API std::string | toString () const noexcept |
| | Returns the port number as a string.
|
| |
| bool | operator== (const Port &rhs) const noexcept |
| | Returns whether this port equals the provided one.
|
| |
| bool | operator!= (const Port &rhs) const noexcept |
| | Returns whether this port is different from the provided one.
|
| |
| bool | operator< (const Port &rhs) const noexcept |
| | Returns whether this port number is smaller than the provided one.
|
| |
Encapsulates a network port number.
Port number a usually separated by a : from an IP address like
192.168.0.2:50101
Here the port number is 50101.
◆ Port() [1/3]
Constructor.
The port number is set to 0.
◆ Port() [2/3]
| optris::Port::Port |
( |
Number |
number | ) |
|
|
inlinenoexcept |
Constructor.
Native byte order is expected.
- Parameters
-
| [in] | number | of the port in [0, 65535]. |
◆ Port() [3/3]
| optris::Port::Port |
( |
const std::string & |
port | ) |
|
|
inline |
Sets the port number from the given string.
- Parameters
-
- Exceptions
-
| SDKException | if the given string does not contain a valid port number. |
◆ getNumber()
Returns the port number.
Native byte order is used.
- Returns
- port number.
◆ operator!=()
| bool optris::Port::operator!= |
( |
const Port & |
rhs | ) |
const |
|
inlinenoexcept |
Returns whether this port is different from the provided one.
- Parameters
-
| [in] | rhs | port to compare this one to. |
- Returns
- true, if this port is different from the provided one.
◆ operator<()
| bool optris::Port::operator< |
( |
const Port & |
rhs | ) |
const |
|
inlinenoexcept |
Returns whether this port number is smaller than the provided one.
- Parameters
-
| [in] | rhs | port to compare this one to. |
- Returns
- true, if this port is smaller than the provided one.
◆ operator==()
| bool optris::Port::operator== |
( |
const Port & |
rhs | ) |
const |
|
inlinenoexcept |
Returns whether this port equals the provided one.
- Parameters
-
| [in] | rhs | port to compare this one to. |
- Returns
- true, if this port equals the provided one. False otherwise.
◆ setFromString()
| OTC_SDK_API void optris::Port::setFromString |
( |
const std::string & |
port | ) |
|
Sets the port number from the given string.
- Parameters
-
- Exceptions
-
| SDKException | if the given string does not contain a valid port number. |
◆ setNumber()
| void optris::Port::setNumber |
( |
Number |
number | ) |
|
|
inlinenoexcept |
Sets the port number to the given value.
Native byte order is expected.
- Parameters
-
| [in] | number | port number to set. |
◆ toString()
| OTC_SDK_API std::string optris::Port::toString |
( |
| ) |
const |
|
noexcept |
Returns the port number as a string.
- Returns
- port number as a string.
The documentation for this class was generated from the following file: